diff options
636 files changed, 0 insertions, 108555 deletions
diff --git a/sys/lib/python/bsddb/test/__init__.py b/sys/lib/python/bsddb/test/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/sys/lib/python/bsddb/test/__init__.py +++ /dev/null diff --git a/sys/lib/python/bsddb/test/test_1413192.py b/sys/lib/python/bsddb/test/test_1413192.py deleted file mode 100644 index 436f40786..000000000 --- a/sys/lib/python/bsddb/test/test_1413192.py +++ /dev/null @@ -1,21 +0,0 @@ - -# http://python.org/sf/1413192 -# -# This test relies on the variable names, see the bug report for details. -# The problem was that the env was deallocated prior to the txn. - -try: - # For Pythons w/distutils and add-on pybsddb - from bsddb3 import db -except ImportError: - # For Python >= 2.3 builtin bsddb distribution - from bsddb import db - -env_name = '.' - -env = db.DBEnv() -env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN | db.DB_INIT_MPOOL) -the_txn = env.txn_begin() - -map = db.DB(env) -map.open('xxx.db', "p", db.DB_HASH, db.DB_CREATE, 0666, txn=the_txn) diff --git a/sys/lib/python/bsddb/test/test_all.py b/sys/lib/python/bsddb/test/test_all.py deleted file mode 100644 index ad8b1e9e9..000000000 --- a/sys/lib/python/bsddb/test/test_all.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Run all test cases. -""" - -import sys -import os -import unittest -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -verbose = 0 -if 'verbose' in sys.argv: - verbose = 1 - sys.argv.remove('verbose') - -if 'silent' in sys.argv: # take care of old flag, just in case - verbose = 0 - sys.argv.remove('silent') - - -def print_versions(): - print - print '-=' * 38 - print db.DB_VERSION_STRING - print 'bsddb.db.version(): %s' % (db.version(), ) - print 'bsddb.db.__version__: %s' % db.__version__ - print 'bsddb.db.cvsid: %s' % db.cvsid - print 'python version: %s' % sys.version - print 'My pid: %s' % os.getpid() - print '-=' * 38 - - -class PrintInfoFakeTest(unittest.TestCase): - def testPrintVersions(self): - print_versions() - - -# This little hack is for when this module is run as main and all the -# other modules import it so they will still be able to get the right -# verbose setting. It's confusing but it works. -import test_all -test_all.verbose = verbose - - -def suite(): - try: - # this is special, it used to segfault the interpreter - import test_1413192 - except: - pass - - test_modules = [ - 'test_associate', - 'test_basics', - 'test_compat', - 'test_compare', - 'test_dbobj', - 'test_dbshelve', - 'test_dbtables', - 'test_env_close', - 'test_get_none', - 'test_join', - 'test_lock', - 'test_misc', - 'test_pickle', - 'test_queue', - 'test_recno', - 'test_thread', - 'test_sequence', - 'test_cursor_pget_bug', - ] - - alltests = unittest.TestSuite() - for name in test_modules: - module = __import__(name) - alltests.addTest(module.test_suite()) - return alltests - - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(PrintInfoFakeTest)) - return suite - - -if __name__ == '__main__': - print_versions() - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/bsddb/test/test_associate.py b/sys/lib/python/bsddb/test/test_associate.py deleted file mode 100644 index 05ef83cb6..000000000 --- a/sys/lib/python/bsddb/test/test_associate.py +++ /dev/null @@ -1,478 +0,0 @@ -""" -TestCases for DB.associate. -""" - -import sys, os, string -import tempfile -import time -from pprint import pprint - -try: - from threading import Thread, currentThread - have_threads = 1 -except ImportError: - have_threads = 0 - -import unittest -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbshelve -except ImportError: - # For Python 2.3 - from bsddb import db, dbshelve - - -#---------------------------------------------------------------------- - - -musicdata = { -1 : ("Bad English", "The Price Of Love", "Rock"), -2 : ("DNA featuring Suzanne Vega", "Tom's Diner", "Rock"), -3 : ("George Michael", "Praying For Time", "Rock"), -4 : ("Gloria Estefan", "Here We Are", "Rock"), -5 : ("Linda Ronstadt", "Don't Know Much", "Rock"), -6 : ("Michael Bolton", "How Am I Supposed To Live Without You", "Blues"), -7 : ("Paul Young", "Oh Girl", "Rock"), -8 : ("Paula Abdul", "Opposites Attract", "Rock"), -9 : ("Richard Marx", "Should've Known Better", "Rock"), -10: ("Rod Stewart", "Forever Young", "Rock"), -11: ("Roxette", "Dangerous", "Rock"), -12: ("Sheena Easton", "The Lover In Me", "Rock"), -13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"), -14: ("Stevie B.", "Because I Love You", "Rock"), -15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"), -16: ("The Bangles", "Eternal Flame", "Rock"), -17: ("Wilson Phillips", "Release Me", "Rock"), -18: ("Billy Joel", "Blonde Over Blue", "Rock"), -19: ("Billy Joel", "Famous Last Words", "Rock"), -20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"), -21: ("Billy Joel", "The River Of Dreams", "Rock"), -22: ("Billy Joel", "Two Thousand Years", "Rock"), -23: ("Janet Jackson", "Alright", "Rock"), -24: ("Janet Jackson", "Black Cat", "Rock"), -25: ("Janet Jackson", "Come Back To Me", "Rock"), -26: ("Janet Jackson", "Escapade", "Rock"), -27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"), -28: ("Janet Jackson", "Miss You Much", "Rock"), -29: ("Janet Jackson", "Rhythm Nation", "Rock"), -30: ("Janet Jackson", "State Of The World", "Rock"), -31: ("Janet Jackson", "The Knowledge", "Rock"), -32: ("Spyro Gyra", "End of Romanticism", "Jazz"), -33: ("Spyro Gyra", "Heliopolis", "Jazz"), -34: ("Spyro Gyra", "Jubilee", "Jazz"), -35: ("Spyro Gyra", "Little Linda", "Jazz"), -36: ("Spyro Gyra", "Morning Dance", "Jazz"), -37: ("Spyro Gyra", "Song for Lorraine", "Jazz"), -38: ("Yes", "Owner Of A Lonely Heart", "Rock"), -39: ("Yes", "Rhythm Of Love", "Rock"), -40: ("Cusco", "Dream Catcher", "New Age"), -41: ("Cusco", "Geronimos Laughter", "New Age"), -42: ("Cusco", "Ghost Dance", "New Age"), -43: ("Blue Man Group", "Drumbone", "New Age"), -44: ("Blue Man Group", "Endless Column", "New Age"), -45: ("Blue Man Group", "Klein Mandelbrot", "New Age"), -46: ("Kenny G", "Silhouette", "Jazz"), -47: ("Sade", "Smooth Operator", "Jazz"), -48: ("David Arkenstone", "Papillon (On The Wings Of The Butterfly)", - "New Age"), -49: ("David Arkenstone", "Stepping Stars", "New Age"), -50: ("David Arkenstone", "Carnation Lily Lily Rose", "New Age"), -51: ("David Lanz", "Behind The Waterfall", "New Age"), -52: ("David Lanz", "Cristofori's Dream", "New Age"), -53: ("David Lanz", "Heartsounds", "New Age"), -54: ("David Lanz", "Leaves on the Seine", "New Age"), -99: ("unknown artist", "Unnamed song", "Unknown"), -} - -#---------------------------------------------------------------------- - -class AssociateErrorTestCase(unittest.TestCase): - def setUp(self): - self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - os.mkdir(homeDir) - except os.error: - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - self.env = db.DBEnv() - self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) - - def tearDown(self): - self.env.close() - self.env = None - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - - def test00_associateDBError(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test00_associateDBError..." % \ - self.__class__.__name__ - - dupDB = db.DB(self.env) - dupDB.set_flags(db.DB_DUP) - dupDB.open(self.filename, "primary", db.DB_BTREE, db.DB_CREATE) - - secDB = db.DB(self.env) - secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE) - - # dupDB has been configured to allow duplicates, it can't - # associate with a secondary. BerkeleyDB will return an error. - try: - def f(a,b): return a+b - dupDB.associate(secDB, f) - except db.DBError: - # good - secDB.close() - dupDB.close() - else: - secDB.close() - dupDB.close() - self.fail("DBError exception was expected") - - - -#---------------------------------------------------------------------- - - -class AssociateTestCase(unittest.TestCase): - keytype = '' - envFlags = 0 - dbFlags = 0 - - def setUp(self): - self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - os.mkdir(homeDir) - except os.error: - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - self.env = db.DBEnv() - self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | - db.DB_INIT_LOCK | db.DB_THREAD | self.envFlags) - - def tearDown(self): - self.closeDB() - self.env.close() - self.env = None - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def addDataToDB(self, d, txn=None): - for key, value in musicdata.items(): - if type(self.keytype) == type(''): - key = "%02d" % key - d.put(key, string.join(value, '|'), txn=txn) - - def createDB(self, txn=None): - self.cur = None - self.secDB = None - self.primary = db.DB(self.env) - self.primary.set_get_returns_none(2) - if db.version() >= (4, 1): - self.primary.open(self.filename, "primary", self.dbtype, - db.DB_CREATE | db.DB_THREAD | self.dbFlags, txn=txn) - else: - self.primary.open(self.filename, "primary", self.dbtype, - db.DB_CREATE | db.DB_THREAD | self.dbFlags) - - def closeDB(self): - if self.cur: - self.cur.close() - self.cur = None - if self.secDB: - self.secDB.close() - self.secDB = None - self.primary.close() - self.primary = None - - def getDB(self): - return self.primary - - - def test01_associateWithDB(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_associateWithDB..." % \ - self.__class__.__name__ - - self.createDB() - - self.secDB = db.DB(self.env) - self.secDB.set_flags(db.DB_DUP) - self.secDB.set_get_returns_none(2) - self.secDB.open(self.filename, "secondary", db.DB_BTREE, - db.DB_CREATE | db.DB_THREAD | self.dbFlags) - self.getDB().associate(self.secDB, self.getGenre) - - self.addDataToDB(self.getDB()) - - self.finish_test(self.secDB) - - - def test02_associateAfterDB(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_associateAfterDB..." % \ - self.__class__.__name__ - - self.createDB() - self.addDataToDB(self.getDB()) - - self.secDB = db.DB(self.env) - self.secDB.set_flags(db.DB_DUP) - self.secDB.open(self.filename, "secondary", db.DB_BTREE, - db.DB_CREATE | db.DB_THREAD | self.dbFlags) - - # adding the DB_CREATE flag will cause it to index existing records - self.getDB().associate(self.secDB, self.getGenre, db.DB_CREATE) - - self.finish_test(self.secDB) - - - def finish_test(self, secDB, txn=None): - # 'Blues' should not be in the secondary database - vals = secDB.pget('Blues', txn=txn) - assert vals == None, vals - - vals = secDB.pget('Unknown', txn=txn) - assert vals[0] == 99 or vals[0] == '99', vals - vals[1].index('Unknown') - vals[1].index('Unnamed') - vals[1].index('unknown') - - if verbose: - print "Primary key traversal:" - self.cur = self.getDB().cursor(txn) - count = 0 - rec = self.cur.first() - while rec is not None: - if type(self.keytype) == type(''): - assert string.atoi(rec[0]) # for primary db, key is a number - else: - assert rec[0] and type(rec[0]) == type(0) - count = count + 1 - if verbose: - print rec - rec = self.cur.next() - assert count == len(musicdata) # all items accounted for - - - if verbose: - print "Secondary key traversal:" - self.cur = secDB.cursor(txn) - count = 0 - - # test cursor pget - vals = self.cur.pget('Unknown', flags=db.DB_LAST) - assert vals[1] == 99 or vals[1] == '99', vals - assert vals[0] == 'Unknown' - vals[2].index('Unknown') - vals[2].index('Unnamed') - vals[2].index('unknown') - - vals = self.cur.pget('Unknown', data='wrong value', flags=db.DB_GET_BOTH) - assert vals == None, vals - - rec = self.cur.first() - assert rec[0] == "Jazz" - while rec is not None: - count = count + 1 - if verbose: - print rec - rec = self.cur.next() - # all items accounted for EXCEPT for 1 with "Blues" genre - assert count == len(musicdata)-1 - - self.cur = None - - def getGenre(self, priKey, priData): - assert type(priData) == type("") - if verbose: - print 'getGenre key: %r data: %r' % (priKey, priData) - genre = string.split(priData, '|')[2] - if genre == 'Blues': - return db.DB_DONOTINDEX - else: - return genre - - -#---------------------------------------------------------------------- - - -class AssociateHashTestCase(AssociateTestCase): - dbtype = db.DB_HASH - -class AssociateBTreeTestCase(AssociateTestCase): - dbtype = db.DB_BTREE - -class AssociateRecnoTestCase(AssociateTestCase): - dbtype = db.DB_RECNO - keytype = 0 - -#---------------------------------------------------------------------- - -class AssociateBTreeTxnTestCase(AssociateBTreeTestCase): - envFlags = db.DB_INIT_TXN - dbFlags = 0 - - def txn_finish_test(self, sDB, txn): - try: - self.finish_test(sDB, txn=txn) - finally: - if self.cur: - self.cur.close() - self.cur = None - if txn: - txn.commit() - - def test13_associate_in_transaction(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test13_associateAutoCommit..." % \ - self.__class__.__name__ - - txn = self.env.txn_begin() - try: - self.createDB(txn=txn) - - self.secDB = db.DB(self.env) - self.secDB.set_flags(db.DB_DUP) - self.secDB.set_get_returns_none(2) - self.secDB.open(self.filename, "secondary", db.DB_BTREE, - db.DB_CREATE | db.DB_THREAD, txn=txn) - if db.version() >= (4,1): - self.getDB().associate(self.secDB, self.getGenre, txn=txn) - else: - self.getDB().associate(self.secDB, self.getGenre) - - self.addDataToDB(self.getDB(), txn=txn) - except: - txn.abort() - raise - - self.txn_finish_test(self.secDB, txn=txn) - - -#---------------------------------------------------------------------- - -class ShelveAssociateTestCase(AssociateTestCase): - - def createDB(self): - self.primary = dbshelve.open(self.filename, - dbname="primary", - dbenv=self.env, - filetype=self.dbtype) - - def addDataToDB(self, d): - for key, value in musicdata.items(): - if type(self.keytype) == type(''): - key = "%02d" % key - d.put(key, value) # save the value as is this time - - - def getGenre(self, priKey, priData): - assert type(priData) == type(()) - if verbose: - print 'getGenre key: %r data: %r' % (priKey, priData) - genre = priData[2] - if genre == 'Blues': - return db.DB_DONOTINDEX - else: - return genre - - -class ShelveAssociateHashTestCase(ShelveAssociateTestCase): - dbtype = db.DB_HASH - -class ShelveAssociateBTreeTestCase(ShelveAssociateTestCase): - dbtype = db.DB_BTREE - -class ShelveAssociateRecnoTestCase(ShelveAssociateTestCase): - dbtype = db.DB_RECNO - keytype = 0 - - -#---------------------------------------------------------------------- - -class ThreadedAssociateTestCase(AssociateTestCase): - - def addDataToDB(self, d): - t1 = Thread(target = self.writer1, - args = (d, )) - t2 = Thread(target = self.writer2, - args = (d, )) - - t1.start() - t2.start() - t1.join() - t2.join() - - def writer1(self, d): - for key, value in musicdata.items(): - if type(self.keytype) == type(''): - key = "%02d" % key - d.put(key, string.join(value, '|')) - - def writer2(self, d): - for x in range(100, 600): - key = 'z%2d' % x - value = [key] * 4 - d.put(key, string.join(value, '|')) - - -class ThreadedAssociateHashTestCase(ShelveAssociateTestCase): - dbtype = db.DB_HASH - -class ThreadedAssociateBTreeTestCase(ShelveAssociateTestCase): - dbtype = db.DB_BTREE - -class ThreadedAssociateRecnoTestCase(ShelveAssociateTestCase): - dbtype = db.DB_RECNO - keytype = 0 - - -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - - if db.version() >= (3, 3, 11): - suite.addTest(unittest.makeSuite(AssociateErrorTestCase)) - - suite.addTest(unittest.makeSuite(AssociateHashTestCase)) - suite.addTest(unittest.makeSuite(AssociateBTreeTestCase)) - suite.addTest(unittest.makeSuite(AssociateRecnoTestCase)) - - if db.version() >= (4, 1): - suite.addTest(unittest.makeSuite(AssociateBTreeTxnTestCase)) - - suite.addTest(unittest.makeSuite(ShelveAssociateHashTestCase)) - suite.addTest(unittest.makeSuite(ShelveAssociateBTreeTestCase)) - suite.addTest(unittest.makeSuite(ShelveAssociateRecnoTestCase)) - - if have_threads: - suite.addTest(unittest.makeSuite(ThreadedAssociateHashTestCase)) - suite.addTest(unittest.makeSuite(ThreadedAssociateBTreeTestCase)) - suite.addTest(unittest.makeSuite(ThreadedAssociateRecnoTestCase)) - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_basics.py b/sys/lib/python/bsddb/test/test_basics.py deleted file mode 100644 index e6022ba51..000000000 --- a/sys/lib/python/bsddb/test/test_basics.py +++ /dev/null @@ -1,989 +0,0 @@ -""" -Basic TestCases for BTree and hash DBs, with and without a DBEnv, with -various DB flags, etc. -""" - -import os -import sys -import errno -import shutil -import string -import tempfile -from pprint import pprint -import unittest -import time - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -from test_all import verbose - -DASH = '-' - - -#---------------------------------------------------------------------- - -class VersionTestCase(unittest.TestCase): - def test00_version(self): - info = db.version() - if verbose: - print '\n', '-=' * 20 - print 'bsddb.db.version(): %s' % (info, ) - print db.DB_VERSION_STRING - print '-=' * 20 - assert info == (db.DB_VERSION_MAJOR, db.DB_VERSION_MINOR, - db.DB_VERSION_PATCH) - -#---------------------------------------------------------------------- - -class BasicTestCase(unittest.TestCase): - dbtype = db.DB_UNKNOWN # must be set in derived class - dbopenflags = 0 - dbsetflags = 0 - dbmode = 0660 - dbname = None - useEnv = 0 - envflags = 0 - envsetflags = 0 - - _numKeys = 1002 # PRIVATE. NOTE: must be an even value - - def setUp(self): - if self.useEnv: - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - shutil.rmtree(homeDir) - except OSError, e: - # unix returns ENOENT, windows returns ESRCH - if e.errno not in (errno.ENOENT, errno.ESRCH): raise - os.mkdir(homeDir) - try: - self.env = db.DBEnv() - self.env.set_lg_max(1024*1024) - self.env.set_tx_max(30) - self.env.set_tx_timestamp(int(time.time())) - self.env.set_flags(self.envsetflags, 1) - self.env.open(homeDir, self.envflags | db.DB_CREATE) - tempfile.tempdir = homeDir - self.filename = os.path.split(tempfile.mktemp())[1] - tempfile.tempdir = None - # Yes, a bare except is intended, since we're re-raising the exc. - except: - shutil.rmtree(homeDir) - raise - else: - self.env = None - self.filename = tempfile.mktemp() - - # create and open the DB - self.d = db.DB(self.env) - self.d.set_flags(self.dbsetflags) - if self.dbname: - self.d.open(self.filename, self.dbname, self.dbtype, - self.dbopenflags|db.DB_CREATE, self.dbmode) - else: - self.d.open(self.filename, # try out keyword args - mode = self.dbmode, - dbtype = self.dbtype, - flags = self.dbopenflags|db.DB_CREATE) - - self.populateDB() - - - def tearDown(self): - self.d.close() - if self.env is not None: - self.env.close() - shutil.rmtree(self.homeDir) - ## Make a new DBEnv to remove the env files from the home dir. - ## (It can't be done while the env is open, nor after it has been - ## closed, so we make a new one to do it.) - #e = db.DBEnv() - #e.remove(self.homeDir) - #os.remove(os.path.join(self.homeDir, self.filename)) - else: - os.remove(self.filename) - - - - def populateDB(self, _txn=None): - d = self.d - - for x in range(self._numKeys/2): - key = '%04d' % (self._numKeys - x) # insert keys in reverse order - data = self.makeData(key) - d.put(key, data, _txn) - - d.put('empty value', '', _txn) - - for x in range(self._numKeys/2-1): - key = '%04d' % x # and now some in forward order - data = self.makeData(key) - d.put(key, data, _txn) - - if _txn: - _txn.commit() - - num = len(d) - if verbose: - print "created %d records" % num - - - def makeData(self, key): - return DASH.join([key] * 5) - - - - #---------------------------------------- - - def test01_GetsAndPuts(self): - d = self.d - - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_GetsAndPuts..." % self.__class__.__name__ - - for key in ['0001', '0100', '0400', '0700', '0999']: - data = d.get(key) - if verbose: - print data - - assert d.get('0321') == '0321-0321-0321-0321-0321' - - # By default non-existant keys return None... - assert d.get('abcd') == None - - # ...but they raise exceptions in other situations. Call - # set_get_returns_none() to change it. - try: - d.delete('abcd') - except db.DBNotFoundError, val: - assert val[0] == db.DB_NOTFOUND - if verbose: print val - else: - self.fail("expected exception") - - - d.put('abcd', 'a new record') - assert d.get('abcd') == 'a new record' - - d.put('abcd', 'same key') - if self.dbsetflags & db.DB_DUP: - assert d.get('abcd') == 'a new record' - else: - assert d.get('abcd') == 'same key' - - - try: - d.put('abcd', 'this should fail', flags=db.DB_NOOVERWRITE) - except db.DBKeyExistError, val: - assert val[0] == db.DB_KEYEXIST - if verbose: print val - else: - self.fail("expected exception") - - if self.dbsetflags & db.DB_DUP: - assert d.get('abcd') == 'a new record' - else: - assert d.get('abcd') == 'same key' - - - d.sync() - d.close() - del d - - self.d = db.DB(self.env) - if self.dbname: - self.d.open(self.filename, self.dbname) - else: - self.d.open(self.filename) - d = self.d - - assert d.get('0321') == '0321-0321-0321-0321-0321' - if self.dbsetflags & db.DB_DUP: - assert d.get('abcd') == 'a new record' - else: - assert d.get('abcd') == 'same key' - - rec = d.get_both('0555', '0555-0555-0555-0555-0555') - if verbose: - print rec - - assert d.get_both('0555', 'bad data') == None - - # test default value - data = d.get('bad key', 'bad data') - assert data == 'bad data' - - # any object can pass through - data = d.get('bad key', self) - assert data == self - - s = d.stat() - assert type(s) == type({}) - if verbose: - print 'd.stat() returned this dictionary:' - pprint(s) - - - #---------------------------------------- - - def test02_DictionaryMethods(self): - d = self.d - - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_DictionaryMethods..." % \ - self.__class__.__name__ - - for key in ['0002', '0101', '0401', '0701', '0998']: - data = d[key] - assert data == self.makeData(key) - if verbose: - print data - - assert len(d) == self._numKeys - keys = d.keys() - assert len(keys) == self._numKeys - assert type(keys) == type([]) - - d['new record'] = 'a new record' - assert len(d) == self._numKeys+1 - keys = d.keys() - assert len(keys) == self._numKeys+1 - - d['new record'] = 'a replacement record' - assert len(d) == self._numKeys+1 - keys = d.keys() - assert len(keys) == self._numKeys+1 - - if verbose: - print "the first 10 keys are:" - pprint(keys[:10]) - - assert d['new record'] == 'a replacement record' - - assert d.has_key('0001') == 1 - assert d.has_key('spam') == 0 - - items = d.items() - assert len(items) == self._numKeys+1 - assert type(items) == type([]) - assert type(items[0]) == type(()) - assert len(items[0]) == 2 - - if verbose: - print "the first 10 items are:" - pprint(items[:10]) - - values = d.values() - assert len(values) == self._numKeys+1 - assert type(values) == type([]) - - if verbose: - print "the first 10 values are:" - pprint(values[:10]) - - - - #---------------------------------------- - - def test03_SimpleCursorStuff(self, get_raises_error=0, set_raises_error=0): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test03_SimpleCursorStuff (get_error %s, set_error %s)..." % \ - (self.__class__.__name__, get_raises_error, set_raises_error) - - if self.env and self.dbopenflags & db.DB_AUTO_COMMIT: - txn = self.env.txn_begin() - else: - txn = None - c = self.d.cursor(txn=txn) - - rec = c.first() - count = 0 - while rec is not None: - count = count + 1 - if verbose and count % 100 == 0: - print rec - try: - rec = c.next() - except db.DBNotFoundError, val: - if get_raises_error: - assert val[0] == db.DB_NOTFOUND - if verbose: print val - rec = None - else: - self.fail("unexpected DBNotFoundError") - assert c.get_current_size() == len(c.current()[1]), "%s != len(%r)" % (c.get_current_size(), c.current()[1]) - - assert count == self._numKeys - - - rec = c.last() - count = 0 - while rec is not None: - count = count + 1 - if verbose and count % 100 == 0: - print rec - try: - rec = c.prev() - except db.DBNotFoundError, val: - if get_raises_error: - assert val[0] == db.DB_NOTFOUND - if verbose: print val - rec = None - else: - self.fail("unexpected DBNotFoundError") - - assert count == self._numKeys - - rec = c.set('0505') - rec2 = c.current() - assert rec == rec2 - assert rec[0] == '0505' - assert rec[1] == self.makeData('0505') - assert c.get_current_size() == len(rec[1]) - - # make sure we get empty values properly - rec = c.set('empty value') - assert rec[1] == '' - assert c.get_current_size() == 0 - - try: - n = c.set('bad key') - except db.DBNotFoundError, val: - assert val[0] == db.DB_NOTFOUND - if verbose: print val - else: - if set_raises_error: - self.fail("expected exception") - if n != None: - self.fail("expected None: %r" % (n,)) - - rec = c.get_both('0404', self.makeData('0404')) - assert rec == ('0404', self.makeData('0404')) - - try: - n = c.get_both('0404', 'bad data') - except db.DBNotFoundError, val: - assert val[0] == db.DB_NOTFOUND - if verbose: print val - else: - if get_raises_error: - self.fail("expected exception") - if n != None: - self.fail("expected None: %r" % (n,)) - - if self.d.get_type() == db.DB_BTREE: - rec = c.set_range('011') - if verbose: - print "searched for '011', found: ", rec - - rec = c.set_range('011',dlen=0,doff=0) - if verbose: - print "searched (partial) for '011', found: ", rec - if rec[1] != '': self.fail('expected empty data portion') - - ev = c.set_range('empty value') - if verbose: - print "search for 'empty value' returned", ev - if ev[1] != '': self.fail('empty value lookup failed') - - c.set('0499') - c.delete() - try: - rec = c.current() - except db.DBKeyEmptyError, val: - if get_raises_error: - assert val[0] == db.DB_KEYEMPTY - if verbose: print val - else: - self.fail("unexpected DBKeyEmptyError") - else: - if get_raises_error: - self.fail('DBKeyEmptyError exception expected') - - c.next() - c2 = c.dup(db.DB_POSITION) - assert c.current() == c2.current() - - c2.put('', 'a new value', db.DB_CURRENT) - assert c.current() == c2.current() - assert c.current()[1] == 'a new value' - - c2.put('', 'er', db.DB_CURRENT, dlen=0, doff=5) - assert c2.current()[1] == 'a newer value' - - c.close() - c2.close() - if txn: - txn.commit() - - # time to abuse the closed cursors and hope we don't crash - methods_to_test = { - 'current': (), - 'delete': (), - 'dup': (db.DB_POSITION,), - 'first': (), - 'get': (0,), - 'next': (), - 'prev': (), - 'last': (), - 'put':('', 'spam', db.DB_CURRENT), - 'set': ("0505",), - } - for method, args in methods_to_test.items(): - try: - if verbose: - print "attempting to use a closed cursor's %s method" % \ - method - # a bug may cause a NULL pointer dereference... - apply(getattr(c, method), args) - except db.DBError, val: - assert val[0] == 0 - if verbose: print val - else: - self.fail("no exception raised when using a buggy cursor's" - "%s method" % method) - - # - # free cursor referencing a closed database, it should not barf: - # - oldcursor = self.d.cursor(txn=txn) - self.d.close() - - # this would originally cause a segfault when the cursor for a - # closed database was cleaned up. it should not anymore. - # SF pybsddb bug id 667343 - del oldcursor - - def test03b_SimpleCursorWithoutGetReturnsNone0(self): - # same test but raise exceptions instead of returning None - if verbose: - print '\n', '-=' * 30 - print "Running %s.test03b_SimpleCursorStuffWithoutGetReturnsNone..." % \ - self.__class__.__name__ - - old = self.d.set_get_returns_none(0) - assert old == 2 - self.test03_SimpleCursorStuff(get_raises_error=1, set_raises_error=1) - - def test03b_SimpleCursorWithGetReturnsNone1(self): - # same test but raise exceptions instead of returning None - if verbose: - print '\n', '-=' * 30 - print "Running %s.test03b_SimpleCursorStuffWithoutGetReturnsNone..." % \ - self.__class__.__name__ - - old = self.d.set_get_returns_none(1) - self.test03_SimpleCursorStuff(get_raises_error=0, set_raises_error=1) - - - def test03c_SimpleCursorGetReturnsNone2(self): - # same test but raise exceptions instead of returning None - if verbose: - print '\n', '-=' * 30 - print "Running %s.test03c_SimpleCursorStuffWithoutSetReturnsNone..." % \ - self.__class__.__name__ - - old = self.d.set_get_returns_none(1) - assert old == 2 - old = self.d.set_get_returns_none(2) - assert old == 1 - self.test03_SimpleCursorStuff(get_raises_error=0, set_raises_error=0) - - #---------------------------------------- - - def test04_PartialGetAndPut(self): - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test04_PartialGetAndPut..." % \ - self.__class__.__name__ - - key = "partialTest" - data = "1" * 1000 + "2" * 1000 - d.put(key, data) - assert d.get(key) == data - assert d.get(key, dlen=20, doff=990) == ("1" * 10) + ("2" * 10) - - d.put("partialtest2", ("1" * 30000) + "robin" ) - assert d.get("partialtest2", dlen=5, doff=30000) == "robin" - - # There seems to be a bug in DB here... Commented out the test for - # now. - ##assert d.get("partialtest2", dlen=5, doff=30010) == "" - - if self.dbsetflags != db.DB_DUP: - # Partial put with duplicate records requires a cursor - d.put(key, "0000", dlen=2000, doff=0) - assert d.get(key) == "0000" - - d.put(key, "1111", dlen=1, doff=2) - assert d.get(key) == "0011110" - - #---------------------------------------- - - def test05_GetSize(self): - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test05_GetSize..." % self.__class__.__name__ - - for i in range(1, 50000, 500): - key = "size%s" % i - #print "before ", i, - d.put(key, "1" * i) - #print "after", - assert d.get_size(key) == i - #print "done" - - #---------------------------------------- - - def test06_Truncate(self): - if db.version() < (3,3): - # truncate is a feature of BerkeleyDB 3.3 and above - return - - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test99_Truncate..." % self.__class__.__name__ - - d.put("abcde", "ABCDE"); - num = d.truncate() - assert num >= 1, "truncate returned <= 0 on non-empty database" - num = d.truncate() - assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,) - - #---------------------------------------- - - -#---------------------------------------------------------------------- - - -class BasicBTreeTestCase(BasicTestCase): - dbtype = db.DB_BTREE - - -class BasicHashTestCase(BasicTestCase): - dbtype = db.DB_HASH - - -class BasicBTreeWithThreadFlagTestCase(BasicTestCase): - dbtype = db.DB_BTREE - dbopenflags = db.DB_THREAD - - -class BasicHashWithThreadFlagTestCase(BasicTestCase): - dbtype = db.DB_HASH - dbopenflags = db.DB_THREAD - - -class BasicWithEnvTestCase(BasicTestCase): - dbopenflags = db.DB_THREAD - useEnv = 1 - envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK - - #---------------------------------------- - - def test07_EnvRemoveAndRename(self): - if not self.env: - return - - if verbose: - print '\n', '-=' * 30 - print "Running %s.test07_EnvRemoveAndRename..." % self.__class__.__name__ - - # can't rename or remove an open DB - self.d.close() - - newname = self.filename + '.renamed' - self.env.dbrename(self.filename, None, newname) - self.env.dbremove(newname) - - # dbremove and dbrename are in 4.1 and later - if db.version() < (4,1): - del test07_EnvRemoveAndRename - - #---------------------------------------- - -class BasicBTreeWithEnvTestCase(BasicWithEnvTestCase): - dbtype = db.DB_BTREE - - -class BasicHashWithEnvTestCase(BasicWithEnvTestCase): - dbtype = db.DB_HASH - - -#---------------------------------------------------------------------- - -class BasicTransactionTestCase(BasicTestCase): - dbopenflags = db.DB_THREAD | db.DB_AUTO_COMMIT - useEnv = 1 - envflags = (db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | - db.DB_INIT_TXN) - envsetflags = db.DB_AUTO_COMMIT - - - def tearDown(self): - self.txn.commit() - BasicTestCase.tearDown(self) - - - def populateDB(self): - txn = self.env.txn_begin() - BasicTestCase.populateDB(self, _txn=txn) - - self.txn = self.env.txn_begin() - - - def test06_Transactions(self): - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test06_Transactions..." % self.__class__.__name__ - - assert d.get('new rec', txn=self.txn) == None - d.put('new rec', 'this is a new record', self.txn) - assert d.get('new rec', txn=self.txn) == 'this is a new record' - self.txn.abort() - assert d.get('new rec') == None - - self.txn = self.env.txn_begin() - - assert d.get('new rec', txn=self.txn) == None - d.put('new rec', 'this is a new record', self.txn) - assert d.get('new rec', txn=self.txn) == 'this is a new record' - self.txn.commit() - assert d.get('new rec') == 'this is a new record' - - self.txn = self.env.txn_begin() - c = d.cursor(self.txn) - rec = c.first() - count = 0 - while rec is not None: - count = count + 1 - if verbose and count % 100 == 0: - print rec - rec = c.next() - assert count == self._numKeys+1 - - c.close() # Cursors *MUST* be closed before commit! - self.txn.commit() - - # flush pending updates - try: - self.env.txn_checkpoint (0, 0, 0) - except db.DBIncompleteError: - pass - - if db.version() >= (4,0): - statDict = self.env.log_stat(0); - assert statDict.has_key('magic') - assert statDict.has_key('version') - assert statDict.has_key('cur_file') - assert statDict.has_key('region_nowait') - - # must have at least one log file present: - logs = self.env.log_archive(db.DB_ARCH_ABS | db.DB_ARCH_LOG) - assert logs != None - for log in logs: - if verbose: - print 'log file: ' + log - if db.version() >= (4,2): - logs = self.env.log_archive(db.DB_ARCH_REMOVE) - assert not logs - - self.txn = self.env.txn_begin() - - #---------------------------------------- - - def test07_TxnTruncate(self): - if db.version() < (3,3): - # truncate is a feature of BerkeleyDB 3.3 and above - return - - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test07_TxnTruncate..." % self.__class__.__name__ - - d.put("abcde", "ABCDE"); - txn = self.env.txn_begin() - num = d.truncate(txn) - assert num >= 1, "truncate returned <= 0 on non-empty database" - num = d.truncate(txn) - assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,) - txn.commit() - - #---------------------------------------- - - def test08_TxnLateUse(self): - txn = self.env.txn_begin() - txn.abort() - try: - txn.abort() - except db.DBError, e: - pass - else: - raise RuntimeError, "DBTxn.abort() called after DB_TXN no longer valid w/o an exception" - - txn = self.env.txn_begin() - txn.commit() - try: - txn.commit() - except db.DBError, e: - pass - else: - raise RuntimeError, "DBTxn.commit() called after DB_TXN no longer valid w/o an exception" - - -class BTreeTransactionTestCase(BasicTransactionTestCase): - dbtype = db.DB_BTREE - -class HashTransactionTestCase(BasicTransactionTestCase): - dbtype = db.DB_HASH - - - -#---------------------------------------------------------------------- - -class BTreeRecnoTestCase(BasicTestCase): - dbtype = db.DB_BTREE - dbsetflags = db.DB_RECNUM - - def test07_RecnoInBTree(self): - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test07_RecnoInBTree..." % self.__class__.__name__ - - rec = d.get(200) - assert type(rec) == type(()) - assert len(rec) == 2 - if verbose: - print "Record #200 is ", rec - - c = d.cursor() - c.set('0200') - num = c.get_recno() - assert type(num) == type(1) - if verbose: - print "recno of d['0200'] is ", num - - rec = c.current() - assert c.set_recno(num) == rec - - c.close() - - - -class BTreeRecnoWithThreadFlagTestCase(BTreeRecnoTestCase): - dbopenflags = db.DB_THREAD - -#---------------------------------------------------------------------- - -class BasicDUPTestCase(BasicTestCase): - dbsetflags = db.DB_DUP - - def test08_DuplicateKeys(self): - d = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test08_DuplicateKeys..." % \ - self.__class__.__name__ - - d.put("dup0", "before") - for x in "The quick brown fox jumped over the lazy dog.".split(): - d.put("dup1", x) - d.put("dup2", "after") - - data = d.get("dup1") - assert data == "The" - if verbose: - print data - - c = d.cursor() - rec = c.set("dup1") - assert rec == ('dup1', 'The') - - next = c.next() - assert next == ('dup1', 'quick') - - rec = c.set("dup1") - count = c.count() - assert count == 9 - - next_dup = c.next_dup() - assert next_dup == ('dup1', 'quick') - - rec = c.set('dup1') - while rec is not None: - if verbose: - print rec - rec = c.next_dup() - - c.set('dup1') - rec = c.next_nodup() - assert rec[0] != 'dup1' - if verbose: - print rec - - c.close() - - - -class BTreeDUPTestCase(BasicDUPTestCase): - dbtype = db.DB_BTREE - -class HashDUPTestCase(BasicDUPTestCase): - dbtype = db.DB_HASH - -class BTreeDUPWithThreadTestCase(BasicDUPTestCase): - dbtype = db.DB_BTREE - dbopenflags = db.DB_THREAD - -class HashDUPWithThreadTestCase(BasicDUPTestCase): - dbtype = db.DB_HASH - dbopenflags = db.DB_THREAD - - -#---------------------------------------------------------------------- - -class BasicMultiDBTestCase(BasicTestCase): - dbname = 'first' - - def otherType(self): - if self.dbtype == db.DB_BTREE: - return db.DB_HASH - else: - return db.DB_BTREE - - def test09_MultiDB(self): - d1 = self.d - if verbose: - print '\n', '-=' * 30 - print "Running %s.test09_MultiDB..." % self.__class__.__name__ - - d2 = db.DB(self.env) - d2.open(self.filename, "second", self.dbtype, - self.dbopenflags|db.DB_CREATE) - d3 = db.DB(self.env) - d3.open(self.filename, "third", self.otherType(), - self.dbopenflags|db.DB_CREATE) - - for x in "The quick brown fox jumped over the lazy dog".split(): - d2.put(x, self.makeData(x)) - - for x in string.letters: - d3.put(x, x*70) - - d1.sync() - d2.sync() - d3.sync() - d1.close() - d2.close() - d3.close() - - self.d = d1 = d2 = d3 = None - - self.d = d1 = db.DB(self.env) - d1.open(self.filename, self.dbname, flags = self.dbopenflags) - d2 = db.DB(self.env) - d2.open(self.filename, "second", flags = self.dbopenflags) - d3 = db.DB(self.env) - d3.open(self.filename, "third", flags = self.dbopenflags) - - c1 = d1.cursor() - c2 = d2.cursor() - c3 = d3.cursor() - - count = 0 - rec = c1.first() - while rec is not None: - count = count + 1 - if verbose and (count % 50) == 0: - print rec - rec = c1.next() - assert count == self._numKeys - - count = 0 - rec = c2.first() - while rec is not None: - count = count + 1 - if verbose: - print rec - rec = c2.next() - assert count == 9 - - count = 0 - rec = c3.first() - while rec is not None: - count = count + 1 - if verbose: - print rec - rec = c3.next() - assert count == 52 - - - c1.close() - c2.close() - c3.close() - - d2.close() - d3.close() - - - -# Strange things happen if you try to use Multiple DBs per file without a -# DBEnv with MPOOL and LOCKing... - -class BTreeMultiDBTestCase(BasicMultiDBTestCase): - dbtype = db.DB_BTREE - dbopenflags = db.DB_THREAD - useEnv = 1 - envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK - -class HashMultiDBTestCase(BasicMultiDBTestCase): - dbtype = db.DB_HASH - dbopenflags = db.DB_THREAD - useEnv = 1 - envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK - - -#---------------------------------------------------------------------- -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(VersionTestCase)) - suite.addTest(unittest.makeSuite(BasicBTreeTestCase)) - suite.addTest(unittest.makeSuite(BasicHashTestCase)) - suite.addTest(unittest.makeSuite(BasicBTreeWithThreadFlagTestCase)) - suite.addTest(unittest.makeSuite(BasicHashWithThreadFlagTestCase)) - suite.addTest(unittest.makeSuite(BasicBTreeWithEnvTestCase)) - suite.addTest(unittest.makeSuite(BasicHashWithEnvTestCase)) - suite.addTest(unittest.makeSuite(BTreeTransactionTestCase)) - suite.addTest(unittest.makeSuite(HashTransactionTestCase)) - suite.addTest(unittest.makeSuite(BTreeRecnoTestCase)) - suite.addTest(unittest.makeSuite(BTreeRecnoWithThreadFlagTestCase)) - suite.addTest(unittest.makeSuite(BTreeDUPTestCase)) - suite.addTest(unittest.makeSuite(HashDUPTestCase)) - suite.addTest(unittest.makeSuite(BTreeDUPWithThreadTestCase)) - suite.addTest(unittest.makeSuite(HashDUPWithThreadTestCase)) - suite.addTest(unittest.makeSuite(BTreeMultiDBTestCase)) - suite.addTest(unittest.makeSuite(HashMultiDBTestCase)) - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_compare.py b/sys/lib/python/bsddb/test/test_compare.py deleted file mode 100644 index 59a45ec50..000000000 --- a/sys/lib/python/bsddb/test/test_compare.py +++ /dev/null @@ -1,249 +0,0 @@ -""" -TestCases for python DB Btree key comparison function. -""" - -import sys, os, re -import test_all -from cStringIO import StringIO - -import unittest -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbshelve -except ImportError: - # For Python 2.3 - from bsddb import db, dbshelve - -lexical_cmp = cmp - -def lowercase_cmp(left, right): - return cmp (left.lower(), right.lower()) - -def make_reverse_comparator (cmp): - def reverse (left, right, delegate=cmp): - return - delegate (left, right) - return reverse - -_expected_lexical_test_data = ['', 'CCCP', 'a', 'aaa', 'b', 'c', 'cccce', 'ccccf'] -_expected_lowercase_test_data = ['', 'a', 'aaa', 'b', 'c', 'CC', 'cccce', 'ccccf', 'CCCP'] - -class ComparatorTests (unittest.TestCase): - def comparator_test_helper (self, comparator, expected_data): - data = expected_data[:] - data.sort (comparator) - self.failUnless (data == expected_data, - "comparator `%s' is not right: %s vs. %s" - % (comparator, expected_data, data)) - def test_lexical_comparator (self): - self.comparator_test_helper (lexical_cmp, _expected_lexical_test_data) - def test_reverse_lexical_comparator (self): - rev = _expected_lexical_test_data[:] - rev.reverse () - self.comparator_test_helper (make_reverse_comparator (lexical_cmp), - rev) - def test_lowercase_comparator (self): - self.comparator_test_helper (lowercase_cmp, - _expected_lowercase_test_data) - -class AbstractBtreeKeyCompareTestCase (unittest.TestCase): - env = None - db = None - - def setUp (self): - self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join (os.path.dirname (sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - os.mkdir (homeDir) - except os.error: - pass - - env = db.DBEnv () - env.open (homeDir, - db.DB_CREATE | db.DB_INIT_MPOOL - | db.DB_INIT_LOCK | db.DB_THREAD) - self.env = env - - def tearDown (self): - self.closeDB () - if self.env is not None: - self.env.close () - self.env = None - import glob - map (os.remove, glob.glob (os.path.join (self.homeDir, '*'))) - - def addDataToDB (self, data): - i = 0 - for item in data: - self.db.put (item, str (i)) - i = i + 1 - - def createDB (self, key_comparator): - self.db = db.DB (self.env) - self.setupDB (key_comparator) - self.db.open (self.filename, "test", db.DB_BTREE, db.DB_CREATE) - - def setupDB (self, key_comparator): - self.db.set_bt_compare (key_comparator) - - def closeDB (self): - if self.db is not None: - self.db.close () - self.db = None - - def startTest (self): - pass - - def finishTest (self, expected = None): - if expected is not None: - self.check_results (expected) - self.closeDB () - - def check_results (self, expected): - curs = self.db.cursor () - try: - index = 0 - rec = curs.first () - while rec: - key, ignore = rec - self.failUnless (index < len (expected), - "to many values returned from cursor") - self.failUnless (expected[index] == key, - "expected value `%s' at %d but got `%s'" - % (expected[index], index, key)) - index = index + 1 - rec = curs.next () - self.failUnless (index == len (expected), - "not enough values returned from cursor") - finally: - curs.close () - -class BtreeKeyCompareTestCase (AbstractBtreeKeyCompareTestCase): - def runCompareTest (self, comparator, data): - self.startTest () - self.createDB (comparator) - self.addDataToDB (data) - self.finishTest (data) - - def test_lexical_ordering (self): - self.runCompareTest (lexical_cmp, _expected_lexical_test_data) - - def test_reverse_lexical_ordering (self): - expected_rev_data = _expected_lexical_test_data[:] - expected_rev_data.reverse () - self.runCompareTest (make_reverse_comparator (lexical_cmp), - expected_rev_data) - - def test_compare_function_useless (self): - self.startTest () - def socialist_comparator (l, r): - return 0 - self.createDB (socialist_comparator) - self.addDataToDB (['b', 'a', 'd']) - # all things being equal the first key will be the only key - # in the database... (with the last key's value fwiw) - self.finishTest (['b']) - - -class BtreeExceptionsTestCase (AbstractBtreeKeyCompareTestCase): - def test_raises_non_callable (self): - self.startTest () - self.assertRaises (TypeError, self.createDB, 'abc') - self.assertRaises (TypeError, self.createDB, None) - self.finishTest () - - def test_set_bt_compare_with_function (self): - self.startTest () - self.createDB (lexical_cmp) - self.finishTest () - - def check_results (self, results): - pass - - def test_compare_function_incorrect (self): - self.startTest () - def bad_comparator (l, r): - return 1 - # verify that set_bt_compare checks that comparator('', '') == 0 - self.assertRaises (TypeError, self.createDB, bad_comparator) - self.finishTest () - - def verifyStderr(self, method, successRe): - """ - Call method() while capturing sys.stderr output internally and - call self.fail() if successRe.search() does not match the stderr - output. This is used to test for uncatchable exceptions. - """ - stdErr = sys.stderr - sys.stderr = StringIO() - try: - method() - finally: - temp = sys.stderr - sys.stderr = stdErr - errorOut = temp.getvalue() - if not successRe.search(errorOut): - self.fail("unexpected stderr output:\n"+errorOut) - - def _test_compare_function_exception (self): - self.startTest () - def bad_comparator (l, r): - if l == r: - # pass the set_bt_compare test - return 0 - raise RuntimeError, "i'm a naughty comparison function" - self.createDB (bad_comparator) - #print "\n*** test should print 2 uncatchable tracebacks ***" - self.addDataToDB (['a', 'b', 'c']) # this should raise, but... - self.finishTest () - - def test_compare_function_exception(self): - self.verifyStderr( - self._test_compare_function_exception, - re.compile('(^RuntimeError:.* naughty.*){2}', re.M|re.S) - ) - - def _test_compare_function_bad_return (self): - self.startTest () - def bad_comparator (l, r): - if l == r: - # pass the set_bt_compare test - return 0 - return l - self.createDB (bad_comparator) - #print "\n*** test should print 2 errors about returning an int ***" - self.addDataToDB (['a', 'b', 'c']) # this should raise, but... - self.finishTest () - - def test_compare_function_bad_return(self): - self.verifyStderr( - self._test_compare_function_bad_return, - re.compile('(^TypeError:.* return an int.*){2}', re.M|re.S) - ) - - - def test_cannot_assign_twice (self): - - def my_compare (a, b): - return 0 - - self.startTest () - self.createDB (my_compare) - try: - self.db.set_bt_compare (my_compare) - assert False, "this set should fail" - - except RuntimeError, msg: - pass - -def test_suite (): - res = unittest.TestSuite () - - res.addTest (unittest.makeSuite (ComparatorTests)) - if db.version () >= (3, 3, 11): - res.addTest (unittest.makeSuite (BtreeExceptionsTestCase)) - res.addTest (unittest.makeSuite (BtreeKeyCompareTestCase)) - return res - -if __name__ == '__main__': - unittest.main (defaultTest = 'suite') diff --git a/sys/lib/python/bsddb/test/test_compat.py b/sys/lib/python/bsddb/test/test_compat.py deleted file mode 100644 index b108db4c6..000000000 --- a/sys/lib/python/bsddb/test/test_compat.py +++ /dev/null @@ -1,191 +0,0 @@ -""" -Test cases adapted from the test_bsddb.py module in Python's -regression test suite. -""" - -import sys, os, string -import unittest -import tempfile - -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, hashopen, btopen, rnopen -except ImportError: - # For Python 2.3 - from bsddb import db, hashopen, btopen, rnopen - - -class CompatibilityTestCase(unittest.TestCase): - def setUp(self): - self.filename = tempfile.mktemp() - - def tearDown(self): - try: - os.remove(self.filename) - except os.error: - pass - - - def test01_btopen(self): - self.do_bthash_test(btopen, 'btopen') - - def test02_hashopen(self): - self.do_bthash_test(hashopen, 'hashopen') - - def test03_rnopen(self): - data = string.split("The quick brown fox jumped over the lazy dog.") - if verbose: - print "\nTesting: rnopen" - - f = rnopen(self.filename, 'c') - for x in range(len(data)): - f[x+1] = data[x] - - getTest = (f[1], f[2], f[3]) - if verbose: - print '%s %s %s' % getTest - - assert getTest[1] == 'quick', 'data mismatch!' - - rv = f.set_location(3) - if rv != (3, 'brown'): - self.fail('recno database set_location failed: '+repr(rv)) - - f[25] = 'twenty-five' - f.close() - del f - - f = rnopen(self.filename, 'w') - f[20] = 'twenty' - - def noRec(f): - rec = f[15] - self.assertRaises(KeyError, noRec, f) - - def badKey(f): - rec = f['a string'] - self.assertRaises(TypeError, badKey, f) - - del f[3] - - rec = f.first() - while rec: - if verbose: - print rec - try: - rec = f.next() - except KeyError: - break - - f.close() - - - def test04_n_flag(self): - f = hashopen(self.filename, 'n') - f.close() - - - def do_bthash_test(self, factory, what): - if verbose: - print '\nTesting: ', what - - f = factory(self.filename, 'c') - if verbose: - print 'creation...' - - # truth test - if f: - if verbose: print "truth test: true" - else: - if verbose: print "truth test: false" - - f['0'] = '' - f['a'] = 'Guido' - f['b'] = 'van' - f['c'] = 'Rossum' - f['d'] = 'invented' - # 'e' intentionally left out - f['f'] = 'Python' - if verbose: - print '%s %s %s' % (f['a'], f['b'], f['c']) - - if verbose: - print 'key ordering...' - start = f.set_location(f.first()[0]) - if start != ('0', ''): - self.fail("incorrect first() result: "+repr(start)) - while 1: - try: - rec = f.next() - except KeyError: - assert rec == f.last(), 'Error, last <> last!' - f.previous() - break - if verbose: - print rec - - assert f.has_key('f'), 'Error, missing key!' - - # test that set_location() returns the next nearest key, value - # on btree databases and raises KeyError on others. - if factory == btopen: - e = f.set_location('e') - if e != ('f', 'Python'): - self.fail('wrong key,value returned: '+repr(e)) - else: - try: - e = f.set_location('e') - except KeyError: - pass - else: - self.fail("set_location on non-existant key did not raise KeyError") - - f.sync() - f.close() - # truth test - try: - if f: - if verbose: print "truth test: true" - else: - if verbose: print "truth test: false" - except db.DBError: - pass - else: - self.fail("Exception expected") - - del f - - if verbose: - print 'modification...' - f = factory(self.filename, 'w') - f['d'] = 'discovered' - - if verbose: - print 'access...' - for key in f.keys(): - word = f[key] - if verbose: - print word - - def noRec(f): - rec = f['no such key'] - self.assertRaises(KeyError, noRec, f) - - def badKey(f): - rec = f[15] - self.assertRaises(TypeError, badKey, f) - - f.close() - - -#---------------------------------------------------------------------- - - -def test_suite(): - return unittest.makeSuite(CompatibilityTestCase) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_cursor_pget_bug.py b/sys/lib/python/bsddb/test/test_cursor_pget_bug.py deleted file mode 100644 index de47e6d04..000000000 --- a/sys/lib/python/bsddb/test/test_cursor_pget_bug.py +++ /dev/null @@ -1,65 +0,0 @@ -import unittest -import sys, os, glob - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - - -#---------------------------------------------------------------------- - -class pget_bugTestCase(unittest.TestCase): - """Verify that cursor.pget works properly""" - db_name = 'test-cursor_pget.db' - - def setUp(self): - self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - try: - os.mkdir(self.homeDir) - except os.error: - pass - self.env = db.DBEnv() - self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) - self.primary_db = db.DB(self.env) - self.primary_db.open(self.db_name, 'primary', db.DB_BTREE, db.DB_CREATE) - self.secondary_db = db.DB(self.env) - self.secondary_db.set_flags(db.DB_DUP) - self.secondary_db.open(self.db_name, 'secondary', db.DB_BTREE, db.DB_CREATE) - self.primary_db.associate(self.secondary_db, lambda key, data: data) - self.primary_db.put('salad', 'eggs') - self.primary_db.put('spam', 'ham') - self.primary_db.put('omelet', 'eggs') - - - def tearDown(self): - self.secondary_db.close() - self.primary_db.close() - self.env.close() - del self.secondary_db - del self.primary_db - del self.env - for file in glob.glob(os.path.join(self.homeDir, '*')): - os.remove(file) - os.removedirs(self.homeDir) - - def test_pget(self): - cursor = self.secondary_db.cursor() - - self.assertEquals(('eggs', 'salad', 'eggs'), cursor.pget(key='eggs', flags=db.DB_SET)) - self.assertEquals(('eggs', 'omelet', 'eggs'), cursor.pget(db.DB_NEXT_DUP)) - self.assertEquals(None, cursor.pget(db.DB_NEXT_DUP)) - - self.assertEquals(('ham', 'spam', 'ham'), cursor.pget('ham', 'spam', flags=db.DB_SET)) - self.assertEquals(None, cursor.pget(db.DB_NEXT_DUP)) - - cursor.close() - - -def test_suite(): - return unittest.makeSuite(pget_bugTestCase) - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_dbobj.py b/sys/lib/python/bsddb/test/test_dbobj.py deleted file mode 100644 index 1ef382e0f..000000000 --- a/sys/lib/python/bsddb/test/test_dbobj.py +++ /dev/null @@ -1,82 +0,0 @@ - -import sys, os, string -import unittest -import glob - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbobj -except ImportError: - # For Python 2.3 - from bsddb import db, dbobj - - -#---------------------------------------------------------------------- - -class dbobjTestCase(unittest.TestCase): - """Verify that dbobj.DB and dbobj.DBEnv work properly""" - db_home = 'db_home' - db_name = 'test-dbobj.db' - - def setUp(self): - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: os.mkdir(homeDir) - except os.error: pass - - def tearDown(self): - if hasattr(self, 'db'): - del self.db - if hasattr(self, 'env'): - del self.env - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def test01_both(self): - class TestDBEnv(dbobj.DBEnv): pass - class TestDB(dbobj.DB): - def put(self, key, *args, **kwargs): - key = string.upper(key) - # call our parent classes put method with an upper case key - return apply(dbobj.DB.put, (self, key) + args, kwargs) - self.env = TestDBEnv() - self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) - self.db = TestDB(self.env) - self.db.open(self.db_name, db.DB_HASH, db.DB_CREATE) - self.db.put('spam', 'eggs') - assert self.db.get('spam') == None, \ - "overridden dbobj.DB.put() method failed [1]" - assert self.db.get('SPAM') == 'eggs', \ - "overridden dbobj.DB.put() method failed [2]" - self.db.close() - self.env.close() - - def test02_dbobj_dict_interface(self): - self.env = dbobj.DBEnv() - self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) - self.db = dbobj.DB(self.env) - self.db.open(self.db_name+'02', db.DB_HASH, db.DB_CREATE) - # __setitem__ - self.db['spam'] = 'eggs' - # __len__ - assert len(self.db) == 1 - # __getitem__ - assert self.db['spam'] == 'eggs' - # __del__ - del self.db['spam'] - assert self.db.get('spam') == None, "dbobj __del__ failed" - self.db.close() - self.env.close() - - def test03_dbobj_type_before_open(self): - # Ensure this doesn't cause a segfault. - self.assertRaises(db.DBInvalidArgError, db.DB().type) - -#---------------------------------------------------------------------- - -def test_suite(): - return unittest.makeSuite(dbobjTestCase) - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_dbshelve.py b/sys/lib/python/bsddb/test/test_dbshelve.py deleted file mode 100644 index 722ee5b40..000000000 --- a/sys/lib/python/bsddb/test/test_dbshelve.py +++ /dev/null @@ -1,306 +0,0 @@ -""" -TestCases for checking dbShelve objects. -""" - -import sys, os, string -import tempfile, random -from pprint import pprint -from types import * -import unittest - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbshelve -except ImportError: - # For Python 2.3 - from bsddb import db, dbshelve - -from test_all import verbose - - -#---------------------------------------------------------------------- - -# We want the objects to be comparable so we can test dbshelve.values -# later on. -class DataClass: - def __init__(self): - self.value = random.random() - - def __cmp__(self, other): - return cmp(self.value, other) - -class DBShelveTestCase(unittest.TestCase): - def setUp(self): - self.filename = tempfile.mktemp() - self.do_open() - - def tearDown(self): - self.do_close() - try: - os.remove(self.filename) - except os.error: - pass - - def populateDB(self, d): - for x in string.letters: - d['S' + x] = 10 * x # add a string - d['I' + x] = ord(x) # add an integer - d['L' + x] = [x] * 10 # add a list - - inst = DataClass() # add an instance - inst.S = 10 * x - inst.I = ord(x) - inst.L = [x] * 10 - d['O' + x] = inst - - - # overridable in derived classes to affect how the shelf is created/opened - def do_open(self): - self.d = dbshelve.open(self.filename) - - # and closed... - def do_close(self): - self.d.close() - - - - def test01_basics(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_basics..." % self.__class__.__name__ - - self.populateDB(self.d) - self.d.sync() - self.do_close() - self.do_open() - d = self.d - - l = len(d) - k = d.keys() - s = d.stat() - f = d.fd() - - if verbose: - print "length:", l - print "keys:", k - print "stats:", s - - assert 0 == d.has_key('bad key') - assert 1 == d.has_key('IA') - assert 1 == d.has_key('OA') - - d.delete('IA') - del d['OA'] - assert 0 == d.has_key('IA') - assert 0 == d.has_key('OA') - assert len(d) == l-2 - - values = [] - for key in d.keys(): - value = d[key] - values.append(value) - if verbose: - print "%s: %s" % (key, value) - self.checkrec(key, value) - - dbvalues = d.values() - assert len(dbvalues) == len(d.keys()) - values.sort() - dbvalues.sort() - assert values == dbvalues - - items = d.items() - assert len(items) == len(values) - - for key, value in items: - self.checkrec(key, value) - - assert d.get('bad key') == None - assert d.get('bad key', None) == None - assert d.get('bad key', 'a string') == 'a string' - assert d.get('bad key', [1, 2, 3]) == [1, 2, 3] - - d.set_get_returns_none(0) - self.assertRaises(db.DBNotFoundError, d.get, 'bad key') - d.set_get_returns_none(1) - - d.put('new key', 'new data') - assert d.get('new key') == 'new data' - assert d['new key'] == 'new data' - - - - def test02_cursors(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_cursors..." % self.__class__.__name__ - - self.populateDB(self.d) - d = self.d - - count = 0 - c = d.cursor() - rec = c.first() - while rec is not None: - count = count + 1 - if verbose: - print rec - key, value = rec - self.checkrec(key, value) - rec = c.next() - del c - - assert count == len(d) - - count = 0 - c = d.cursor() - rec = c.last() - while rec is not None: - count = count + 1 - if verbose: - print rec - key, value = rec - self.checkrec(key, value) - rec = c.prev() - - assert count == len(d) - - c.set('SS') - key, value = c.current() - self.checkrec(key, value) - del c - - - - def checkrec(self, key, value): - x = key[1] - if key[0] == 'S': - assert type(value) == StringType - assert value == 10 * x - - elif key[0] == 'I': - assert type(value) == IntType - assert value == ord(x) - - elif key[0] == 'L': - assert type(value) == ListType - assert value == [x] * 10 - - elif key[0] == 'O': - assert type(value) == InstanceType - assert value.S == 10 * x - assert value.I == ord(x) - assert value.L == [x] * 10 - - else: - raise AssertionError, 'Unknown key type, fix the test' - -#---------------------------------------------------------------------- - -class BasicShelveTestCase(DBShelveTestCase): - def do_open(self): - self.d = dbshelve.DBShelf() - self.d.open(self.filename, self.dbtype, self.dbflags) - - def do_close(self): - self.d.close() - - -class BTreeShelveTestCase(BasicShelveTestCase): - dbtype = db.DB_BTREE - dbflags = db.DB_CREATE - - -class HashShelveTestCase(BasicShelveTestCase): - dbtype = db.DB_HASH - dbflags = db.DB_CREATE - - -class ThreadBTreeShelveTestCase(BasicShelveTestCase): - dbtype = db.DB_BTREE - dbflags = db.DB_CREATE | db.DB_THREAD - - -class ThreadHashShelveTestCase(BasicShelveTestCase): - dbtype = db.DB_HASH - dbflags = db.DB_CREATE | db.DB_THREAD - - -#---------------------------------------------------------------------- - -class BasicEnvShelveTestCase(DBShelveTestCase): - def do_open(self): - self.homeDir = homeDir = os.path.join( - os.path.dirname(sys.argv[0]), 'db_home') - try: os.mkdir(homeDir) - except os.error: pass - self.env = db.DBEnv() - self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) - - self.filename = os.path.split(self.filename)[1] - self.d = dbshelve.DBShelf(self.env) - self.d.open(self.filename, self.dbtype, self.dbflags) - - - def do_close(self): - self.d.close() - self.env.close() - - - def tearDown(self): - self.do_close() - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - - -class EnvBTreeShelveTestCase(BasicEnvShelveTestCase): - envflags = 0 - dbtype = db.DB_BTREE - dbflags = db.DB_CREATE - - -class EnvHashShelveTestCase(BasicEnvShelveTestCase): - envflags = 0 - dbtype = db.DB_HASH - dbflags = db.DB_CREATE - - -class EnvThreadBTreeShelveTestCase(BasicEnvShelveTestCase): - envflags = db.DB_THREAD - dbtype = db.DB_BTREE - dbflags = db.DB_CREATE | db.DB_THREAD - - -class EnvThreadHashShelveTestCase(BasicEnvShelveTestCase): - envflags = db.DB_THREAD - dbtype = db.DB_HASH - dbflags = db.DB_CREATE | db.DB_THREAD - - -#---------------------------------------------------------------------- -# TODO: Add test cases for a DBShelf in a RECNO DB. - - -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(DBShelveTestCase)) - suite.addTest(unittest.makeSuite(BTreeShelveTestCase)) - suite.addTest(unittest.makeSuite(HashShelveTestCase)) - suite.addTest(unittest.makeSuite(ThreadBTreeShelveTestCase)) - suite.addTest(unittest.makeSuite(ThreadHashShelveTestCase)) - suite.addTest(unittest.makeSuite(EnvBTreeShelveTestCase)) - suite.addTest(unittest.makeSuite(EnvHashShelveTestCase)) - suite.addTest(unittest.makeSuite(EnvThreadBTreeShelveTestCase)) - suite.addTest(unittest.makeSuite(EnvThreadHashShelveTestCase)) - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_dbtables.py b/sys/lib/python/bsddb/test/test_dbtables.py deleted file mode 100644 index f6724829a..000000000 --- a/sys/lib/python/bsddb/test/test_dbtables.py +++ /dev/null @@ -1,383 +0,0 @@ -#!/usr/bin/env python -# -#----------------------------------------------------------------------- -# A test suite for the table interface built on bsddb.db -#----------------------------------------------------------------------- -# -# Copyright (C) 2000, 2001 by Autonomous Zone Industries -# Copyright (C) 2002 Gregory P. Smith -# -# March 20, 2000 -# -# License: This is free software. You may use this software for any -# purpose including modification/redistribution, so long as -# this header remains intact and that you do not claim any -# rights of ownership or authorship of this software. This -# software has been tested, but no warranty is expressed or -# implied. -# -# -- Gregory P. Smith <greg@electricrain.com> -# -# $Id: test_dbtables.py 46737 2006-06-08 05:38:11Z gregory.p.smith $ - -import sys, os, re -try: - import cPickle - pickle = cPickle -except ImportError: - import pickle - -import unittest -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbtables -except ImportError: - # For Python 2.3 - from bsddb import db, dbtables - - - -#---------------------------------------------------------------------- - -class TableDBTestCase(unittest.TestCase): - db_home = 'db_home' - db_name = 'test-table.db' - - def setUp(self): - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: os.mkdir(homeDir) - except os.error: pass - self.tdb = dbtables.bsdTableDB( - filename='tabletest.db', dbhome=homeDir, create=1) - - def tearDown(self): - self.tdb.close() - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def test01(self): - tabname = "test01" - colname = 'cool numbers' - try: - self.tdb.Drop(tabname) - except dbtables.TableDBError: - pass - self.tdb.CreateTable(tabname, [colname]) - self.tdb.Insert(tabname, {colname: pickle.dumps(3.14159, 1)}) - - if verbose: - self.tdb._db_print() - - values = self.tdb.Select( - tabname, [colname], conditions={colname: None}) - - colval = pickle.loads(values[0][colname]) - assert(colval > 3.141 and colval < 3.142) - - - def test02(self): - tabname = "test02" - col0 = 'coolness factor' - col1 = 'but can it fly?' - col2 = 'Species' - testinfo = [ - {col0: pickle.dumps(8, 1), col1: 'no', col2: 'Penguin'}, - {col0: pickle.dumps(-1, 1), col1: 'no', col2: 'Turkey'}, - {col0: pickle.dumps(9, 1), col1: 'yes', col2: 'SR-71A Blackbird'} - ] - - try: - self.tdb.Drop(tabname) - except dbtables.TableDBError: - pass - self.tdb.CreateTable(tabname, [col0, col1, col2]) - for row in testinfo : - self.tdb.Insert(tabname, row) - - values = self.tdb.Select(tabname, [col2], - conditions={col0: lambda x: pickle.loads(x) >= 8}) - - assert len(values) == 2 - if values[0]['Species'] == 'Penguin' : - assert values[1]['Species'] == 'SR-71A Blackbird' - elif values[0]['Species'] == 'SR-71A Blackbird' : - assert values[1]['Species'] == 'Penguin' - else : - if verbose: - print "values= %r" % (values,) - raise "Wrong values returned!" - - def test03(self): - tabname = "test03" - try: - self.tdb.Drop(tabname) - except dbtables.TableDBError: - pass - if verbose: - print '...before CreateTable...' - self.tdb._db_print() - self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) - if verbose: - print '...after CreateTable...' - self.tdb._db_print() - self.tdb.Drop(tabname) - if verbose: - print '...after Drop...' - self.tdb._db_print() - self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) - - try: - self.tdb.Insert(tabname, - {'a': "", - 'e': pickle.dumps([{4:5, 6:7}, 'foo'], 1), - 'f': "Zero"}) - assert 0 - except dbtables.TableDBError: - pass - - try: - self.tdb.Select(tabname, [], conditions={'foo': '123'}) - assert 0 - except dbtables.TableDBError: - pass - - self.tdb.Insert(tabname, - {'a': '42', - 'b': "bad", - 'c': "meep", - 'e': 'Fuzzy wuzzy was a bear'}) - self.tdb.Insert(tabname, - {'a': '581750', - 'b': "good", - 'd': "bla", - 'c': "black", - 'e': 'fuzzy was here'}) - self.tdb.Insert(tabname, - {'a': '800000', - 'b': "good", - 'd': "bla", - 'c': "black", - 'e': 'Fuzzy wuzzy is a bear'}) - - if verbose: - self.tdb._db_print() - - # this should return two rows - values = self.tdb.Select(tabname, ['b', 'a', 'd'], - conditions={'e': re.compile('wuzzy').search, - 'a': re.compile('^[0-9]+$').match}) - assert len(values) == 2 - - # now lets delete one of them and try again - self.tdb.Delete(tabname, conditions={'b': dbtables.ExactCond('good')}) - values = self.tdb.Select( - tabname, ['a', 'd', 'b'], - conditions={'e': dbtables.PrefixCond('Fuzzy')}) - assert len(values) == 1 - assert values[0]['d'] == None - - values = self.tdb.Select(tabname, ['b'], - conditions={'c': lambda c: c == 'meep'}) - assert len(values) == 1 - assert values[0]['b'] == "bad" - - - def test04_MultiCondSelect(self): - tabname = "test04_MultiCondSelect" - try: - self.tdb.Drop(tabname) - except dbtables.TableDBError: - pass - self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) - - try: - self.tdb.Insert(tabname, - {'a': "", - 'e': pickle.dumps([{4:5, 6:7}, 'foo'], 1), - 'f': "Zero"}) - assert 0 - except dbtables.TableDBError: - pass - - self.tdb.Insert(tabname, {'a': "A", 'b': "B", 'c': "C", 'd': "D", - 'e': "E"}) - self.tdb.Insert(tabname, {'a': "-A", 'b': "-B", 'c': "-C", 'd': "-D", - 'e': "-E"}) - self.tdb.Insert(tabname, {'a': "A-", 'b': "B-", 'c': "C-", 'd': "D-", - 'e': "E-"}) - - if verbose: - self.tdb._db_print() - - # This select should return 0 rows. it is designed to test - # the bug identified and fixed in sourceforge bug # 590449 - # (Big Thanks to "Rob Tillotson (n9mtb)" for tracking this down - # and supplying a fix!! This one caused many headaches to say - # the least...) - values = self.tdb.Select(tabname, ['b', 'a', 'd'], - conditions={'e': dbtables.ExactCond('E'), - 'a': dbtables.ExactCond('A'), - 'd': dbtables.PrefixCond('-') - } ) - assert len(values) == 0, values - - - def test_CreateOrExtend(self): - tabname = "test_CreateOrExtend" - - self.tdb.CreateOrExtendTable( - tabname, ['name', 'taste', 'filling', 'alcohol content', 'price']) - try: - self.tdb.Insert(tabname, - {'taste': 'crap', - 'filling': 'no', - 'is it Guinness?': 'no'}) - assert 0, "Insert should've failed due to bad column name" - except: - pass - self.tdb.CreateOrExtendTable(tabname, - ['name', 'taste', 'is it Guinness?']) - - # these should both succeed as the table should contain the union of both sets of columns. - self.tdb.Insert(tabname, {'taste': 'crap', 'filling': 'no', - 'is it Guinness?': 'no'}) - self.tdb.Insert(tabname, {'taste': 'great', 'filling': 'yes', - 'is it Guinness?': 'yes', - 'name': 'Guinness'}) - - - def test_CondObjs(self): - tabname = "test_CondObjs" - - self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e', 'p']) - - self.tdb.Insert(tabname, {'a': "the letter A", - 'b': "the letter B", - 'c': "is for cookie"}) - self.tdb.Insert(tabname, {'a': "is for aardvark", - 'e': "the letter E", - 'c': "is for cookie", - 'd': "is for dog"}) - self.tdb.Insert(tabname, {'a': "the letter A", - 'e': "the letter E", - 'c': "is for cookie", - 'p': "is for Python"}) - - values = self.tdb.Select( - tabname, ['p', 'e'], - conditions={'e': dbtables.PrefixCond('the l')}) - assert len(values) == 2, values - assert values[0]['e'] == values[1]['e'], values - assert values[0]['p'] != values[1]['p'], values - - values = self.tdb.Select( - tabname, ['d', 'a'], - conditions={'a': dbtables.LikeCond('%aardvark%')}) - assert len(values) == 1, values - assert values[0]['d'] == "is for dog", values - assert values[0]['a'] == "is for aardvark", values - - values = self.tdb.Select(tabname, None, - {'b': dbtables.Cond(), - 'e':dbtables.LikeCond('%letter%'), - 'a':dbtables.PrefixCond('is'), - 'd':dbtables.ExactCond('is for dog'), - 'c':dbtables.PrefixCond('is for'), - 'p':lambda s: not s}) - assert len(values) == 1, values - assert values[0]['d'] == "is for dog", values - assert values[0]['a'] == "is for aardvark", values - - def test_Delete(self): - tabname = "test_Delete" - self.tdb.CreateTable(tabname, ['x', 'y', 'z']) - - # prior to 2001-05-09 there was a bug where Delete() would - # fail if it encountered any rows that did not have values in - # every column. - # Hunted and Squashed by <Donwulff> (Jukka Santala - donwulff@nic.fi) - self.tdb.Insert(tabname, {'x': 'X1', 'y':'Y1'}) - self.tdb.Insert(tabname, {'x': 'X2', 'y':'Y2', 'z': 'Z2'}) - - self.tdb.Delete(tabname, conditions={'x': dbtables.PrefixCond('X')}) - values = self.tdb.Select(tabname, ['y'], - conditions={'x': dbtables.PrefixCond('X')}) - assert len(values) == 0 - - def test_Modify(self): - tabname = "test_Modify" - self.tdb.CreateTable(tabname, ['Name', 'Type', 'Access']) - - self.tdb.Insert(tabname, {'Name': 'Index to MP3 files.doc', - 'Type': 'Word', 'Access': '8'}) - self.tdb.Insert(tabname, {'Name': 'Nifty.MP3', 'Access': '1'}) - self.tdb.Insert(tabname, {'Type': 'Unknown', 'Access': '0'}) - - def set_type(type): - if type == None: - return 'MP3' - return type - - def increment_access(count): - return str(int(count)+1) - - def remove_value(value): - return None - - self.tdb.Modify(tabname, - conditions={'Access': dbtables.ExactCond('0')}, - mappings={'Access': remove_value}) - self.tdb.Modify(tabname, - conditions={'Name': dbtables.LikeCond('%MP3%')}, - mappings={'Type': set_type}) - self.tdb.Modify(tabname, - conditions={'Name': dbtables.LikeCond('%')}, - mappings={'Access': increment_access}) - - try: - self.tdb.Modify(tabname, - conditions={'Name': dbtables.LikeCond('%')}, - mappings={'Access': 'What is your quest?'}) - except TypeError: - # success, the string value in mappings isn't callable - pass - else: - raise RuntimeError, "why was TypeError not raised for bad callable?" - - # Delete key in select conditions - values = self.tdb.Select( - tabname, None, - conditions={'Type': dbtables.ExactCond('Unknown')}) - assert len(values) == 1, values - assert values[0]['Name'] == None, values - assert values[0]['Access'] == None, values - - # Modify value by select conditions - values = self.tdb.Select( - tabname, None, - conditions={'Name': dbtables.ExactCond('Nifty.MP3')}) - assert len(values) == 1, values - assert values[0]['Type'] == "MP3", values - assert values[0]['Access'] == "2", values - - # Make sure change applied only to select conditions - values = self.tdb.Select( - tabname, None, conditions={'Name': dbtables.LikeCond('%doc%')}) - assert len(values) == 1, values - assert values[0]['Type'] == "Word", values - assert values[0]['Access'] == "9", values - - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TableDBTestCase)) - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_env_close.py b/sys/lib/python/bsddb/test/test_env_close.py deleted file mode 100644 index c1129417d..000000000 --- a/sys/lib/python/bsddb/test/test_env_close.py +++ /dev/null @@ -1,107 +0,0 @@ -"""TestCases for checking that it does not segfault when a DBEnv object -is closed before its DB objects. -""" - -import os -import sys -import tempfile -import glob -import unittest - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -from test_all import verbose - -# We're going to get warnings in this module about trying to close the db when -# its env is already closed. Let's just ignore those. -try: - import warnings -except ImportError: - pass -else: - warnings.filterwarnings('ignore', - message='DB could not be closed in', - category=RuntimeWarning) - - -#---------------------------------------------------------------------- - -class DBEnvClosedEarlyCrash(unittest.TestCase): - def setUp(self): - self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - try: os.mkdir(self.homeDir) - except os.error: pass - tempfile.tempdir = self.homeDir - self.filename = os.path.split(tempfile.mktemp())[1] - tempfile.tempdir = None - - def tearDown(self): - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - - def test01_close_dbenv_before_db(self): - dbenv = db.DBEnv() - dbenv.open(self.homeDir, - db.DB_INIT_CDB| db.DB_CREATE |db.DB_THREAD|db.DB_INIT_MPOOL, - 0666) - - d = db.DB(dbenv) - d.open(self.filename, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) - - try: - dbenv.close() - except db.DBError: - try: - d.close() - except db.DBError: - return - assert 0, \ - "DB close did not raise an exception about its "\ - "DBEnv being trashed" - - # XXX This may fail when using older versions of BerkeleyDB. - # E.g. 3.2.9 never raised the exception. - assert 0, "dbenv did not raise an exception about its DB being open" - - - def test02_close_dbenv_delete_db_success(self): - dbenv = db.DBEnv() - dbenv.open(self.homeDir, - db.DB_INIT_CDB| db.DB_CREATE |db.DB_THREAD|db.DB_INIT_MPOOL, - 0666) - - d = db.DB(dbenv) - d.open(self.filename, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) - - try: - dbenv.close() - except db.DBError: - pass # good, it should raise an exception - - del d - try: - import gc - except ImportError: - gc = None - if gc: - # force d.__del__ [DB_dealloc] to be called - gc.collect() - - -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(DBEnvClosedEarlyCrash)) - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_get_none.py b/sys/lib/python/bsddb/test/test_get_none.py deleted file mode 100644 index 5f09cecc6..000000000 --- a/sys/lib/python/bsddb/test/test_get_none.py +++ /dev/null @@ -1,101 +0,0 @@ -""" -TestCases for checking set_get_returns_none. -""" - -import sys, os, string -import tempfile -from pprint import pprint -import unittest - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -from test_all import verbose - - -#---------------------------------------------------------------------- - -class GetReturnsNoneTestCase(unittest.TestCase): - def setUp(self): - self.filename = tempfile.mktemp() - - def tearDown(self): - try: - os.remove(self.filename) - except os.error: - pass - - - def test01_get_returns_none(self): - d = db.DB() - d.open(self.filename, db.DB_BTREE, db.DB_CREATE) - d.set_get_returns_none(1) - - for x in string.letters: - d.put(x, x * 40) - - data = d.get('bad key') - assert data == None - - data = d.get('a') - assert data == 'a'*40 - - count = 0 - c = d.cursor() - rec = c.first() - while rec: - count = count + 1 - rec = c.next() - - assert rec == None - assert count == 52 - - c.close() - d.close() - - - def test02_get_raises_exception(self): - d = db.DB() - d.open(self.filename, db.DB_BTREE, db.DB_CREATE) - d.set_get_returns_none(0) - - for x in string.letters: - d.put(x, x * 40) - - self.assertRaises(db.DBNotFoundError, d.get, 'bad key') - self.assertRaises(KeyError, d.get, 'bad key') - - data = d.get('a') - assert data == 'a'*40 - - count = 0 - exceptionHappened = 0 - c = d.cursor() - rec = c.first() - while rec: - count = count + 1 - try: - rec = c.next() - except db.DBNotFoundError: # end of the records - exceptionHappened = 1 - break - - assert rec != None - assert exceptionHappened - assert count == 52 - - c.close() - d.close() - -#---------------------------------------------------------------------- - -def test_suite(): - return unittest.makeSuite(GetReturnsNoneTestCase) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_join.py b/sys/lib/python/bsddb/test/test_join.py deleted file mode 100644 index 73edd114e..000000000 --- a/sys/lib/python/bsddb/test/test_join.py +++ /dev/null @@ -1,120 +0,0 @@ -"""TestCases for using the DB.join and DBCursor.join_item methods. -""" - -import sys, os, string -import tempfile -import time -from pprint import pprint - -try: - from threading import Thread, currentThread - have_threads = 1 -except ImportError: - have_threads = 0 - -import unittest -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbshelve -except ImportError: - # For Python 2.3 - from bsddb import db, dbshelve - - -#---------------------------------------------------------------------- - -ProductIndex = [ - ('apple', "Convenience Store"), - ('blueberry', "Farmer's Market"), - ('shotgun', "S-Mart"), # Aisle 12 - ('pear', "Farmer's Market"), - ('chainsaw', "S-Mart"), # "Shop smart. Shop S-Mart!" - ('strawberry', "Farmer's Market"), -] - -ColorIndex = [ - ('blue', "blueberry"), - ('red', "apple"), - ('red', "chainsaw"), - ('red', "strawberry"), - ('yellow', "peach"), - ('yellow', "pear"), - ('black', "shotgun"), -] - -class JoinTestCase(unittest.TestCase): - keytype = '' - - def setUp(self): - self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: os.mkdir(homeDir) - except os.error: pass - self.env = db.DBEnv() - self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK ) - - def tearDown(self): - self.env.close() - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def test01_join(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_join..." % \ - self.__class__.__name__ - - # create and populate primary index - priDB = db.DB(self.env) - priDB.open(self.filename, "primary", db.DB_BTREE, db.DB_CREATE) - map(lambda t, priDB=priDB: apply(priDB.put, t), ProductIndex) - - # create and populate secondary index - secDB = db.DB(self.env) - secDB.set_flags(db.DB_DUP | db.DB_DUPSORT) - secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE) - map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex) - - sCursor = None - jCursor = None - try: - # lets look up all of the red Products - sCursor = secDB.cursor() - # Don't do the .set() in an assert, or you can get a bogus failure - # when running python -O - tmp = sCursor.set('red') - assert tmp - - # FIXME: jCursor doesn't properly hold a reference to its - # cursors, if they are closed before jcursor is used it - # can cause a crash. - jCursor = priDB.join([sCursor]) - - if jCursor.get(0) != ('apple', "Convenience Store"): - self.fail("join cursor positioned wrong") - if jCursor.join_item() != 'chainsaw': - self.fail("DBCursor.join_item returned wrong item") - if jCursor.get(0)[0] != 'strawberry': - self.fail("join cursor returned wrong thing") - if jCursor.get(0): # there were only three red items to return - self.fail("join cursor returned too many items") - finally: - if jCursor: - jCursor.close() - if sCursor: - sCursor.close() - priDB.close() - secDB.close() - - -def test_suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(JoinTestCase)) - - return suite diff --git a/sys/lib/python/bsddb/test/test_lock.py b/sys/lib/python/bsddb/test/test_lock.py deleted file mode 100644 index 7d7779805..000000000 --- a/sys/lib/python/bsddb/test/test_lock.py +++ /dev/null @@ -1,143 +0,0 @@ -""" -TestCases for testing the locking sub-system. -""" - -import sys, os, string -import tempfile -import time -from pprint import pprint - -try: - from threading import Thread, currentThread - have_threads = 1 -except ImportError: - have_threads = 0 - - -import unittest -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - - -#---------------------------------------------------------------------- - -class LockingTestCase(unittest.TestCase): - - def setUp(self): - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: os.mkdir(homeDir) - except os.error: pass - self.env = db.DBEnv() - self.env.open(homeDir, db.DB_THREAD | db.DB_INIT_MPOOL | - db.DB_INIT_LOCK | db.DB_CREATE) - - - def tearDown(self): - self.env.close() - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - - def test01_simple(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_simple..." % self.__class__.__name__ - - anID = self.env.lock_id() - if verbose: - print "locker ID: %s" % anID - lock = self.env.lock_get(anID, "some locked thing", db.DB_LOCK_WRITE) - if verbose: - print "Aquired lock: %s" % lock - time.sleep(1) - self.env.lock_put(lock) - if verbose: - print "Released lock: %s" % lock - - - - - def test02_threaded(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_threaded..." % self.__class__.__name__ - - threads = [] - threads.append(Thread(target = self.theThread, - args=(5, db.DB_LOCK_WRITE))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_READ))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_READ))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_WRITE))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_READ))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_READ))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_WRITE))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_WRITE))) - threads.append(Thread(target = self.theThread, - args=(1, db.DB_LOCK_WRITE))) - - for t in threads: - t.start() - for t in threads: - t.join() - - def test03_set_timeout(self): - # test that the set_timeout call works - if hasattr(self.env, 'set_timeout'): - self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT) - self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT) - self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT) - self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT) - - def theThread(self, sleepTime, lockType): - name = currentThread().getName() - if lockType == db.DB_LOCK_WRITE: - lt = "write" - else: - lt = "read" - - anID = self.env.lock_id() - if verbose: - print "%s: locker ID: %s" % (name, anID) - - lock = self.env.lock_get(anID, "some locked thing", lockType) - if verbose: - print "%s: Aquired %s lock: %s" % (name, lt, lock) - - time.sleep(sleepTime) - - self.env.lock_put(lock) - if verbose: - print "%s: Released %s lock: %s" % (name, lt, lock) - - -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - - if have_threads: - suite.addTest(unittest.makeSuite(LockingTestCase)) - else: - suite.addTest(unittest.makeSuite(LockingTestCase, 'test01')) - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_misc.py b/sys/lib/python/bsddb/test/test_misc.py deleted file mode 100644 index 88f700b46..000000000 --- a/sys/lib/python/bsddb/test/test_misc.py +++ /dev/null @@ -1,64 +0,0 @@ -"""Miscellaneous bsddb module test cases -""" - -import os -import sys -import unittest - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbshelve, hashopen -except ImportError: - # For Python 2.3 - from bsddb import db, dbshelve, hashopen - -#---------------------------------------------------------------------- - -class MiscTestCase(unittest.TestCase): - def setUp(self): - self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - os.mkdir(homeDir) - except OSError: - pass - - def tearDown(self): - try: - os.remove(self.filename) - except OSError: - pass - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def test01_badpointer(self): - dbs = dbshelve.open(self.filename) - dbs.close() - self.assertRaises(db.DBError, dbs.get, "foo") - - def test02_db_home(self): - env = db.DBEnv() - # check for crash fixed when db_home is used before open() - assert env.db_home is None - env.open(self.homeDir, db.DB_CREATE) - assert self.homeDir == env.db_home - - def test03_repr_closed_db(self): - db = hashopen(self.filename) - db.close() - rp = repr(db) - self.assertEquals(rp, "{}") - - -#---------------------------------------------------------------------- - - -def test_suite(): - return unittest.makeSuite(MiscTestCase) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_pickle.py b/sys/lib/python/bsddb/test/test_pickle.py deleted file mode 100644 index 3916e5cb9..000000000 --- a/sys/lib/python/bsddb/test/test_pickle.py +++ /dev/null @@ -1,75 +0,0 @@ - -import sys, os, string -import pickle -try: - import cPickle -except ImportError: - cPickle = None -import unittest -import glob - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError, e: - # For Python 2.3 - from bsddb import db - - -#---------------------------------------------------------------------- - -class pickleTestCase(unittest.TestCase): - """Verify that DBError can be pickled and unpickled""" - db_home = 'db_home' - db_name = 'test-dbobj.db' - - def setUp(self): - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: os.mkdir(homeDir) - except os.error: pass - - def tearDown(self): - if hasattr(self, 'db'): - del self.db - if hasattr(self, 'env'): - del self.env - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def _base_test_pickle_DBError(self, pickle): - self.env = db.DBEnv() - self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) - self.db = db.DB(self.env) - self.db.open(self.db_name, db.DB_HASH, db.DB_CREATE) - self.db.put('spam', 'eggs') - assert self.db['spam'] == 'eggs' - try: - self.db.put('spam', 'ham', flags=db.DB_NOOVERWRITE) - except db.DBError, egg: - pickledEgg = pickle.dumps(egg) - #print repr(pickledEgg) - rottenEgg = pickle.loads(pickledEgg) - if rottenEgg.args != egg.args or type(rottenEgg) != type(egg): - raise Exception, (rottenEgg, '!=', egg) - else: - raise Exception, "where's my DBError exception?!?" - - self.db.close() - self.env.close() - - def test01_pickle_DBError(self): - self._base_test_pickle_DBError(pickle=pickle) - - if cPickle: - def test02_cPickle_DBError(self): - self._base_test_pickle_DBError(pickle=cPickle) - -#---------------------------------------------------------------------- - -def test_suite(): - return unittest.makeSuite(pickleTestCase) - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_queue.py b/sys/lib/python/bsddb/test/test_queue.py deleted file mode 100644 index 95cf20d0d..000000000 --- a/sys/lib/python/bsddb/test/test_queue.py +++ /dev/null @@ -1,173 +0,0 @@ -""" -TestCases for exercising a Queue DB. -""" - -import sys, os, string -import tempfile -from pprint import pprint -import unittest - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -from test_all import verbose - - -#---------------------------------------------------------------------- - -class SimpleQueueTestCase(unittest.TestCase): - def setUp(self): - self.filename = tempfile.mktemp() - - def tearDown(self): - try: - os.remove(self.filename) - except os.error: - pass - - - def test01_basic(self): - # Basic Queue tests using the deprecated DBCursor.consume method. - - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_basic..." % self.__class__.__name__ - - d = db.DB() - d.set_re_len(40) # Queues must be fixed length - d.open(self.filename, db.DB_QUEUE, db.DB_CREATE) - - if verbose: - print "before appends" + '-' * 30 - pprint(d.stat()) - - for x in string.letters: - d.append(x * 40) - - assert len(d) == 52 - - d.put(100, "some more data") - d.put(101, "and some more ") - d.put(75, "out of order") - d.put(1, "replacement data") - - assert len(d) == 55 - - if verbose: - print "before close" + '-' * 30 - pprint(d.stat()) - - d.close() - del d - d = db.DB() - d.open(self.filename) - - if verbose: - print "after open" + '-' * 30 - pprint(d.stat()) - - d.append("one more") - c = d.cursor() - - if verbose: - print "after append" + '-' * 30 - pprint(d.stat()) - - rec = c.consume() - while rec: - if verbose: - print rec - rec = c.consume() - c.close() - - if verbose: - print "after consume loop" + '-' * 30 - pprint(d.stat()) - - assert len(d) == 0, \ - "if you see this message then you need to rebuild " \ - "BerkeleyDB 3.1.17 with the patch in patches/qam_stat.diff" - - d.close() - - - - def test02_basicPost32(self): - # Basic Queue tests using the new DB.consume method in DB 3.2+ - # (No cursor needed) - - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_basicPost32..." % self.__class__.__name__ - - if db.version() < (3, 2, 0): - if verbose: - print "Test not run, DB not new enough..." - return - - d = db.DB() - d.set_re_len(40) # Queues must be fixed length - d.open(self.filename, db.DB_QUEUE, db.DB_CREATE) - - if verbose: - print "before appends" + '-' * 30 - pprint(d.stat()) - - for x in string.letters: - d.append(x * 40) - - assert len(d) == 52 - - d.put(100, "some more data") - d.put(101, "and some more ") - d.put(75, "out of order") - d.put(1, "replacement data") - - assert len(d) == 55 - - if verbose: - print "before close" + '-' * 30 - pprint(d.stat()) - - d.close() - del d - d = db.DB() - d.open(self.filename) - #d.set_get_returns_none(true) - - if verbose: - print "after open" + '-' * 30 - pprint(d.stat()) - - d.append("one more") - - if verbose: - print "after append" + '-' * 30 - pprint(d.stat()) - - rec = d.consume() - while rec: - if verbose: - print rec - rec = d.consume() - - if verbose: - print "after consume loop" + '-' * 30 - pprint(d.stat()) - - d.close() - - - -#---------------------------------------------------------------------- - -def test_suite(): - return unittest.makeSuite(SimpleQueueTestCase) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_recno.py b/sys/lib/python/bsddb/test/test_recno.py deleted file mode 100644 index f1ea56afd..000000000 --- a/sys/lib/python/bsddb/test/test_recno.py +++ /dev/null @@ -1,295 +0,0 @@ -"""TestCases for exercising a Recno DB. -""" - -import os -import sys -import errno -import tempfile -from pprint import pprint -import unittest - -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - - -#---------------------------------------------------------------------- - -class SimpleRecnoTestCase(unittest.TestCase): - def setUp(self): - self.filename = tempfile.mktemp() - - def tearDown(self): - try: - os.remove(self.filename) - except OSError, e: - if e.errno <> errno.EEXIST: raise - - def test01_basic(self): - d = db.DB() - - get_returns_none = d.set_get_returns_none(2) - d.set_get_returns_none(get_returns_none) - - d.open(self.filename, db.DB_RECNO, db.DB_CREATE) - - for x in letters: - recno = d.append(x * 60) - assert type(recno) == type(0) - assert recno >= 1 - if verbose: - print recno, - - if verbose: print - - stat = d.stat() - if verbose: - pprint(stat) - - for recno in range(1, len(d)+1): - data = d[recno] - if verbose: - print data - - assert type(data) == type("") - assert data == d.get(recno) - - try: - data = d[0] # This should raise a KeyError!?!?! - except db.DBInvalidArgError, val: - assert val[0] == db.EINVAL - if verbose: print val - else: - self.fail("expected exception") - - # test that has_key raises DB exceptions (fixed in pybsddb 4.3.2) - try: - d.has_key(0) - except db.DBError, val: - pass - else: - self.fail("has_key did not raise a proper exception") - - try: - data = d[100] - except KeyError: - pass - else: - self.fail("expected exception") - - try: - data = d.get(100) - except db.DBNotFoundError, val: - if get_returns_none: - self.fail("unexpected exception") - else: - assert data == None - - keys = d.keys() - if verbose: - print keys - assert type(keys) == type([]) - assert type(keys[0]) == type(123) - assert len(keys) == len(d) - - items = d.items() - if verbose: - pprint(items) - assert type(items) == type([]) - assert type(items[0]) == type(()) - assert len(items[0]) == 2 - assert type(items[0][0]) == type(123) - assert type(items[0][1]) == type("") - assert len(items) == len(d) - - assert d.has_key(25) - - del d[25] - assert not d.has_key(25) - - d.delete(13) - assert not d.has_key(13) - - data = d.get_both(26, "z" * 60) - assert data == "z" * 60 - if verbose: - print data - - fd = d.fd() - if verbose: - print fd - - c = d.cursor() - rec = c.first() - while rec: - if verbose: - print rec - rec = c.next() - - c.set(50) - rec = c.current() - if verbose: - print rec - - c.put(-1, "a replacement record", db.DB_CURRENT) - - c.set(50) - rec = c.current() - assert rec == (50, "a replacement record") - if verbose: - print rec - - rec = c.set_range(30) - if verbose: - print rec - - # test that non-existant key lookups work (and that - # DBC_set_range doesn't have a memleak under valgrind) - rec = c.set_range(999999) - assert rec == None - if verbose: - print rec - - c.close() - d.close() - - d = db.DB() - d.open(self.filename) - c = d.cursor() - - # put a record beyond the consecutive end of the recno's - d[100] = "way out there" - assert d[100] == "way out there" - - try: - data = d[99] - except KeyError: - pass - else: - self.fail("expected exception") - - try: - d.get(99) - except db.DBKeyEmptyError, val: - if get_returns_none: - self.fail("unexpected DBKeyEmptyError exception") - else: - assert val[0] == db.DB_KEYEMPTY - if verbose: print val - else: - if not get_returns_none: - self.fail("expected exception") - - rec = c.set(40) - while rec: - if verbose: - print rec - rec = c.next() - - c.close() - d.close() - - def test02_WithSource(self): - """ - A Recno file that is given a "backing source file" is essentially a - simple ASCII file. Normally each record is delimited by \n and so is - just a line in the file, but you can set a different record delimiter - if needed. - """ - source = os.path.join(os.path.dirname(sys.argv[0]), - 'db_home/test_recno.txt') - if not os.path.isdir('db_home'): - os.mkdir('db_home') - f = open(source, 'w') # create the file - f.close() - - d = db.DB() - # This is the default value, just checking if both int - d.set_re_delim(0x0A) - d.set_re_delim('\n') # and char can be used... - d.set_re_source(source) - d.open(self.filename, db.DB_RECNO, db.DB_CREATE) - - data = "The quick brown fox jumped over the lazy dog".split() - for datum in data: - d.append(datum) - d.sync() - d.close() - - # get the text from the backing source - text = open(source, 'r').read() - text = text.strip() - if verbose: - print text - print data - print text.split('\n') - - assert text.split('\n') == data - - # open as a DB again - d = db.DB() - d.set_re_source(source) - d.open(self.filename, db.DB_RECNO) - - d[3] = 'reddish-brown' - d[8] = 'comatose' - - d.sync() - d.close() - - text = open(source, 'r').read() - text = text.strip() - if verbose: - print text - print text.split('\n') - - assert text.split('\n') == \ - "The quick reddish-brown fox jumped over the comatose dog".split() - - def test03_FixedLength(self): - d = db.DB() - d.set_re_len(40) # fixed length records, 40 bytes long - d.set_re_pad('-') # sets the pad character... - d.set_re_pad(45) # ...test both int and char - d.open(self.filename, db.DB_RECNO, db.DB_CREATE) - - for x in letters: - d.append(x * 35) # These will be padded - - d.append('.' * 40) # this one will be exact - - try: # this one will fail - d.append('bad' * 20) - except db.DBInvalidArgError, val: - assert val[0] == db.EINVAL - if verbose: print val - else: - self.fail("expected exception") - - c = d.cursor() - rec = c.first() - while rec: - if verbose: - print rec - rec = c.next() - - c.close() - d.close() - - -#---------------------------------------------------------------------- - - -def test_suite(): - return unittest.makeSuite(SimpleRecnoTestCase) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_sequence.py b/sys/lib/python/bsddb/test/test_sequence.py deleted file mode 100644 index 979f858c4..000000000 --- a/sys/lib/python/bsddb/test/test_sequence.py +++ /dev/null @@ -1,112 +0,0 @@ -import unittest -import os -import sys -import tempfile -import glob - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - from bsddb import db - -from test_all import verbose - - -class DBSequenceTest(unittest.TestCase): - def setUp(self): - self.int_32_max = 0x100000000 - self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - try: - os.mkdir(self.homeDir) - except os.error: - pass - tempfile.tempdir = self.homeDir - self.filename = os.path.split(tempfile.mktemp())[1] - tempfile.tempdir = None - - self.dbenv = db.DBEnv() - self.dbenv.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL, 0666) - self.d = db.DB(self.dbenv) - self.d.open(self.filename, db.DB_BTREE, db.DB_CREATE, 0666) - - def tearDown(self): - if hasattr(self, 'seq'): - self.seq.close() - del self.seq - if hasattr(self, 'd'): - self.d.close() - del self.d - if hasattr(self, 'dbenv'): - self.dbenv.close() - del self.dbenv - - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) - - def test_get(self): - self.seq = db.DBSequence(self.d, flags=0) - start_value = 10 * self.int_32_max - self.assertEqual(0xA00000000, start_value) - self.assertEquals(None, self.seq.init_value(start_value)) - self.assertEquals(None, self.seq.open(key='id', txn=None, flags=db.DB_CREATE)) - self.assertEquals(start_value, self.seq.get(5)) - self.assertEquals(start_value + 5, self.seq.get()) - - def test_remove(self): - self.seq = db.DBSequence(self.d, flags=0) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - self.assertEquals(None, self.seq.remove(txn=None, flags=0)) - del self.seq - - def test_get_key(self): - self.seq = db.DBSequence(self.d, flags=0) - key = 'foo' - self.assertEquals(None, self.seq.open(key=key, txn=None, flags=db.DB_CREATE)) - self.assertEquals(key, self.seq.get_key()) - - def test_get_dbp(self): - self.seq = db.DBSequence(self.d, flags=0) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - self.assertEquals(self.d, self.seq.get_dbp()) - - def test_cachesize(self): - self.seq = db.DBSequence(self.d, flags=0) - cashe_size = 10 - self.assertEquals(None, self.seq.set_cachesize(cashe_size)) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - self.assertEquals(cashe_size, self.seq.get_cachesize()) - - def test_flags(self): - self.seq = db.DBSequence(self.d, flags=0) - flag = db.DB_SEQ_WRAP; - self.assertEquals(None, self.seq.set_flags(flag)) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - self.assertEquals(flag, self.seq.get_flags() & flag) - - def test_range(self): - self.seq = db.DBSequence(self.d, flags=0) - seq_range = (10 * self.int_32_max, 11 * self.int_32_max - 1) - self.assertEquals(None, self.seq.set_range(seq_range)) - self.seq.init_value(seq_range[0]) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - self.assertEquals(seq_range, self.seq.get_range()) - - def test_stat(self): - self.seq = db.DBSequence(self.d, flags=0) - self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE)) - stat = self.seq.stat() - for param in ('nowait', 'min', 'max', 'value', 'current', - 'flags', 'cache_size', 'last_value', 'wait'): - self.assertTrue(param in stat, "parameter %s isn't in stat info" % param) - -def test_suite(): - suite = unittest.TestSuite() - if db.version() >= (4,3): - suite.addTest(unittest.makeSuite(DBSequenceTest)) - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/bsddb/test/test_thread.py b/sys/lib/python/bsddb/test/test_thread.py deleted file mode 100644 index 31964f0b2..000000000 --- a/sys/lib/python/bsddb/test/test_thread.py +++ /dev/null @@ -1,506 +0,0 @@ -"""TestCases for multi-threaded access to a DB. -""" - -import os -import sys -import time -import errno -import shutil -import tempfile -from pprint import pprint -from random import random - -try: - True, False -except NameError: - True = 1 - False = 0 - -DASH = '-' - -try: - from threading import Thread, currentThread - have_threads = True -except ImportError: - have_threads = False - -try: - WindowsError -except NameError: - class WindowsError(Exception): - pass - -import unittest -from test_all import verbose - -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db, dbutils -except ImportError: - # For Python 2.3 - from bsddb import db, dbutils - - -#---------------------------------------------------------------------- - -class BaseThreadedTestCase(unittest.TestCase): - dbtype = db.DB_UNKNOWN # must be set in derived class - dbopenflags = 0 - dbsetflags = 0 - envflags = 0 - - def setUp(self): - if verbose: - dbutils._deadlock_VerboseFile = sys.stdout - - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') - self.homeDir = homeDir - try: - os.mkdir(homeDir) - except OSError, e: - if e.errno <> errno.EEXIST: raise - self.env = db.DBEnv() - self.setEnvOpts() - self.env.open(homeDir, self.envflags | db.DB_CREATE) - - self.filename = self.__class__.__name__ + '.db' - self.d = db.DB(self.env) - if self.dbsetflags: - self.d.set_flags(self.dbsetflags) - self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE) - - def tearDown(self): - self.d.close() - self.env.close() - shutil.rmtree(self.homeDir) - - def setEnvOpts(self): - pass - - def makeData(self, key): - return DASH.join([key] * 5) - - -#---------------------------------------------------------------------- - - -class ConcurrentDataStoreBase(BaseThreadedTestCase): - dbopenflags = db.DB_THREAD - envflags = db.DB_THREAD | db.DB_INIT_CDB | db.DB_INIT_MPOOL - readers = 0 # derived class should set - writers = 0 - records = 1000 - - def test01_1WriterMultiReaders(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test01_1WriterMultiReaders..." % \ - self.__class__.__name__ - - threads = [] - for x in range(self.writers): - wt = Thread(target = self.writerThread, - args = (self.d, self.records, x), - name = 'writer %d' % x, - )#verbose = verbose) - threads.append(wt) - - for x in range(self.readers): - rt = Thread(target = self.readerThread, - args = (self.d, x), - name = 'reader %d' % x, - )#verbose = verbose) - threads.append(rt) - - for t in threads: - t.start() - for t in threads: - t.join() - - def writerThread(self, d, howMany, writerNum): - #time.sleep(0.01 * writerNum + 0.01) - name = currentThread().getName() - start = howMany * writerNum - stop = howMany * (writerNum + 1) - 1 - if verbose: - print "%s: creating records %d - %d" % (name, start, stop) - - for x in range(start, stop): - key = '%04d' % x - dbutils.DeadlockWrap(d.put, key, self.makeData(key), - max_retries=12) - if verbose and x % 100 == 0: - print "%s: records %d - %d finished" % (name, start, x) - - if verbose: - print "%s: finished creating records" % name - -## # Each write-cursor will be exclusive, the only one that can update the DB... -## if verbose: print "%s: deleting a few records" % name -## c = d.cursor(flags = db.DB_WRITECURSOR) -## for x in range(10): -## key = int(random() * howMany) + start -## key = '%04d' % key -## if d.has_key(key): -## c.set(key) -## c.delete() - -## c.close() - if verbose: - print "%s: thread finished" % name - - def readerThread(self, d, readerNum): - time.sleep(0.01 * readerNum) - name = currentThread().getName() - - for loop in range(5): - c = d.cursor() - count = 0 - rec = c.first() - while rec: - count += 1 - key, data = rec - self.assertEqual(self.makeData(key), data) - rec = c.next() - if verbose: - print "%s: found %d records" % (name, count) - c.close() - time.sleep(0.05) - - if verbose: - print "%s: thread finished" % name - - -class BTreeConcurrentDataStore(ConcurrentDataStoreBase): - dbtype = db.DB_BTREE - writers = 2 - readers = 10 - records = 1000 - - -class HashConcurrentDataStore(ConcurrentDataStoreBase): - dbtype = db.DB_HASH - writers = 2 - readers = 10 - records = 1000 - - -#---------------------------------------------------------------------- - -class SimpleThreadedBase(BaseThreadedTestCase): - dbopenflags = db.DB_THREAD - envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK - readers = 5 - writers = 3 - records = 1000 - - def setEnvOpts(self): - self.env.set_lk_detect(db.DB_LOCK_DEFAULT) - - def test02_SimpleLocks(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test02_SimpleLocks..." % self.__class__.__name__ - - threads = [] - for x in range(self.writers): - wt = Thread(target = self.writerThread, - args = (self.d, self.records, x), - name = 'writer %d' % x, - )#verbose = verbose) - threads.append(wt) - for x in range(self.readers): - rt = Thread(target = self.readerThread, - args = (self.d, x), - name = 'reader %d' % x, - )#verbose = verbose) - threads.append(rt) - - for t in threads: - t.start() - for t in threads: - t.join() - - def writerThread(self, d, howMany, writerNum): - name = currentThread().getName() - start = howMany * writerNum - stop = howMany * (writerNum + 1) - 1 - if verbose: - print "%s: creating records %d - %d" % (name, start, stop) - - # create a bunch of records - for x in xrange(start, stop): - key = '%04d' % x - dbutils.DeadlockWrap(d.put, key, self.makeData(key), - max_retries=12) - - if verbose and x % 100 == 0: - print "%s: records %d - %d finished" % (name, start, x) - - # do a bit or reading too - if random() <= 0.05: - for y in xrange(start, x): - key = '%04d' % x - data = dbutils.DeadlockWrap(d.get, key, max_retries=12) - self.assertEqual(data, self.makeData(key)) - - # flush them - try: - dbutils.DeadlockWrap(d.sync, max_retries=12) - except db.DBIncompleteError, val: - if verbose: - print "could not complete sync()..." - - # read them back, deleting a few - for x in xrange(start, stop): - key = '%04d' % x - data = dbutils.DeadlockWrap(d.get, key, max_retries=12) - if verbose and x % 100 == 0: - print "%s: fetched record (%s, %s)" % (name, key, data) - self.assertEqual(data, self.makeData(key)) - if random() <= 0.10: - dbutils.DeadlockWrap(d.delete, key, max_retries=12) - if verbose: - print "%s: deleted record %s" % (name, key) - - if verbose: - print "%s: thread finished" % name - - def readerThread(self, d, readerNum): - time.sleep(0.01 * readerNum) - name = currentThread().getName() - - for loop in range(5): - c = d.cursor() - count = 0 - rec = dbutils.DeadlockWrap(c.first, max_retries=10) - while rec: - count += 1 - key, data = rec - self.assertEqual(self.makeData(key), data) - rec = dbutils.DeadlockWrap(c.next, max_retries=10) - if verbose: - print "%s: found %d records" % (name, count) - c.close() - time.sleep(0.05) - - if verbose: - print "%s: thread finished" % name - - -class BTreeSimpleThreaded(SimpleThreadedBase): - dbtype = db.DB_BTREE - - -class HashSimpleThreaded(SimpleThreadedBase): - dbtype = db.DB_HASH - - -#---------------------------------------------------------------------- - - -class ThreadedTransactionsBase(BaseThreadedTestCase): - dbopenflags = db.DB_THREAD | db.DB_AUTO_COMMIT - envflags = (db.DB_THREAD | - db.DB_INIT_MPOOL | - db.DB_INIT_LOCK | - db.DB_INIT_LOG | - db.DB_INIT_TXN - ) - readers = 0 - writers = 0 - records = 2000 - txnFlag = 0 - - def setEnvOpts(self): - #self.env.set_lk_detect(db.DB_LOCK_DEFAULT) - pass - - def test03_ThreadedTransactions(self): - if verbose: - print '\n', '-=' * 30 - print "Running %s.test03_ThreadedTransactions..." % \ - self.__class__.__name__ - - threads = [] - for x in range(self.writers): - wt = Thread(target = self.writerThread, - args = (self.d, self.records, x), - name = 'writer %d' % x, - )#verbose = verbose) - threads.append(wt) - - for x in range(self.readers): - rt = Thread(target = self.readerThread, - args = (self.d, x), - name = 'reader %d' % x, - )#verbose = verbose) - threads.append(rt) - - dt = Thread(target = self.deadlockThread) - dt.start() - - for t in threads: - t.start() - for t in threads: - t.join() - - self.doLockDetect = False - dt.join() - - def doWrite(self, d, name, start, stop): - finished = False - while not finished: - try: - txn = self.env.txn_begin(None, self.txnFlag) - for x in range(start, stop): - key = '%04d' % x - d.put(key, self.makeData(key), txn) - if verbose and x % 100 == 0: - print "%s: records %d - %d finished" % (name, start, x) - txn.commit() - finished = True - except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: - if verbose: - print "%s: Aborting transaction (%s)" % (name, val[1]) - txn.abort() - time.sleep(0.05) - - def writerThread(self, d, howMany, writerNum): - name = currentThread().getName() - start = howMany * writerNum - stop = howMany * (writerNum + 1) - 1 - if verbose: - print "%s: creating records %d - %d" % (name, start, stop) - - step = 100 - for x in range(start, stop, step): - self.doWrite(d, name, x, min(stop, x+step)) - - if verbose: - print "%s: finished creating records" % name - if verbose: - print "%s: deleting a few records" % name - - finished = False - while not finished: - try: - recs = [] - txn = self.env.txn_begin(None, self.txnFlag) - for x in range(10): - key = int(random() * howMany) + start - key = '%04d' % key - data = d.get(key, None, txn, db.DB_RMW) - if data is not None: - d.delete(key, txn) - recs.append(key) - txn.commit() - finished = True - if verbose: - print "%s: deleted records %s" % (name, recs) - except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: - if verbose: - print "%s: Aborting transaction (%s)" % (name, val[1]) - txn.abort() - time.sleep(0.05) - - if verbose: - print "%s: thread finished" % name - - def readerThread(self, d, readerNum): - time.sleep(0.01 * readerNum + 0.05) - name = currentThread().getName() - - for loop in range(5): - finished = False - while not finished: - try: - txn = self.env.txn_begin(None, self.txnFlag) - c = d.cursor(txn) - count = 0 - rec = c.first() - while rec: - count += 1 - key, data = rec - self.assertEqual(self.makeData(key), data) - rec = c.next() - if verbose: print "%s: found %d records" % (name, count) - c.close() - txn.commit() - finished = True - except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: - if verbose: - print "%s: Aborting transaction (%s)" % (name, val[1]) - c.close() - txn.abort() - time.sleep(0.05) - - time.sleep(0.05) - - if verbose: - print "%s: thread finished" % name - - def deadlockThread(self): - self.doLockDetect = True - while self.doLockDetect: - time.sleep(0.5) - try: - aborted = self.env.lock_detect( - db.DB_LOCK_RANDOM, db.DB_LOCK_CONFLICT) - if verbose and aborted: - print "deadlock: Aborted %d deadlocked transaction(s)" \ - % aborted - except db.DBError: - pass - - -class BTreeThreadedTransactions(ThreadedTransactionsBase): - dbtype = db.DB_BTREE - writers = 3 - readers = 5 - records = 2000 - -class HashThreadedTransactions(ThreadedTransactionsBase): - dbtype = db.DB_HASH - writers = 1 - readers = 5 - records = 2000 - -class BTreeThreadedNoWaitTransactions(ThreadedTransactionsBase): - dbtype = db.DB_BTREE - writers = 3 - readers = 5 - records = 2000 - txnFlag = db.DB_TXN_NOWAIT - -class HashThreadedNoWaitTransactions(ThreadedTransactionsBase): - dbtype = db.DB_HASH - writers = 1 - readers = 5 - records = 2000 - txnFlag = db.DB_TXN_NOWAIT - - -#---------------------------------------------------------------------- - -def test_suite(): - suite = unittest.TestSuite() - - if have_threads: - suite.addTest(unittest.makeSuite(BTreeConcurrentDataStore)) - suite.addTest(unittest.makeSuite(HashConcurrentDataStore)) - suite.addTest(unittest.makeSuite(BTreeSimpleThreaded)) - suite.addTest(unittest.makeSuite(HashSimpleThreaded)) - suite.addTest(unittest.makeSuite(BTreeThreadedTransactions)) - suite.addTest(unittest.makeSuite(HashThreadedTransactions)) - suite.addTest(unittest.makeSuite(BTreeThreadedNoWaitTransactions)) - suite.addTest(unittest.makeSuite(HashThreadedNoWaitTransactions)) - - else: - print "Threads not available, skipping thread tests." - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') diff --git a/sys/lib/python/ctypes/test/__init__.py b/sys/lib/python/ctypes/test/__init__.py deleted file mode 100644 index 2ae54052d..000000000 --- a/sys/lib/python/ctypes/test/__init__.py +++ /dev/null @@ -1,202 +0,0 @@ -import glob, os, sys, unittest, getopt, time - -use_resources = [] - -class ResourceDenied(Exception): - """Test skipped because it requested a disallowed resource. - - This is raised when a test calls requires() for a resource that - has not be enabled. Resources are defined by test modules. - """ - -def is_resource_enabled(resource): - """Test whether a resource is enabled. - - If the caller's module is __main__ then automatically return True.""" - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return True - result = use_resources is not None and \ - (resource in use_resources or "*" in use_resources) - if not result: - _unavail[resource] = None - return result - -_unavail = {} -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = "Use of the `%s' resource not enabled" % resource - raise ResourceDenied(msg) - -def find_package_modules(package, mask): - import fnmatch - if hasattr(package, "__loader__"): - path = package.__name__.replace(".", os.path.sep) - mask = os.path.join(path, mask) - for fnm in package.__loader__._files.iterkeys(): - if fnmatch.fnmatchcase(fnm, mask): - yield os.path.splitext(fnm)[0].replace(os.path.sep, ".") - else: - path = package.__path__[0] - for fnm in os.listdir(path): - if fnmatch.fnmatchcase(fnm, mask): - yield "%s.%s" % (package.__name__, os.path.splitext(fnm)[0]) - -def get_tests(package, mask, verbosity): - """Return a list of skipped test modules, and a list of test cases.""" - tests = [] - skipped = [] - for modname in find_package_modules(package, mask): - try: - mod = __import__(modname, globals(), locals(), ['*']) - except ResourceDenied, detail: - skipped.append(modname) - if verbosity > 1: - print >> sys.stderr, "Skipped %s: %s" % (modname, detail) - continue - except Exception, detail: - print >> sys.stderr, "Warning: could not import %s: %s" % (modname, detail) - continue - for name in dir(mod): - if name.startswith("_"): - continue - o = getattr(mod, name) - if type(o) is type(unittest.TestCase) and issubclass(o, unittest.TestCase): - tests.append(o) - return skipped, tests - -def usage(): - print __doc__ - return 1 - -def test_with_refcounts(runner, verbosity, testcase): - """Run testcase several times, tracking reference counts.""" - import gc - import ctypes - ptc = ctypes._pointer_type_cache.copy() - cfc = ctypes._c_functype_cache.copy() - wfc = ctypes._win_functype_cache.copy() - - # when searching for refcount leaks, we have to manually reset any - # caches that ctypes has. - def cleanup(): - ctypes._pointer_type_cache = ptc.copy() - ctypes._c_functype_cache = cfc.copy() - ctypes._win_functype_cache = wfc.copy() - gc.collect() - - test = unittest.makeSuite(testcase) - for i in range(5): - rc = sys.gettotalrefcount() - runner.run(test) - cleanup() - COUNT = 5 - refcounts = [None] * COUNT - for i in range(COUNT): - rc = sys.gettotalrefcount() - runner.run(test) - cleanup() - refcounts[i] = sys.gettotalrefcount() - rc - if filter(None, refcounts): - print "%s leaks:\n\t" % testcase, refcounts - elif verbosity: - print "%s: ok." % testcase - -class TestRunner(unittest.TextTestRunner): - def run(self, test, skipped): - "Run the given test case or test suite." - # Same as unittest.TextTestRunner.run, except that it reports - # skipped tests. - result = self._makeResult() - startTime = time.time() - test(result) - stopTime = time.time() - timeTaken = stopTime - startTime - result.printErrors() - self.stream.writeln(result.separator2) - run = result.testsRun - if _unavail: #skipped: - requested = _unavail.keys() - requested.sort() - self.stream.writeln("Ran %d test%s in %.3fs (%s module%s skipped)" % - (run, run != 1 and "s" or "", timeTaken, - len(skipped), - len(skipped) != 1 and "s" or "")) - self.stream.writeln("Unavailable resources: %s" % ", ".join(requested)) - else: - self.stream.writeln("Ran %d test%s in %.3fs" % - (run, run != 1 and "s" or "", timeTaken)) - self.stream.writeln() - if not result.wasSuccessful(): - self.stream.write("FAILED (") - failed, errored = map(len, (result.failures, result.errors)) - if failed: - self.stream.write("failures=%d" % failed) - if errored: - if failed: self.stream.write(", ") - self.stream.write("errors=%d" % errored) - self.stream.writeln(")") - else: - self.stream.writeln("OK") - return result - - -def main(*packages): - try: - opts, args = getopt.getopt(sys.argv[1:], "rqvu:") - except getopt.error: - return usage() - - verbosity = 1 - search_leaks = False - for flag, value in opts: - if flag == "-q": - verbosity -= 1 - elif flag == "-v": - verbosity += 1 - elif flag == "-r": - try: - sys.gettotalrefcount - except AttributeError: - print >> sys.stderr, "-r flag requires Python debug build" - return -1 - search_leaks = True - elif flag == "-u": - use_resources.extend(value.split(",")) - - mask = "test_*.py" - if args: - mask = args[0] - - for package in packages: - run_tests(package, mask, verbosity, search_leaks) - - -def run_tests(package, mask, verbosity, search_leaks): - skipped, testcases = get_tests(package, mask, verbosity) - runner = TestRunner(verbosity=verbosity) - - suites = [unittest.makeSuite(o) for o in testcases] - suite = unittest.TestSuite(suites) - result = runner.run(suite, skipped) - - if search_leaks: - # hunt for refcount leaks - runner = BasicTestRunner() - for t in testcases: - test_with_refcounts(runner, verbosity, t) - - return bool(result.errors) - -class BasicTestRunner: - def run(self, test): - result = unittest.TestResult() - test(result) - return result diff --git a/sys/lib/python/ctypes/test/runtests.py b/sys/lib/python/ctypes/test/runtests.py deleted file mode 100644 index 14d7caa7c..000000000 --- a/sys/lib/python/ctypes/test/runtests.py +++ /dev/null @@ -1,17 +0,0 @@ -"""Usage: runtests.py [-q] [-r] [-v] [-u resources] [mask] - -Run all tests found in this directory, and print a summary of the results. -Command line flags: - -q quiet mode: don't prnt anything while the tests are running - -r run tests repeatedly, look for refcount leaks - -u<resources> - Add resources to the lits of allowed resources. '*' allows all - resources. - -v verbose mode: print the test currently executed - mask mask to select filenames containing testcases, wildcards allowed -""" -import sys -import ctypes.test - -if __name__ == "__main__": - sys.exit(ctypes.test.main(ctypes.test)) diff --git a/sys/lib/python/ctypes/test/test_anon.py b/sys/lib/python/ctypes/test/test_anon.py deleted file mode 100644 index 99e02cb55..000000000 --- a/sys/lib/python/ctypes/test/test_anon.py +++ /dev/null @@ -1,60 +0,0 @@ -import unittest -from ctypes import * - -class AnonTest(unittest.TestCase): - - def test_anon(self): - class ANON(Union): - _fields_ = [("a", c_int), - ("b", c_int)] - - class Y(Structure): - _fields_ = [("x", c_int), - ("_", ANON), - ("y", c_int)] - _anonymous_ = ["_"] - - self.failUnlessEqual(Y.a.offset, sizeof(c_int)) - self.failUnlessEqual(Y.b.offset, sizeof(c_int)) - - self.failUnlessEqual(ANON.a.offset, 0) - self.failUnlessEqual(ANON.b.offset, 0) - - def test_anon_nonseq(self): - # TypeError: _anonymous_ must be a sequence - self.failUnlessRaises(TypeError, - lambda: type(Structure)("Name", - (Structure,), - {"_fields_": [], "_anonymous_": 42})) - - def test_anon_nonmember(self): - # AttributeError: type object 'Name' has no attribute 'x' - self.failUnlessRaises(AttributeError, - lambda: type(Structure)("Name", - (Structure,), - {"_fields_": [], - "_anonymous_": ["x"]})) - - def test_nested(self): - class ANON_S(Structure): - _fields_ = [("a", c_int)] - - class ANON_U(Union): - _fields_ = [("_", ANON_S), - ("b", c_int)] - _anonymous_ = ["_"] - - class Y(Structure): - _fields_ = [("x", c_int), - ("_", ANON_U), - ("y", c_int)] - _anonymous_ = ["_"] - - self.failUnlessEqual(Y.x.offset, 0) - self.failUnlessEqual(Y.a.offset, sizeof(c_int)) - self.failUnlessEqual(Y.b.offset, sizeof(c_int)) - self.failUnlessEqual(Y._.offset, sizeof(c_int)) - self.failUnlessEqual(Y.y.offset, sizeof(c_int) * 2) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_array_in_pointer.py b/sys/lib/python/ctypes/test/test_array_in_pointer.py deleted file mode 100644 index 3ed310cc6..000000000 --- a/sys/lib/python/ctypes/test/test_array_in_pointer.py +++ /dev/null @@ -1,64 +0,0 @@ -import unittest -from ctypes import * -from binascii import hexlify -import re - -def dump(obj): - # helper function to dump memory contents in hex, with a hyphen - # between the bytes. - h = hexlify(buffer(obj)) - return re.sub(r"(..)", r"\1-", h)[:-1] - - -class Value(Structure): - _fields_ = [("val", c_byte)] - -class Container(Structure): - _fields_ = [("pvalues", POINTER(Value))] - -class Test(unittest.TestCase): - def test(self): - # create an array of 4 values - val_array = (Value * 4)() - - # create a container, which holds a pointer to the pvalues array. - c = Container() - c.pvalues = val_array - - # memory contains 4 NUL bytes now, that's correct - self.failUnlessEqual("00-00-00-00", dump(val_array)) - - # set the values of the array through the pointer: - for i in range(4): - c.pvalues[i].val = i + 1 - - values = [c.pvalues[i].val for i in range(4)] - - # These are the expected results: here s the bug! - self.failUnlessEqual( - (values, dump(val_array)), - ([1, 2, 3, 4], "01-02-03-04") - ) - - def test_2(self): - - val_array = (Value * 4)() - - # memory contains 4 NUL bytes now, that's correct - self.failUnlessEqual("00-00-00-00", dump(val_array)) - - ptr = cast(val_array, POINTER(Value)) - # set the values of the array through the pointer: - for i in range(4): - ptr[i].val = i + 1 - - values = [ptr[i].val for i in range(4)] - - # These are the expected results: here s the bug! - self.failUnlessEqual( - (values, dump(val_array)), - ([1, 2, 3, 4], "01-02-03-04") - ) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_arrays.py b/sys/lib/python/ctypes/test/test_arrays.py deleted file mode 100644 index c812ff627..000000000 --- a/sys/lib/python/ctypes/test/test_arrays.py +++ /dev/null @@ -1,112 +0,0 @@ -import unittest -from ctypes import * - -formats = "bBhHiIlLqQfd" - -formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \ - c_long, c_ulonglong, c_float, c_double - -class ArrayTestCase(unittest.TestCase): - def test_simple(self): - # create classes holding simple numeric types, and check - # various properties. - - init = range(15, 25) - - for fmt in formats: - alen = len(init) - int_array = ARRAY(fmt, alen) - - ia = int_array(*init) - # length of instance ok? - self.failUnlessEqual(len(ia), alen) - - # slot values ok? - values = [ia[i] for i in range(len(init))] - self.failUnlessEqual(values, init) - - # change the items - from operator import setitem - new_values = range(42, 42+alen) - [setitem(ia, n, new_values[n]) for n in range(alen)] - values = [ia[i] for i in range(len(init))] - self.failUnlessEqual(values, new_values) - - # are the items initialized to 0? - ia = int_array() - values = [ia[i] for i in range(len(init))] - self.failUnlessEqual(values, [0] * len(init)) - - # Too many in itializers should be caught - self.assertRaises(IndexError, int_array, *range(alen*2)) - - CharArray = ARRAY(c_char, 3) - - ca = CharArray("a", "b", "c") - - # Should this work? It doesn't: - # CharArray("abc") - self.assertRaises(TypeError, CharArray, "abc") - - self.failUnlessEqual(ca[0], "a") - self.failUnlessEqual(ca[1], "b") - self.failUnlessEqual(ca[2], "c") - self.failUnlessEqual(ca[-3], "a") - self.failUnlessEqual(ca[-2], "b") - self.failUnlessEqual(ca[-1], "c") - - self.failUnlessEqual(len(ca), 3) - - # slicing is now supported, but not extended slicing (3-argument)! - from operator import getslice, delitem - self.assertRaises(TypeError, getslice, ca, 0, 1, -1) - - # cannot delete items - self.assertRaises(TypeError, delitem, ca, 0) - - def test_numeric_arrays(self): - - alen = 5 - - numarray = ARRAY(c_int, alen) - - na = numarray() - values = [na[i] for i in range(alen)] - self.failUnlessEqual(values, [0] * alen) - - na = numarray(*[c_int()] * alen) - values = [na[i] for i in range(alen)] - self.failUnlessEqual(values, [0]*alen) - - na = numarray(1, 2, 3, 4, 5) - values = [i for i in na] - self.failUnlessEqual(values, [1, 2, 3, 4, 5]) - - na = numarray(*map(c_int, (1, 2, 3, 4, 5))) - values = [i for i in na] - self.failUnlessEqual(values, [1, 2, 3, 4, 5]) - - def test_classcache(self): - self.failUnless(not ARRAY(c_int, 3) is ARRAY(c_int, 4)) - self.failUnless(ARRAY(c_int, 3) is ARRAY(c_int, 3)) - - def test_from_address(self): - # Failed with 0.9.8, reported by JUrner - p = create_string_buffer("foo") - sz = (c_char * 3).from_address(addressof(p)) - self.failUnlessEqual(sz[:], "foo") - self.failUnlessEqual(sz.value, "foo") - - try: - create_unicode_buffer - except NameError: - pass - else: - def test_from_addressW(self): - p = create_unicode_buffer("foo") - sz = (c_wchar * 3).from_address(addressof(p)) - self.failUnlessEqual(sz[:], "foo") - self.failUnlessEqual(sz.value, "foo") - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_as_parameter.py b/sys/lib/python/ctypes/test/test_as_parameter.py deleted file mode 100644 index 058105933..000000000 --- a/sys/lib/python/ctypes/test/test_as_parameter.py +++ /dev/null @@ -1,215 +0,0 @@ -import unittest -from ctypes import * -import _ctypes_test - -dll = CDLL(_ctypes_test.__file__) - -try: - CALLBACK_FUNCTYPE = WINFUNCTYPE -except NameError: - # fake to enable this test on Linux - CALLBACK_FUNCTYPE = CFUNCTYPE - -class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] - -class BasicWrapTestCase(unittest.TestCase): - def wrap(self, param): - return param - - def test_wchar_parm(self): - try: - c_wchar - except NameError: - return - f = dll._testfunc_i_bhilfd - f.argtypes = [c_byte, c_wchar, c_int, c_long, c_float, c_double] - result = f(self.wrap(1), self.wrap(u"x"), self.wrap(3), self.wrap(4), self.wrap(5.0), self.wrap(6.0)) - self.failUnlessEqual(result, 139) - self.failUnless(type(result), int) - - def test_pointers(self): - f = dll._testfunc_p_p - f.restype = POINTER(c_int) - f.argtypes = [POINTER(c_int)] - - # This only works if the value c_int(42) passed to the - # function is still alive while the pointer (the result) is - # used. - - v = c_int(42) - - self.failUnlessEqual(pointer(v).contents.value, 42) - result = f(self.wrap(pointer(v))) - self.failUnlessEqual(type(result), POINTER(c_int)) - self.failUnlessEqual(result.contents.value, 42) - - # This on works... - result = f(self.wrap(pointer(v))) - self.failUnlessEqual(result.contents.value, v.value) - - p = pointer(c_int(99)) - result = f(self.wrap(p)) - self.failUnlessEqual(result.contents.value, 99) - - def test_shorts(self): - f = dll._testfunc_callback_i_if - - args = [] - expected = [262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, - 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1] - - def callback(v): - args.append(v) - return v - - CallBack = CFUNCTYPE(c_int, c_int) - - cb = CallBack(callback) - f(self.wrap(2**18), self.wrap(cb)) - self.failUnlessEqual(args, expected) - - ################################################################ - - def test_callbacks(self): - f = dll._testfunc_callback_i_if - f.restype = c_int - - MyCallback = CFUNCTYPE(c_int, c_int) - - def callback(value): - #print "called back with", value - return value - - cb = MyCallback(callback) - - result = f(self.wrap(-10), self.wrap(cb)) - self.failUnlessEqual(result, -18) - - # test with prototype - f.argtypes = [c_int, MyCallback] - cb = MyCallback(callback) - - result = f(self.wrap(-10), self.wrap(cb)) - self.failUnlessEqual(result, -18) - - result = f(self.wrap(-10), self.wrap(cb)) - self.failUnlessEqual(result, -18) - - AnotherCallback = CALLBACK_FUNCTYPE(c_int, c_int, c_int, c_int, c_int) - - # check that the prototype works: we call f with wrong - # argument types - cb = AnotherCallback(callback) - self.assertRaises(ArgumentError, f, self.wrap(-10), self.wrap(cb)) - - def test_callbacks_2(self): - # Can also use simple datatypes as argument type specifiers - # for the callback function. - # In this case the call receives an instance of that type - f = dll._testfunc_callback_i_if - f.restype = c_int - - MyCallback = CFUNCTYPE(c_int, c_int) - - f.argtypes = [c_int, MyCallback] - - def callback(value): - #print "called back with", value - self.failUnlessEqual(type(value), int) - return value - - cb = MyCallback(callback) - result = f(self.wrap(-10), self.wrap(cb)) - self.failUnlessEqual(result, -18) - - def test_longlong_callbacks(self): - - f = dll._testfunc_callback_q_qf - f.restype = c_longlong - - MyCallback = CFUNCTYPE(c_longlong, c_longlong) - - f.argtypes = [c_longlong, MyCallback] - - def callback(value): - self.failUnless(isinstance(value, (int, long))) - return value & 0x7FFFFFFF - - cb = MyCallback(callback) - - self.failUnlessEqual(13577625587, int(f(self.wrap(1000000000000), self.wrap(cb)))) - - def test_byval(self): - # without prototype - ptin = POINT(1, 2) - ptout = POINT() - # EXPORT int _testfunc_byval(point in, point *pout) - result = dll._testfunc_byval(ptin, byref(ptout)) - got = result, ptout.x, ptout.y - expected = 3, 1, 2 - self.failUnlessEqual(got, expected) - - # with prototype - ptin = POINT(101, 102) - ptout = POINT() - dll._testfunc_byval.argtypes = (POINT, POINTER(POINT)) - dll._testfunc_byval.restype = c_int - result = dll._testfunc_byval(self.wrap(ptin), byref(ptout)) - got = result, ptout.x, ptout.y - expected = 203, 101, 102 - self.failUnlessEqual(got, expected) - - def test_struct_return_2H(self): - class S2H(Structure): - _fields_ = [("x", c_short), - ("y", c_short)] - dll.ret_2h_func.restype = S2H - dll.ret_2h_func.argtypes = [S2H] - inp = S2H(99, 88) - s2h = dll.ret_2h_func(self.wrap(inp)) - self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) - - def test_struct_return_8H(self): - class S8I(Structure): - _fields_ = [("a", c_int), - ("b", c_int), - ("c", c_int), - ("d", c_int), - ("e", c_int), - ("f", c_int), - ("g", c_int), - ("h", c_int)] - dll.ret_8i_func.restype = S8I - dll.ret_8i_func.argtypes = [S8I] - inp = S8I(9, 8, 7, 6, 5, 4, 3, 2) - s8i = dll.ret_8i_func(self.wrap(inp)) - self.failUnlessEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), - (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class AsParamWrapper(object): - def __init__(self, param): - self._as_parameter_ = param - -class AsParamWrapperTestCase(BasicWrapTestCase): - wrap = AsParamWrapper - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class AsParamPropertyWrapper(object): - def __init__(self, param): - self._param = param - - def getParameter(self): - return self._param - _as_parameter_ = property(getParameter) - -class AsParamPropertyWrapperTestCase(BasicWrapTestCase): - wrap = AsParamPropertyWrapper - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_bitfields.py b/sys/lib/python/ctypes/test/test_bitfields.py deleted file mode 100644 index 2867cbf93..000000000 --- a/sys/lib/python/ctypes/test/test_bitfields.py +++ /dev/null @@ -1,228 +0,0 @@ -from ctypes import * -import unittest -import os - -import ctypes -import _ctypes_test - -class BITS(Structure): - _fields_ = [("A", c_int, 1), - ("B", c_int, 2), - ("C", c_int, 3), - ("D", c_int, 4), - ("E", c_int, 5), - ("F", c_int, 6), - ("G", c_int, 7), - ("H", c_int, 8), - ("I", c_int, 9), - - ("M", c_short, 1), - ("N", c_short, 2), - ("O", c_short, 3), - ("P", c_short, 4), - ("Q", c_short, 5), - ("R", c_short, 6), - ("S", c_short, 7)] - -func = CDLL(_ctypes_test.__file__).unpack_bitfields -func.argtypes = POINTER(BITS), c_char - -##for n in "ABCDEFGHIMNOPQRS": -## print n, hex(getattr(BITS, n).size), getattr(BITS, n).offset - -class C_Test(unittest.TestCase): - - def test_ints(self): - for i in range(512): - for name in "ABCDEFGHI": - b = BITS() - setattr(b, name, i) - self.failUnlessEqual((name, i, getattr(b, name)), (name, i, func(byref(b), name))) - - def test_shorts(self): - for i in range(256): - for name in "MNOPQRS": - b = BITS() - setattr(b, name, i) - self.failUnlessEqual((name, i, getattr(b, name)), (name, i, func(byref(b), name))) - -signed_int_types = (c_byte, c_short, c_int, c_long, c_longlong) -unsigned_int_types = (c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong) -int_types = unsigned_int_types + signed_int_types - -class BitFieldTest(unittest.TestCase): - - def test_longlong(self): - class X(Structure): - _fields_ = [("a", c_longlong, 1), - ("b", c_longlong, 62), - ("c", c_longlong, 1)] - - self.failUnlessEqual(sizeof(X), sizeof(c_longlong)) - x = X() - x.a, x.b, x.c = -1, 7, -1 - self.failUnlessEqual((x.a, x.b, x.c), (-1, 7, -1)) - - def test_ulonglong(self): - class X(Structure): - _fields_ = [("a", c_ulonglong, 1), - ("b", c_ulonglong, 62), - ("c", c_ulonglong, 1)] - - self.failUnlessEqual(sizeof(X), sizeof(c_longlong)) - x = X() - self.failUnlessEqual((x.a, x.b, x.c), (0, 0, 0)) - x.a, x.b, x.c = 7, 7, 7 - self.failUnlessEqual((x.a, x.b, x.c), (1, 7, 1)) - - def test_signed(self): - for c_typ in signed_int_types: - class X(Structure): - _fields_ = [("dummy", c_typ), - ("a", c_typ, 3), - ("b", c_typ, 3), - ("c", c_typ, 1)] - self.failUnlessEqual(sizeof(X), sizeof(c_typ)*2) - - x = X() - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, 0, 0, 0)) - x.a = -1 - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, -1, 0, 0)) - x.a, x.b = 0, -1 - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, 0, -1, 0)) - - - def test_unsigned(self): - for c_typ in unsigned_int_types: - class X(Structure): - _fields_ = [("a", c_typ, 3), - ("b", c_typ, 3), - ("c", c_typ, 1)] - self.failUnlessEqual(sizeof(X), sizeof(c_typ)) - - x = X() - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, 0, 0, 0)) - x.a = -1 - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, 7, 0, 0)) - x.a, x.b = 0, -1 - self.failUnlessEqual((c_typ, x.a, x.b, x.c), (c_typ, 0, 7, 0)) - - - def fail_fields(self, *fields): - return self.get_except(type(Structure), "X", (), - {"_fields_": fields}) - - def test_nonint_types(self): - # bit fields are not allowed on non-integer types. - result = self.fail_fields(("a", c_char_p, 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type c_char_p')) - - result = self.fail_fields(("a", c_void_p, 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type c_void_p')) - - if c_int != c_long: - result = self.fail_fields(("a", POINTER(c_int), 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type LP_c_int')) - - result = self.fail_fields(("a", c_char, 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type c_char')) - - try: - c_wchar - except NameError: - pass - else: - result = self.fail_fields(("a", c_wchar, 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type c_wchar')) - - class Dummy(Structure): - _fields_ = [] - - result = self.fail_fields(("a", Dummy, 1)) - self.failUnlessEqual(result, (TypeError, 'bit fields not allowed for type Dummy')) - - def test_single_bitfield_size(self): - for c_typ in int_types: - result = self.fail_fields(("a", c_typ, -1)) - self.failUnlessEqual(result, (ValueError, 'number of bits invalid for bit field')) - - result = self.fail_fields(("a", c_typ, 0)) - self.failUnlessEqual(result, (ValueError, 'number of bits invalid for bit field')) - - class X(Structure): - _fields_ = [("a", c_typ, 1)] - self.failUnlessEqual(sizeof(X), sizeof(c_typ)) - - class X(Structure): - _fields_ = [("a", c_typ, sizeof(c_typ)*8)] - self.failUnlessEqual(sizeof(X), sizeof(c_typ)) - - result = self.fail_fields(("a", c_typ, sizeof(c_typ)*8 + 1)) - self.failUnlessEqual(result, (ValueError, 'number of bits invalid for bit field')) - - def test_multi_bitfields_size(self): - class X(Structure): - _fields_ = [("a", c_short, 1), - ("b", c_short, 14), - ("c", c_short, 1)] - self.failUnlessEqual(sizeof(X), sizeof(c_short)) - - class X(Structure): - _fields_ = [("a", c_short, 1), - ("a1", c_short), - ("b", c_short, 14), - ("c", c_short, 1)] - self.failUnlessEqual(sizeof(X), sizeof(c_short)*3) - self.failUnlessEqual(X.a.offset, 0) - self.failUnlessEqual(X.a1.offset, sizeof(c_short)) - self.failUnlessEqual(X.b.offset, sizeof(c_short)*2) - self.failUnlessEqual(X.c.offset, sizeof(c_short)*2) - - class X(Structure): - _fields_ = [("a", c_short, 3), - ("b", c_short, 14), - ("c", c_short, 14)] - self.failUnlessEqual(sizeof(X), sizeof(c_short)*3) - self.failUnlessEqual(X.a.offset, sizeof(c_short)*0) - self.failUnlessEqual(X.b.offset, sizeof(c_short)*1) - self.failUnlessEqual(X.c.offset, sizeof(c_short)*2) - - - def get_except(self, func, *args, **kw): - try: - func(*args, **kw) - except Exception, detail: - return detail.__class__, str(detail) - - def test_mixed_1(self): - class X(Structure): - _fields_ = [("a", c_byte, 4), - ("b", c_int, 4)] - if os.name in ("nt", "ce"): - self.failUnlessEqual(sizeof(X), sizeof(c_int)*2) - else: - self.failUnlessEqual(sizeof(X), sizeof(c_int)) - - def test_mixed_2(self): - class X(Structure): - _fields_ = [("a", c_byte, 4), - ("b", c_int, 32)] - self.failUnlessEqual(sizeof(X), sizeof(c_int)*2) - - def test_mixed_3(self): - class X(Structure): - _fields_ = [("a", c_byte, 4), - ("b", c_ubyte, 4)] - self.failUnlessEqual(sizeof(X), sizeof(c_byte)) - - def test_anon_bitfields(self): - # anonymous bit-fields gave a strange error message - class X(Structure): - _fields_ = [("a", c_byte, 4), - ("b", c_ubyte, 4)] - class Y(Structure): - _anonymous_ = ["_"] - _fields_ = [("_", X)] - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_buffers.py b/sys/lib/python/ctypes/test/test_buffers.py deleted file mode 100644 index 07527a6dc..000000000 --- a/sys/lib/python/ctypes/test/test_buffers.py +++ /dev/null @@ -1,54 +0,0 @@ -from ctypes import * -import unittest - -class StringBufferTestCase(unittest.TestCase): - - def test_buffer(self): - b = create_string_buffer(32) - self.failUnlessEqual(len(b), 32) - self.failUnlessEqual(sizeof(b), 32 * sizeof(c_char)) - self.failUnless(type(b[0]) is str) - - b = create_string_buffer("abc") - self.failUnlessEqual(len(b), 4) # trailing nul char - self.failUnlessEqual(sizeof(b), 4 * sizeof(c_char)) - self.failUnless(type(b[0]) is str) - self.failUnlessEqual(b[0], "a") - self.failUnlessEqual(b[:], "abc\0") - - def test_string_conversion(self): - b = create_string_buffer(u"abc") - self.failUnlessEqual(len(b), 4) # trailing nul char - self.failUnlessEqual(sizeof(b), 4 * sizeof(c_char)) - self.failUnless(type(b[0]) is str) - self.failUnlessEqual(b[0], "a") - self.failUnlessEqual(b[:], "abc\0") - - try: - c_wchar - except NameError: - pass - else: - def test_unicode_buffer(self): - b = create_unicode_buffer(32) - self.failUnlessEqual(len(b), 32) - self.failUnlessEqual(sizeof(b), 32 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) - - b = create_unicode_buffer(u"abc") - self.failUnlessEqual(len(b), 4) # trailing nul char - self.failUnlessEqual(sizeof(b), 4 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) - self.failUnlessEqual(b[0], u"a") - self.failUnlessEqual(b[:], "abc\0") - - def test_unicode_conversion(self): - b = create_unicode_buffer("abc") - self.failUnlessEqual(len(b), 4) # trailing nul char - self.failUnlessEqual(sizeof(b), 4 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) - self.failUnlessEqual(b[0], u"a") - self.failUnlessEqual(b[:], "abc\0") - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_byteswap.py b/sys/lib/python/ctypes/test/test_byteswap.py deleted file mode 100644 index 1f6899212..000000000 --- a/sys/lib/python/ctypes/test/test_byteswap.py +++ /dev/null @@ -1,280 +0,0 @@ -import sys, unittest, struct, math -from binascii import hexlify - -from ctypes import * - -def bin(s): - return hexlify(buffer(s)).upper() - -# Each *simple* type that supports different byte orders has an -# __ctype_be__ attribute that specifies the same type in BIG ENDIAN -# byte order, and a __ctype_le__ attribute that is the same type in -# LITTLE ENDIAN byte order. -# -# For Structures and Unions, these types are created on demand. - -class Test(unittest.TestCase): - def X_test(self): - print >> sys.stderr, sys.byteorder - for i in range(32): - bits = BITS() - setattr(bits, "i%s" % i, 1) - dump(bits) - - def test_endian_short(self): - if sys.byteorder == "little": - self.failUnless(c_short.__ctype_le__ is c_short) - self.failUnless(c_short.__ctype_be__.__ctype_le__ is c_short) - else: - self.failUnless(c_short.__ctype_be__ is c_short) - self.failUnless(c_short.__ctype_le__.__ctype_be__ is c_short) - s = c_short.__ctype_be__(0x1234) - self.failUnlessEqual(bin(struct.pack(">h", 0x1234)), "1234") - self.failUnlessEqual(bin(s), "1234") - self.failUnlessEqual(s.value, 0x1234) - - s = c_short.__ctype_le__(0x1234) - self.failUnlessEqual(bin(struct.pack("<h", 0x1234)), "3412") - self.failUnlessEqual(bin(s), "3412") - self.failUnlessEqual(s.value, 0x1234) - - s = c_ushort.__ctype_be__(0x1234) - self.failUnlessEqual(bin(struct.pack(">h", 0x1234)), "1234") - self.failUnlessEqual(bin(s), "1234") - self.failUnlessEqual(s.value, 0x1234) - - s = c_ushort.__ctype_le__(0x1234) - self.failUnlessEqual(bin(struct.pack("<h", 0x1234)), "3412") - self.failUnlessEqual(bin(s), "3412") - self.failUnlessEqual(s.value, 0x1234) - - def test_endian_int(self): - if sys.byteorder == "little": - self.failUnless(c_int.__ctype_le__ is c_int) - self.failUnless(c_int.__ctype_be__.__ctype_le__ is c_int) - else: - self.failUnless(c_int.__ctype_be__ is c_int) - self.failUnless(c_int.__ctype_le__.__ctype_be__ is c_int) - - s = c_int.__ctype_be__(0x12345678) - self.failUnlessEqual(bin(struct.pack(">i", 0x12345678)), "12345678") - self.failUnlessEqual(bin(s), "12345678") - self.failUnlessEqual(s.value, 0x12345678) - - s = c_int.__ctype_le__(0x12345678) - self.failUnlessEqual(bin(struct.pack("<i", 0x12345678)), "78563412") - self.failUnlessEqual(bin(s), "78563412") - self.failUnlessEqual(s.value, 0x12345678) - - s = c_uint.__ctype_be__(0x12345678) - self.failUnlessEqual(bin(struct.pack(">I", 0x12345678)), "12345678") - self.failUnlessEqual(bin(s), "12345678") - self.failUnlessEqual(s.value, 0x12345678) - - s = c_uint.__ctype_le__(0x12345678) - self.failUnlessEqual(bin(struct.pack("<I", 0x12345678)), "78563412") - self.failUnlessEqual(bin(s), "78563412") - self.failUnlessEqual(s.value, 0x12345678) - - def test_endian_longlong(self): - if sys.byteorder == "little": - self.failUnless(c_longlong.__ctype_le__ is c_longlong) - self.failUnless(c_longlong.__ctype_be__.__ctype_le__ is c_longlong) - else: - self.failUnless(c_longlong.__ctype_be__ is c_longlong) - self.failUnless(c_longlong.__ctype_le__.__ctype_be__ is c_longlong) - - s = c_longlong.__ctype_be__(0x1234567890ABCDEF) - self.failUnlessEqual(bin(struct.pack(">q", 0x1234567890ABCDEF)), "1234567890ABCDEF") - self.failUnlessEqual(bin(s), "1234567890ABCDEF") - self.failUnlessEqual(s.value, 0x1234567890ABCDEF) - - s = c_longlong.__ctype_le__(0x1234567890ABCDEF) - self.failUnlessEqual(bin(struct.pack("<q", 0x1234567890ABCDEF)), "EFCDAB9078563412") - self.failUnlessEqual(bin(s), "EFCDAB9078563412") - self.failUnlessEqual(s.value, 0x1234567890ABCDEF) - - s = c_ulonglong.__ctype_be__(0x1234567890ABCDEF) - self.failUnlessEqual(bin(struct.pack(">Q", 0x1234567890ABCDEF)), "1234567890ABCDEF") - self.failUnlessEqual(bin(s), "1234567890ABCDEF") - self.failUnlessEqual(s.value, 0x1234567890ABCDEF) - - s = c_ulonglong.__ctype_le__(0x1234567890ABCDEF) - self.failUnlessEqual(bin(struct.pack("<Q", 0x1234567890ABCDEF)), "EFCDAB9078563412") - self.failUnlessEqual(bin(s), "EFCDAB9078563412") - self.failUnlessEqual(s.value, 0x1234567890ABCDEF) - - def test_endian_float(self): - if sys.byteorder == "little": - self.failUnless(c_float.__ctype_le__ is c_float) - self.failUnless(c_float.__ctype_be__.__ctype_le__ is c_float) - else: - self.failUnless(c_float.__ctype_be__ is c_float) - self.failUnless(c_float.__ctype_le__.__ctype_be__ is c_float) - s = c_float(math.pi) - self.failUnlessEqual(bin(struct.pack("f", math.pi)), bin(s)) - # Hm, what's the precision of a float compared to a double? - self.failUnlessAlmostEqual(s.value, math.pi, 6) - s = c_float.__ctype_le__(math.pi) - self.failUnlessAlmostEqual(s.value, math.pi, 6) - self.failUnlessEqual(bin(struct.pack("<f", math.pi)), bin(s)) - s = c_float.__ctype_be__(math.pi) - self.failUnlessAlmostEqual(s.value, math.pi, 6) - self.failUnlessEqual(bin(struct.pack(">f", math.pi)), bin(s)) - - def test_endian_double(self): - if sys.byteorder == "little": - self.failUnless(c_double.__ctype_le__ is c_double) - self.failUnless(c_double.__ctype_be__.__ctype_le__ is c_double) - else: - self.failUnless(c_double.__ctype_be__ is c_double) - self.failUnless(c_double.__ctype_le__.__ctype_be__ is c_double) - s = c_double(math.pi) - self.failUnlessEqual(s.value, math.pi) - self.failUnlessEqual(bin(struct.pack("d", math.pi)), bin(s)) - s = c_double.__ctype_le__(math.pi) - self.failUnlessEqual(s.value, math.pi) - self.failUnlessEqual(bin(struct.pack("<d", math.pi)), bin(s)) - s = c_double.__ctype_be__(math.pi) - self.failUnlessEqual(s.value, math.pi) - self.failUnlessEqual(bin(struct.pack(">d", math.pi)), bin(s)) - - def test_endian_other(self): - self.failUnless(c_byte.__ctype_le__ is c_byte) - self.failUnless(c_byte.__ctype_be__ is c_byte) - - self.failUnless(c_ubyte.__ctype_le__ is c_ubyte) - self.failUnless(c_ubyte.__ctype_be__ is c_ubyte) - - self.failUnless(c_char.__ctype_le__ is c_char) - self.failUnless(c_char.__ctype_be__ is c_char) - - def test_struct_fields_1(self): - if sys.byteorder == "little": - base = BigEndianStructure - else: - base = LittleEndianStructure - - class T(base): - pass - _fields_ = [("a", c_ubyte), - ("b", c_byte), - ("c", c_short), - ("d", c_ushort), - ("e", c_int), - ("f", c_uint), - ("g", c_long), - ("h", c_ulong), - ("i", c_longlong), - ("k", c_ulonglong), - ("l", c_float), - ("m", c_double), - ("n", c_char), - - ("b1", c_byte, 3), - ("b2", c_byte, 3), - ("b3", c_byte, 2), - ("a", c_int * 3 * 3 * 3)] - T._fields_ = _fields_ - - # these fields do not support different byte order: - for typ in c_wchar, c_void_p, POINTER(c_int): - _fields_.append(("x", typ)) - class T(base): - pass - self.assertRaises(TypeError, setattr, T, "_fields_", [("x", typ)]) - - def test_struct_struct(self): - # Nested structures with different byte order not (yet) supported - if sys.byteorder == "little": - base = BigEndianStructure - else: - base = LittleEndianStructure - - class T(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - class S(base): - pass - self.assertRaises(TypeError, setattr, S, "_fields_", [("s", T)]) - - def test_struct_fields_2(self): - # standard packing in struct uses no alignment. - # So, we have to align using pad bytes. - # - # Unaligned accesses will crash Python (on those platforms that - # don't allow it, like sparc solaris). - if sys.byteorder == "little": - base = BigEndianStructure - fmt = ">bxhid" - else: - base = LittleEndianStructure - fmt = "<bxhid" - - class S(base): - _fields_ = [("b", c_byte), - ("h", c_short), - ("i", c_int), - ("d", c_double)] - - s1 = S(0x12, 0x1234, 0x12345678, 3.14) - s2 = struct.pack(fmt, 0x12, 0x1234, 0x12345678, 3.14) - self.failUnlessEqual(bin(s1), bin(s2)) - - def test_unaligned_nonnative_struct_fields(self): - if sys.byteorder == "little": - base = BigEndianStructure - fmt = ">b h xi xd" - else: - base = LittleEndianStructure - fmt = "<b h xi xd" - - class S(base): - _pack_ = 1 - _fields_ = [("b", c_byte), - - ("h", c_short), - - ("_1", c_byte), - ("i", c_int), - - ("_2", c_byte), - ("d", c_double)] - - s1 = S() - s1.b = 0x12 - s1.h = 0x1234 - s1.i = 0x12345678 - s1.d = 3.14 - s2 = struct.pack(fmt, 0x12, 0x1234, 0x12345678, 3.14) - self.failUnlessEqual(bin(s1), bin(s2)) - - def test_unaligned_native_struct_fields(self): - if sys.byteorder == "little": - fmt = "<b h xi xd" - else: - base = LittleEndianStructure - fmt = ">b h xi xd" - - class S(Structure): - _pack_ = 1 - _fields_ = [("b", c_byte), - - ("h", c_short), - - ("_1", c_byte), - ("i", c_int), - - ("_2", c_byte), - ("d", c_double)] - - s1 = S() - s1.b = 0x12 - s1.h = 0x1234 - s1.i = 0x12345678 - s1.d = 3.14 - s2 = struct.pack(fmt, 0x12, 0x1234, 0x12345678, 3.14) - self.failUnlessEqual(bin(s1), bin(s2)) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_callbacks.py b/sys/lib/python/ctypes/test/test_callbacks.py deleted file mode 100644 index f47fc37b3..000000000 --- a/sys/lib/python/ctypes/test/test_callbacks.py +++ /dev/null @@ -1,152 +0,0 @@ -import unittest -from ctypes import * -import _ctypes_test - -class Callbacks(unittest.TestCase): - functype = CFUNCTYPE - -## def tearDown(self): -## import gc -## gc.collect() - - def callback(self, *args): - self.got_args = args - return args[-1] - - def check_type(self, typ, arg): - PROTO = self.functype.im_func(typ, typ) - result = PROTO(self.callback)(arg) - if typ == c_float: - self.failUnlessAlmostEqual(result, arg, places=5) - else: - self.failUnlessEqual(self.got_args, (arg,)) - self.failUnlessEqual(result, arg) - - PROTO = self.functype.im_func(typ, c_byte, typ) - result = PROTO(self.callback)(-3, arg) - if typ == c_float: - self.failUnlessAlmostEqual(result, arg, places=5) - else: - self.failUnlessEqual(self.got_args, (-3, arg)) - self.failUnlessEqual(result, arg) - - ################ - - def test_byte(self): - self.check_type(c_byte, 42) - self.check_type(c_byte, -42) - - def test_ubyte(self): - self.check_type(c_ubyte, 42) - - def test_short(self): - self.check_type(c_short, 42) - self.check_type(c_short, -42) - - def test_ushort(self): - self.check_type(c_ushort, 42) - - def test_int(self): - self.check_type(c_int, 42) - self.check_type(c_int, -42) - - def test_uint(self): - self.check_type(c_uint, 42) - - def test_long(self): - self.check_type(c_long, 42) - self.check_type(c_long, -42) - - def test_ulong(self): - self.check_type(c_ulong, 42) - - def test_longlong(self): - self.check_type(c_longlong, 42) - self.check_type(c_longlong, -42) - - def test_ulonglong(self): - self.check_type(c_ulonglong, 42) - - def test_float(self): - # only almost equal: double -> float -> double - import math - self.check_type(c_float, math.e) - self.check_type(c_float, -math.e) - - def test_double(self): - self.check_type(c_double, 3.14) - self.check_type(c_double, -3.14) - - def test_char(self): - self.check_type(c_char, "x") - self.check_type(c_char, "a") - - # disabled: would now (correctly) raise a RuntimeWarning about - # a memory leak. A callback function cannot return a non-integral - # C type without causing a memory leak. -## def test_char_p(self): -## self.check_type(c_char_p, "abc") -## self.check_type(c_char_p, "def") - - def test_pyobject(self): - o = () - from sys import getrefcount as grc - for o in (), [], object(): - initial = grc(o) - # This call leaks a reference to 'o'... - self.check_type(py_object, o) - before = grc(o) - # ...but this call doesn't leak any more. Where is the refcount? - self.check_type(py_object, o) - after = grc(o) - self.failUnlessEqual((after, o), (before, o)) - - def test_unsupported_restype_1(self): - # Only "fundamental" result types are supported for callback - # functions, the type must have a non-NULL stgdict->setfunc. - # POINTER(c_double), for example, is not supported. - - prototype = self.functype.im_func(POINTER(c_double)) - # The type is checked when the prototype is called - self.assertRaises(TypeError, prototype, lambda: None) - - def test_unsupported_restype_2(self): - prototype = self.functype.im_func(object) - self.assertRaises(TypeError, prototype, lambda: None) - -try: - WINFUNCTYPE -except NameError: - pass -else: - class StdcallCallbacks(Callbacks): - functype = WINFUNCTYPE - -################################################################ - -class SampleCallbacksTestCase(unittest.TestCase): - - def test_integrate(self): - # Derived from some then non-working code, posted by David Foster - dll = CDLL(_ctypes_test.__file__) - - # The function prototype called by 'integrate': double func(double); - CALLBACK = CFUNCTYPE(c_double, c_double) - - # The integrate function itself, exposed from the _ctypes_test dll - integrate = dll.integrate - integrate.argtypes = (c_double, c_double, CALLBACK, c_long) - integrate.restype = c_double - - def func(x): - return x**2 - - result = integrate(0.0, 1.0, CALLBACK(func), 10) - diff = abs(result - 1./3.) - - self.failUnless(diff < 0.01, "%s not less than 0.01" % diff) - -################################################################ - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_cast.py b/sys/lib/python/ctypes/test/test_cast.py deleted file mode 100644 index 7371b0fe2..000000000 --- a/sys/lib/python/ctypes/test/test_cast.py +++ /dev/null @@ -1,77 +0,0 @@ -from ctypes import * -import unittest -import sys - -class Test(unittest.TestCase): - - def test_array2pointer(self): - array = (c_int * 3)(42, 17, 2) - - # casting an array to a pointer works. - ptr = cast(array, POINTER(c_int)) - self.failUnlessEqual([ptr[i] for i in range(3)], [42, 17, 2]) - - if 2*sizeof(c_short) == sizeof(c_int): - ptr = cast(array, POINTER(c_short)) - if sys.byteorder == "little": - self.failUnlessEqual([ptr[i] for i in range(6)], - [42, 0, 17, 0, 2, 0]) - else: - self.failUnlessEqual([ptr[i] for i in range(6)], - [0, 42, 0, 17, 0, 2]) - - def test_address2pointer(self): - array = (c_int * 3)(42, 17, 2) - - address = addressof(array) - ptr = cast(c_void_p(address), POINTER(c_int)) - self.failUnlessEqual([ptr[i] for i in range(3)], [42, 17, 2]) - - ptr = cast(address, POINTER(c_int)) - self.failUnlessEqual([ptr[i] for i in range(3)], [42, 17, 2]) - - def test_p2a_objects(self): - array = (c_char_p * 5)() - self.failUnlessEqual(array._objects, None) - array[0] = "foo bar" - self.failUnlessEqual(array._objects, {'0': "foo bar"}) - - p = cast(array, POINTER(c_char_p)) - # array and p share a common _objects attribute - self.failUnless(p._objects is array._objects) - self.failUnlessEqual(array._objects, {'0': "foo bar", id(array): array}) - p[0] = "spam spam" - self.failUnlessEqual(p._objects, {'0': "spam spam", id(array): array}) - self.failUnless(array._objects is p._objects) - p[1] = "foo bar" - self.failUnlessEqual(p._objects, {'1': 'foo bar', '0': "spam spam", id(array): array}) - self.failUnless(array._objects is p._objects) - - def test_other(self): - p = cast((c_int * 4)(1, 2, 3, 4), POINTER(c_int)) - self.failUnlessEqual(p[:4], [1,2, 3, 4]) - c_int() - self.failUnlessEqual(p[:4], [1, 2, 3, 4]) - p[2] = 96 - self.failUnlessEqual(p[:4], [1, 2, 96, 4]) - c_int() - self.failUnlessEqual(p[:4], [1, 2, 96, 4]) - - def test_char_p(self): - # This didn't work: bad argument to internal function - s = c_char_p("hiho") - self.failUnlessEqual(cast(cast(s, c_void_p), c_char_p).value, - "hiho") - - try: - c_wchar_p - except NameError: - pass - else: - def test_wchar_p(self): - s = c_wchar_p("hiho") - self.failUnlessEqual(cast(cast(s, c_void_p), c_wchar_p).value, - "hiho") - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_cfuncs.py b/sys/lib/python/ctypes/test/test_cfuncs.py deleted file mode 100644 index fa858a661..000000000 --- a/sys/lib/python/ctypes/test/test_cfuncs.py +++ /dev/null @@ -1,199 +0,0 @@ -# A lot of failures in these tests on Mac OS X. -# Byte order related? - -import unittest -from ctypes import * - -import _ctypes_test - -class CFunctions(unittest.TestCase): - _dll = CDLL(_ctypes_test.__file__) - - def S(self): - return c_longlong.in_dll(self._dll, "last_tf_arg_s").value - def U(self): - return c_ulonglong.in_dll(self._dll, "last_tf_arg_u").value - - def test_byte(self): - self._dll.tf_b.restype = c_byte - self._dll.tf_b.argtypes = (c_byte,) - self.failUnlessEqual(self._dll.tf_b(-126), -42) - self.failUnlessEqual(self.S(), -126) - - def test_byte_plus(self): - self._dll.tf_bb.restype = c_byte - self._dll.tf_bb.argtypes = (c_byte, c_byte) - self.failUnlessEqual(self._dll.tf_bb(0, -126), -42) - self.failUnlessEqual(self.S(), -126) - - def test_ubyte(self): - self._dll.tf_B.restype = c_ubyte - self._dll.tf_B.argtypes = (c_ubyte,) - self.failUnlessEqual(self._dll.tf_B(255), 85) - self.failUnlessEqual(self.U(), 255) - - def test_ubyte_plus(self): - self._dll.tf_bB.restype = c_ubyte - self._dll.tf_bB.argtypes = (c_byte, c_ubyte) - self.failUnlessEqual(self._dll.tf_bB(0, 255), 85) - self.failUnlessEqual(self.U(), 255) - - def test_short(self): - self._dll.tf_h.restype = c_short - self._dll.tf_h.argtypes = (c_short,) - self.failUnlessEqual(self._dll.tf_h(-32766), -10922) - self.failUnlessEqual(self.S(), -32766) - - def test_short_plus(self): - self._dll.tf_bh.restype = c_short - self._dll.tf_bh.argtypes = (c_byte, c_short) - self.failUnlessEqual(self._dll.tf_bh(0, -32766), -10922) - self.failUnlessEqual(self.S(), -32766) - - def test_ushort(self): - self._dll.tf_H.restype = c_ushort - self._dll.tf_H.argtypes = (c_ushort,) - self.failUnlessEqual(self._dll.tf_H(65535), 21845) - self.failUnlessEqual(self.U(), 65535) - - def test_ushort_plus(self): - self._dll.tf_bH.restype = c_ushort - self._dll.tf_bH.argtypes = (c_byte, c_ushort) - self.failUnlessEqual(self._dll.tf_bH(0, 65535), 21845) - self.failUnlessEqual(self.U(), 65535) - - def test_int(self): - self._dll.tf_i.restype = c_int - self._dll.tf_i.argtypes = (c_int,) - self.failUnlessEqual(self._dll.tf_i(-2147483646), -715827882) - self.failUnlessEqual(self.S(), -2147483646) - - def test_int_plus(self): - self._dll.tf_bi.restype = c_int - self._dll.tf_bi.argtypes = (c_byte, c_int) - self.failUnlessEqual(self._dll.tf_bi(0, -2147483646), -715827882) - self.failUnlessEqual(self.S(), -2147483646) - - def test_uint(self): - self._dll.tf_I.restype = c_uint - self._dll.tf_I.argtypes = (c_uint,) - self.failUnlessEqual(self._dll.tf_I(4294967295), 1431655765) - self.failUnlessEqual(self.U(), 4294967295) - - def test_uint_plus(self): - self._dll.tf_bI.restype = c_uint - self._dll.tf_bI.argtypes = (c_byte, c_uint) - self.failUnlessEqual(self._dll.tf_bI(0, 4294967295), 1431655765) - self.failUnlessEqual(self.U(), 4294967295) - - def test_long(self): - self._dll.tf_l.restype = c_long - self._dll.tf_l.argtypes = (c_long,) - self.failUnlessEqual(self._dll.tf_l(-2147483646), -715827882) - self.failUnlessEqual(self.S(), -2147483646) - - def test_long_plus(self): - self._dll.tf_bl.restype = c_long - self._dll.tf_bl.argtypes = (c_byte, c_long) - self.failUnlessEqual(self._dll.tf_bl(0, -2147483646), -715827882) - self.failUnlessEqual(self.S(), -2147483646) - - def test_ulong(self): - self._dll.tf_L.restype = c_ulong - self._dll.tf_L.argtypes = (c_ulong,) - self.failUnlessEqual(self._dll.tf_L(4294967295), 1431655765) - self.failUnlessEqual(self.U(), 4294967295) - - def test_ulong_plus(self): - self._dll.tf_bL.restype = c_ulong - self._dll.tf_bL.argtypes = (c_char, c_ulong) - self.failUnlessEqual(self._dll.tf_bL(' ', 4294967295), 1431655765) - self.failUnlessEqual(self.U(), 4294967295) - - def test_longlong(self): - self._dll.tf_q.restype = c_longlong - self._dll.tf_q.argtypes = (c_longlong, ) - self.failUnlessEqual(self._dll.tf_q(-9223372036854775806), -3074457345618258602) - self.failUnlessEqual(self.S(), -9223372036854775806) - - def test_longlong_plus(self): - self._dll.tf_bq.restype = c_longlong - self._dll.tf_bq.argtypes = (c_byte, c_longlong) - self.failUnlessEqual(self._dll.tf_bq(0, -9223372036854775806), -3074457345618258602) - self.failUnlessEqual(self.S(), -9223372036854775806) - - def test_ulonglong(self): - self._dll.tf_Q.restype = c_ulonglong - self._dll.tf_Q.argtypes = (c_ulonglong, ) - self.failUnlessEqual(self._dll.tf_Q(18446744073709551615), 6148914691236517205) - self.failUnlessEqual(self.U(), 18446744073709551615) - - def test_ulonglong_plus(self): - self._dll.tf_bQ.restype = c_ulonglong - self._dll.tf_bQ.argtypes = (c_byte, c_ulonglong) - self.failUnlessEqual(self._dll.tf_bQ(0, 18446744073709551615), 6148914691236517205) - self.failUnlessEqual(self.U(), 18446744073709551615) - - def test_float(self): - self._dll.tf_f.restype = c_float - self._dll.tf_f.argtypes = (c_float,) - self.failUnlessEqual(self._dll.tf_f(-42.), -14.) - self.failUnlessEqual(self.S(), -42) - - def test_float_plus(self): - self._dll.tf_bf.restype = c_float - self._dll.tf_bf.argtypes = (c_byte, c_float) - self.failUnlessEqual(self._dll.tf_bf(0, -42.), -14.) - self.failUnlessEqual(self.S(), -42) - - def test_double(self): - self._dll.tf_d.restype = c_double - self._dll.tf_d.argtypes = (c_double,) - self.failUnlessEqual(self._dll.tf_d(42.), 14.) - self.failUnlessEqual(self.S(), 42) - - def test_double_plus(self): - self._dll.tf_bd.restype = c_double - self._dll.tf_bd.argtypes = (c_byte, c_double) - self.failUnlessEqual(self._dll.tf_bd(0, 42.), 14.) - self.failUnlessEqual(self.S(), 42) - - def test_callwithresult(self): - def process_result(result): - return result * 2 - self._dll.tf_i.restype = process_result - self._dll.tf_i.argtypes = (c_int,) - self.failUnlessEqual(self._dll.tf_i(42), 28) - self.failUnlessEqual(self.S(), 42) - self.failUnlessEqual(self._dll.tf_i(-42), -28) - self.failUnlessEqual(self.S(), -42) - - def test_void(self): - self._dll.tv_i.restype = None - self._dll.tv_i.argtypes = (c_int,) - self.failUnlessEqual(self._dll.tv_i(42), None) - self.failUnlessEqual(self.S(), 42) - self.failUnlessEqual(self._dll.tv_i(-42), None) - self.failUnlessEqual(self.S(), -42) - -# The following repeates the above tests with stdcall functions (where -# they are available) -try: - WinDLL -except NameError: - pass -else: - class stdcall_dll(WinDLL): - def __getattr__(self, name): - if name[:2] == '__' and name[-2:] == '__': - raise AttributeError, name - func = self._FuncPtr(("s_" + name, self)) - setattr(self, name, func) - return func - - class stdcallCFunctions(CFunctions): - _dll = stdcall_dll(_ctypes_test.__file__) - pass - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_checkretval.py b/sys/lib/python/ctypes/test/test_checkretval.py deleted file mode 100644 index e055c49a3..000000000 --- a/sys/lib/python/ctypes/test/test_checkretval.py +++ /dev/null @@ -1,40 +0,0 @@ -import unittest -import sys - -from ctypes import * - -class CHECKED(c_int): - def _check_retval_(value): - # Receives a CHECKED instance. - return str(value.value) - _check_retval_ = staticmethod(_check_retval_) - -class Test(unittest.TestCase): - - def test_checkretval(self): - - import _ctypes_test - dll = CDLL(_ctypes_test.__file__) - self.failUnlessEqual(42, dll._testfunc_p_p(42)) - - dll._testfunc_p_p.restype = CHECKED - self.failUnlessEqual("42", dll._testfunc_p_p(42)) - - dll._testfunc_p_p.restype = None - self.failUnlessEqual(None, dll._testfunc_p_p(42)) - - del dll._testfunc_p_p.restype - self.failUnlessEqual(42, dll._testfunc_p_p(42)) - - try: - oledll - except NameError: - pass - else: - def test_oledll(self): - self.failUnlessRaises(WindowsError, - oledll.oleaut32.CreateTypeLib2, - 0, 0, 0) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_errcheck.py b/sys/lib/python/ctypes/test/test_errcheck.py deleted file mode 100644 index a4913f920..000000000 --- a/sys/lib/python/ctypes/test/test_errcheck.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -from ctypes import * - -##class HMODULE(Structure): -## _fields_ = [("value", c_void_p)] - -## def __repr__(self): -## return "<HMODULE %s>" % self.value - -##windll.kernel32.GetModuleHandleA.restype = HMODULE - -##print windll.kernel32.GetModuleHandleA("python23.dll") -##print hex(sys.dllhandle) - -##def nonzero(handle): -## return (GetLastError(), handle) - -##windll.kernel32.GetModuleHandleA.errcheck = nonzero -##print windll.kernel32.GetModuleHandleA("spam") diff --git a/sys/lib/python/ctypes/test/test_find.py b/sys/lib/python/ctypes/test/test_find.py deleted file mode 100644 index 810467faa..000000000 --- a/sys/lib/python/ctypes/test/test_find.py +++ /dev/null @@ -1,104 +0,0 @@ -import unittest -import os, sys -from ctypes import * -from ctypes.util import find_library -from ctypes.test import is_resource_enabled - -if sys.platform == "win32": - lib_gl = find_library("OpenGL32") - lib_glu = find_library("Glu32") - lib_glut = find_library("glut32") - lib_gle = None -elif sys.platform == "darwin": - lib_gl = lib_glu = find_library("OpenGL") - lib_glut = find_library("GLUT") - lib_gle = None -else: - lib_gl = find_library("GL") - lib_glu = find_library("GLU") - lib_glut = find_library("glut") - lib_gle = find_library("gle") - -## print, for debugging -if is_resource_enabled("printing"): - if lib_gl or lib_glu or lib_glut or lib_gle: - print "OpenGL libraries:" - for item in (("GL", lib_gl), - ("GLU", lib_glu), - ("glut", lib_glut), - ("gle", lib_gle)): - print "\t", item - - -# On some systems, loading the OpenGL libraries needs the RTLD_GLOBAL mode. -class Test_OpenGL_libs(unittest.TestCase): - def setUp(self): - self.gl = self.glu = self.gle = self.glut = None - if lib_gl: - self.gl = CDLL(lib_gl, mode=RTLD_GLOBAL) - if lib_glu: - self.glu = CDLL(lib_glu, RTLD_GLOBAL) - if lib_glut: - # On some systems, additional libraries seem to be - # required, loading glut fails with - # "OSError: /usr/lib/libglut.so.3: undefined symbol: XGetExtensionVersion" - # I cannot figure out how to repair the test on these - # systems (red hat), so we ignore it when the glut or gle - # libraries cannot be loaded. See also: - # https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1478253&group_id=5470 - # http://mail.python.org/pipermail/python-dev/2006-May/064789.html - try: - self.glut = CDLL(lib_glut) - except OSError: - pass - if lib_gle: - try: - self.gle = CDLL(lib_gle) - except OSError: - pass - - if lib_gl: - def test_gl(self): - if self.gl: - self.gl.glClearIndex - - if lib_glu: - def test_glu(self): - if self.glu: - self.glu.gluBeginCurve - - if lib_glut: - def test_glut(self): - if self.glut: - self.glut.glutWireTetrahedron - - if lib_gle: - def test_gle(self): - if self.gle: - self.gle.gleGetJoinStyle - -##if os.name == "posix" and sys.platform != "darwin": - -## # On platforms where the default shared library suffix is '.so', -## # at least some libraries can be loaded as attributes of the cdll -## # object, since ctypes now tries loading the lib again -## # with '.so' appended of the first try fails. -## # -## # Won't work for libc, unfortunately. OTOH, it isn't -## # needed for libc since this is already mapped into the current -## # process (?) -## # -## # On MAC OSX, it won't work either, because dlopen() needs a full path, -## # and the default suffix is either none or '.dylib'. - -## class LoadLibs(unittest.TestCase): -## def test_libm(self): -## import math -## libm = cdll.libm -## sqrt = libm.sqrt -## sqrt.argtypes = (c_double,) -## sqrt.restype = c_double -## self.failUnlessEqual(sqrt(2), math.sqrt(2)) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_funcptr.py b/sys/lib/python/ctypes/test/test_funcptr.py deleted file mode 100644 index 7ea873f0a..000000000 --- a/sys/lib/python/ctypes/test/test_funcptr.py +++ /dev/null @@ -1,127 +0,0 @@ -import os, unittest -from ctypes import * - -try: - WINFUNCTYPE -except NameError: - # fake to enable this test on Linux - WINFUNCTYPE = CFUNCTYPE - -import _ctypes_test -lib = CDLL(_ctypes_test.__file__) - -class CFuncPtrTestCase(unittest.TestCase): - def test_basic(self): - X = WINFUNCTYPE(c_int, c_int, c_int) - - def func(*args): - return len(args) - - x = X(func) - self.failUnlessEqual(x.restype, c_int) - self.failUnlessEqual(x.argtypes, (c_int, c_int)) - self.failUnlessEqual(sizeof(x), sizeof(c_voidp)) - self.failUnlessEqual(sizeof(X), sizeof(c_voidp)) - - def test_first(self): - StdCallback = WINFUNCTYPE(c_int, c_int, c_int) - CdeclCallback = CFUNCTYPE(c_int, c_int, c_int) - - def func(a, b): - return a + b - - s = StdCallback(func) - c = CdeclCallback(func) - - self.failUnlessEqual(s(1, 2), 3) - self.failUnlessEqual(c(1, 2), 3) - # The following no longer raises a TypeError - it is now - # possible, as in C, to call cdecl functions with more parameters. - #self.assertRaises(TypeError, c, 1, 2, 3) - self.failUnlessEqual(c(1, 2, 3, 4, 5, 6), 3) - if not WINFUNCTYPE is CFUNCTYPE and os.name != "ce": - self.assertRaises(TypeError, s, 1, 2, 3) - - def test_structures(self): - WNDPROC = WINFUNCTYPE(c_long, c_int, c_int, c_int, c_int) - - def wndproc(hwnd, msg, wParam, lParam): - return hwnd + msg + wParam + lParam - - HINSTANCE = c_int - HICON = c_int - HCURSOR = c_int - LPCTSTR = c_char_p - - class WNDCLASS(Structure): - _fields_ = [("style", c_uint), - ("lpfnWndProc", WNDPROC), - ("cbClsExtra", c_int), - ("cbWndExtra", c_int), - ("hInstance", HINSTANCE), - ("hIcon", HICON), - ("hCursor", HCURSOR), - ("lpszMenuName", LPCTSTR), - ("lpszClassName", LPCTSTR)] - - wndclass = WNDCLASS() - wndclass.lpfnWndProc = WNDPROC(wndproc) - - WNDPROC_2 = WINFUNCTYPE(c_long, c_int, c_int, c_int, c_int) - - # This is no longer true, now that WINFUNCTYPE caches created types internally. - ## # CFuncPtr subclasses are compared by identity, so this raises a TypeError: - ## self.assertRaises(TypeError, setattr, wndclass, - ## "lpfnWndProc", WNDPROC_2(wndproc)) - # instead: - - self.failUnless(WNDPROC is WNDPROC_2) - # 'wndclass.lpfnWndProc' leaks 94 references. Why? - self.failUnlessEqual(wndclass.lpfnWndProc(1, 2, 3, 4), 10) - - - f = wndclass.lpfnWndProc - - del wndclass - del wndproc - - self.failUnlessEqual(f(10, 11, 12, 13), 46) - - def test_dllfunctions(self): - - def NoNullHandle(value): - if not value: - raise WinError() - return value - - strchr = lib.my_strchr - strchr.restype = c_char_p - strchr.argtypes = (c_char_p, c_char) - self.failUnlessEqual(strchr("abcdefghi", "b"), "bcdefghi") - self.failUnlessEqual(strchr("abcdefghi", "x"), None) - - - strtok = lib.my_strtok - strtok.restype = c_char_p - # Neither of this does work: strtok changes the buffer it is passed -## strtok.argtypes = (c_char_p, c_char_p) -## strtok.argtypes = (c_string, c_char_p) - - def c_string(init): - size = len(init) + 1 - return (c_char*size)(*init) - - s = "a\nb\nc" - b = c_string(s) - -## b = (c_char * (len(s)+1))() -## b.value = s - -## b = c_string(s) - self.failUnlessEqual(strtok(b, "\n"), "a") - self.failUnlessEqual(strtok(None, "\n"), "b") - self.failUnlessEqual(strtok(None, "\n"), "c") - self.failUnlessEqual(strtok(None, "\n"), None) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_functions.py b/sys/lib/python/ctypes/test/test_functions.py deleted file mode 100644 index 12bd59c4d..000000000 --- a/sys/lib/python/ctypes/test/test_functions.py +++ /dev/null @@ -1,395 +0,0 @@ -""" -Here is probably the place to write the docs, since the test-cases -show how the type behave. - -Later... -""" - -from ctypes import * -import sys, unittest - -try: - WINFUNCTYPE -except NameError: - # fake to enable this test on Linux - WINFUNCTYPE = CFUNCTYPE - -import _ctypes_test -dll = CDLL(_ctypes_test.__file__) -if sys.platform == "win32": - windll = WinDLL(_ctypes_test.__file__) - -class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] -class RECT(Structure): - _fields_ = [("left", c_int), ("top", c_int), - ("right", c_int), ("bottom", c_int)] -class FunctionTestCase(unittest.TestCase): - - def test_mro(self): - # in Python 2.3, this raises TypeError: MRO conflict among bases classes, - # in Python 2.2 it works. - # - # But in early versions of _ctypes.c, the result of tp_new - # wasn't checked, and it even crashed Python. - # Found by Greg Chapman. - - try: - class X(object, Array): - _length_ = 5 - _type_ = "i" - except TypeError: - pass - - - from _ctypes import _Pointer - try: - class X(object, _Pointer): - pass - except TypeError: - pass - - from _ctypes import _SimpleCData - try: - class X(object, _SimpleCData): - _type_ = "i" - except TypeError: - pass - - try: - class X(object, Structure): - _fields_ = [] - except TypeError: - pass - - - def test_wchar_parm(self): - try: - c_wchar - except NameError: - return - f = dll._testfunc_i_bhilfd - f.argtypes = [c_byte, c_wchar, c_int, c_long, c_float, c_double] - result = f(1, u"x", 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 139) - self.failUnlessEqual(type(result), int) - - def test_wchar_result(self): - try: - c_wchar - except NameError: - return - f = dll._testfunc_i_bhilfd - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] - f.restype = c_wchar - result = f(0, 0, 0, 0, 0, 0) - self.failUnlessEqual(result, u'\x00') - - def test_voidresult(self): - f = dll._testfunc_v - f.restype = None - f.argtypes = [c_int, c_int, POINTER(c_int)] - result = c_int() - self.failUnlessEqual(None, f(1, 2, byref(result))) - self.failUnlessEqual(result.value, 3) - - def test_intresult(self): - f = dll._testfunc_i_bhilfd - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] - f.restype = c_int - result = f(1, 2, 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 21) - self.failUnlessEqual(type(result), int) - - result = f(-1, -2, -3, -4, -5.0, -6.0) - self.failUnlessEqual(result, -21) - self.failUnlessEqual(type(result), int) - - # If we declare the function to return a short, - # is the high part split off? - f.restype = c_short - result = f(1, 2, 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 21) - self.failUnlessEqual(type(result), int) - - result = f(1, 2, 3, 0x10004, 5.0, 6.0) - self.failUnlessEqual(result, 21) - self.failUnlessEqual(type(result), int) - - # You cannot assing character format codes as restype any longer - self.assertRaises(TypeError, setattr, f, "restype", "i") - - def test_floatresult(self): - f = dll._testfunc_f_bhilfd - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] - f.restype = c_float - result = f(1, 2, 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 21) - self.failUnlessEqual(type(result), float) - - result = f(-1, -2, -3, -4, -5.0, -6.0) - self.failUnlessEqual(result, -21) - self.failUnlessEqual(type(result), float) - - def test_doubleresult(self): - f = dll._testfunc_d_bhilfd - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] - f.restype = c_double - result = f(1, 2, 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 21) - self.failUnlessEqual(type(result), float) - - result = f(-1, -2, -3, -4, -5.0, -6.0) - self.failUnlessEqual(result, -21) - self.failUnlessEqual(type(result), float) - - def test_longlongresult(self): - try: - c_longlong - except NameError: - return - f = dll._testfunc_q_bhilfd - f.restype = c_longlong - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] - result = f(1, 2, 3, 4, 5.0, 6.0) - self.failUnlessEqual(result, 21) - - f = dll._testfunc_q_bhilfdq - f.restype = c_longlong - f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double, c_longlong] - result = f(1, 2, 3, 4, 5.0, 6.0, 21) - self.failUnlessEqual(result, 42) - - def test_stringresult(self): - f = dll._testfunc_p_p - f.argtypes = None - f.restype = c_char_p - result = f("123") - self.failUnlessEqual(result, "123") - - result = f(None) - self.failUnlessEqual(result, None) - - def test_pointers(self): - f = dll._testfunc_p_p - f.restype = POINTER(c_int) - f.argtypes = [POINTER(c_int)] - - # This only works if the value c_int(42) passed to the - # function is still alive while the pointer (the result) is - # used. - - v = c_int(42) - - self.failUnlessEqual(pointer(v).contents.value, 42) - result = f(pointer(v)) - self.failUnlessEqual(type(result), POINTER(c_int)) - self.failUnlessEqual(result.contents.value, 42) - - # This on works... - result = f(pointer(v)) - self.failUnlessEqual(result.contents.value, v.value) - - p = pointer(c_int(99)) - result = f(p) - self.failUnlessEqual(result.contents.value, 99) - - arg = byref(v) - result = f(arg) - self.failIfEqual(result.contents, v.value) - - self.assertRaises(ArgumentError, f, byref(c_short(22))) - - # It is dangerous, however, because you don't control the lifetime - # of the pointer: - result = f(byref(c_int(99))) - self.failIfEqual(result.contents, 99) - - def test_errors(self): - f = dll._testfunc_p_p - f.restype = c_int - - class X(Structure): - _fields_ = [("y", c_int)] - - self.assertRaises(TypeError, f, X()) #cannot convert parameter - - ################################################################ - def test_shorts(self): - f = dll._testfunc_callback_i_if - - args = [] - expected = [262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, - 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1] - - def callback(v): - args.append(v) - return v - - CallBack = CFUNCTYPE(c_int, c_int) - - cb = CallBack(callback) - f(2**18, cb) - self.failUnlessEqual(args, expected) - - ################################################################ - - - def test_callbacks(self): - f = dll._testfunc_callback_i_if - f.restype = c_int - - MyCallback = CFUNCTYPE(c_int, c_int) - - def callback(value): - #print "called back with", value - return value - - cb = MyCallback(callback) - result = f(-10, cb) - self.failUnlessEqual(result, -18) - - # test with prototype - f.argtypes = [c_int, MyCallback] - cb = MyCallback(callback) - result = f(-10, cb) - self.failUnlessEqual(result, -18) - - AnotherCallback = WINFUNCTYPE(c_int, c_int, c_int, c_int, c_int) - - # check that the prototype works: we call f with wrong - # argument types - cb = AnotherCallback(callback) - self.assertRaises(ArgumentError, f, -10, cb) - - - def test_callbacks_2(self): - # Can also use simple datatypes as argument type specifiers - # for the callback function. - # In this case the call receives an instance of that type - f = dll._testfunc_callback_i_if - f.restype = c_int - - MyCallback = CFUNCTYPE(c_int, c_int) - - f.argtypes = [c_int, MyCallback] - - def callback(value): - #print "called back with", value - self.failUnlessEqual(type(value), int) - return value - - cb = MyCallback(callback) - result = f(-10, cb) - self.failUnlessEqual(result, -18) - - def test_longlong_callbacks(self): - - f = dll._testfunc_callback_q_qf - f.restype = c_longlong - - MyCallback = CFUNCTYPE(c_longlong, c_longlong) - - f.argtypes = [c_longlong, MyCallback] - - def callback(value): - self.failUnless(isinstance(value, (int, long))) - return value & 0x7FFFFFFF - - cb = MyCallback(callback) - - self.failUnlessEqual(13577625587, f(1000000000000, cb)) - - def test_errors(self): - self.assertRaises(AttributeError, getattr, dll, "_xxx_yyy") - self.assertRaises(ValueError, c_int.in_dll, dll, "_xxx_yyy") - - def test_byval(self): - - # without prototype - ptin = POINT(1, 2) - ptout = POINT() - # EXPORT int _testfunc_byval(point in, point *pout) - result = dll._testfunc_byval(ptin, byref(ptout)) - got = result, ptout.x, ptout.y - expected = 3, 1, 2 - self.failUnlessEqual(got, expected) - - # with prototype - ptin = POINT(101, 102) - ptout = POINT() - dll._testfunc_byval.argtypes = (POINT, POINTER(POINT)) - dll._testfunc_byval.restype = c_int - result = dll._testfunc_byval(ptin, byref(ptout)) - got = result, ptout.x, ptout.y - expected = 203, 101, 102 - self.failUnlessEqual(got, expected) - - def test_struct_return_2H(self): - class S2H(Structure): - _fields_ = [("x", c_short), - ("y", c_short)] - dll.ret_2h_func.restype = S2H - dll.ret_2h_func.argtypes = [S2H] - inp = S2H(99, 88) - s2h = dll.ret_2h_func(inp) - self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) - - if sys.platform == "win32": - def test_struct_return_2H_stdcall(self): - class S2H(Structure): - _fields_ = [("x", c_short), - ("y", c_short)] - - windll.s_ret_2h_func.restype = S2H - windll.s_ret_2h_func.argtypes = [S2H] - s2h = windll.s_ret_2h_func(S2H(99, 88)) - self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) - - def test_struct_return_8H(self): - class S8I(Structure): - _fields_ = [("a", c_int), - ("b", c_int), - ("c", c_int), - ("d", c_int), - ("e", c_int), - ("f", c_int), - ("g", c_int), - ("h", c_int)] - dll.ret_8i_func.restype = S8I - dll.ret_8i_func.argtypes = [S8I] - inp = S8I(9, 8, 7, 6, 5, 4, 3, 2) - s8i = dll.ret_8i_func(inp) - self.failUnlessEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), - (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) - - if sys.platform == "win32": - def test_struct_return_8H_stdcall(self): - class S8I(Structure): - _fields_ = [("a", c_int), - ("b", c_int), - ("c", c_int), - ("d", c_int), - ("e", c_int), - ("f", c_int), - ("g", c_int), - ("h", c_int)] - windll.s_ret_8i_func.restype = S8I - windll.s_ret_8i_func.argtypes = [S8I] - inp = S8I(9, 8, 7, 6, 5, 4, 3, 2) - s8i = windll.s_ret_8i_func(inp) - self.failUnlessEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), - (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) - - def test_sf1651235(self): - # see http://www.python.org/sf/1651235 - - proto = CFUNCTYPE(c_int, RECT, POINT) - def callback(*args): - return 0 - - callback = proto(callback) - self.failUnlessRaises(ArgumentError, lambda: callback((1, 2, 3, 4), POINT())) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_incomplete.py b/sys/lib/python/ctypes/test/test_incomplete.py deleted file mode 100644 index af9f504f7..000000000 --- a/sys/lib/python/ctypes/test/test_incomplete.py +++ /dev/null @@ -1,42 +0,0 @@ -import unittest -from ctypes import * - -################################################################ -# -# The incomplete pointer example from the tutorial -# - -class MyTestCase(unittest.TestCase): - - def test_incomplete_example(self): - lpcell = POINTER("cell") - class cell(Structure): - _fields_ = [("name", c_char_p), - ("next", lpcell)] - - SetPointerType(lpcell, cell) - - c1 = cell() - c1.name = "foo" - c2 = cell() - c2.name = "bar" - - c1.next = pointer(c2) - c2.next = pointer(c1) - - p = c1 - - result = [] - for i in range(8): - result.append(p.name) - p = p.next[0] - self.failUnlessEqual(result, ["foo", "bar"] * 4) - - # to not leak references, we must clean _pointer_type_cache - from ctypes import _pointer_type_cache - del _pointer_type_cache[cell] - -################################################################ - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_init.py b/sys/lib/python/ctypes/test/test_init.py deleted file mode 100644 index 3d9dc9210..000000000 --- a/sys/lib/python/ctypes/test/test_init.py +++ /dev/null @@ -1,40 +0,0 @@ -from ctypes import * -import unittest - -class X(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - new_was_called = False - - def __new__(cls): - result = super(X, cls).__new__(cls) - result.new_was_called = True - return result - - def __init__(self): - self.a = 9 - self.b = 12 - -class Y(Structure): - _fields_ = [("x", X)] - - -class InitTest(unittest.TestCase): - def test_get(self): - # make sure the only accessing a nested structure - # doesn't call the structure's __new__ and __init__ - y = Y() - self.failUnlessEqual((y.x.a, y.x.b), (0, 0)) - self.failUnlessEqual(y.x.new_was_called, False) - - # But explicitely creating an X structure calls __new__ and __init__, of course. - x = X() - self.failUnlessEqual((x.a, x.b), (9, 12)) - self.failUnlessEqual(x.new_was_called, True) - - y.x = x - self.failUnlessEqual((y.x.a, y.x.b), (9, 12)) - self.failUnlessEqual(y.x.new_was_called, False) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_integers.py b/sys/lib/python/ctypes/test/test_integers.py deleted file mode 100644 index 5b6453a00..000000000 --- a/sys/lib/python/ctypes/test/test_integers.py +++ /dev/null @@ -1,5 +0,0 @@ -# superseeded by test_numbers.py -import unittest - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_internals.py b/sys/lib/python/ctypes/test/test_internals.py deleted file mode 100644 index 04b204039..000000000 --- a/sys/lib/python/ctypes/test/test_internals.py +++ /dev/null @@ -1,103 +0,0 @@ -# This tests the internal _objects attribute -import unittest -from ctypes import * -from sys import getrefcount as grc - -# XXX This test must be reviewed for correctness!!! - -""" -ctypes' types are container types. - -They have an internal memory block, which only consists of some bytes, -but it has to keep references to other objects as well. This is not -really needed for trivial C types like int or char, but it is important -for aggregate types like strings or pointers in particular. - -What about pointers? - -""" - -class ObjectsTestCase(unittest.TestCase): - def failUnlessSame(self, a, b): - self.failUnlessEqual(id(a), id(b)) - - def test_ints(self): - i = 42000123 - self.failUnlessEqual(3, grc(i)) - ci = c_int(i) - self.failUnlessEqual(3, grc(i)) - self.failUnlessEqual(ci._objects, None) - - def test_c_char_p(self): - s = "Hello, World" - self.failUnlessEqual(3, grc(s)) - cs = c_char_p(s) - self.failUnlessEqual(4, grc(s)) - self.failUnlessSame(cs._objects, s) - - def test_simple_struct(self): - class X(Structure): - _fields_ = [("a", c_int), ("b", c_int)] - - a = 421234 - b = 421235 - x = X() - self.failUnlessEqual(x._objects, None) - x.a = a - x.b = b - self.failUnlessEqual(x._objects, None) - - def test_embedded_structs(self): - class X(Structure): - _fields_ = [("a", c_int), ("b", c_int)] - - class Y(Structure): - _fields_ = [("x", X), ("y", X)] - - y = Y() - self.failUnlessEqual(y._objects, None) - - x1, x2 = X(), X() - y.x, y.y = x1, x2 - self.failUnlessEqual(y._objects, {"0": {}, "1": {}}) - x1.a, x2.b = 42, 93 - self.failUnlessEqual(y._objects, {"0": {}, "1": {}}) - - def test_xxx(self): - class X(Structure): - _fields_ = [("a", c_char_p), ("b", c_char_p)] - - class Y(Structure): - _fields_ = [("x", X), ("y", X)] - - s1 = "Hello, World" - s2 = "Hallo, Welt" - - x = X() - x.a = s1 - x.b = s2 - self.failUnlessEqual(x._objects, {"0": s1, "1": s2}) - - y = Y() - y.x = x - self.failUnlessEqual(y._objects, {"0": {"0": s1, "1": s2}}) -## x = y.x -## del y -## print x._b_base_._objects - - def test_ptr_struct(self): - class X(Structure): - _fields_ = [("data", POINTER(c_int))] - - A = c_int*4 - a = A(11, 22, 33, 44) - self.failUnlessEqual(a._objects, None) - - x = X() - x.data = a -##XXX print x._objects -##XXX print x.data[0] -##XXX print x.data._objects - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_keeprefs.py b/sys/lib/python/ctypes/test/test_keeprefs.py deleted file mode 100644 index 80b6ca2ae..000000000 --- a/sys/lib/python/ctypes/test/test_keeprefs.py +++ /dev/null @@ -1,152 +0,0 @@ -from ctypes import * -import unittest - -class SimpleTestCase(unittest.TestCase): - def test_cint(self): - x = c_int() - self.assertEquals(x._objects, None) - x.value = 42 - self.assertEquals(x._objects, None) - x = c_int(99) - self.assertEquals(x._objects, None) - - def test_ccharp(self): - x = c_char_p() - self.assertEquals(x._objects, None) - x.value = "abc" - self.assertEquals(x._objects, "abc") - x = c_char_p("spam") - self.assertEquals(x._objects, "spam") - -class StructureTestCase(unittest.TestCase): - def test_cint_struct(self): - class X(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - - x = X() - self.assertEquals(x._objects, None) - x.a = 42 - x.b = 99 - self.assertEquals(x._objects, None) - - def test_ccharp_struct(self): - class X(Structure): - _fields_ = [("a", c_char_p), - ("b", c_char_p)] - x = X() - self.assertEquals(x._objects, None) - - x.a = "spam" - x.b = "foo" - self.assertEquals(x._objects, {"0": "spam", "1": "foo"}) - - def test_struct_struct(self): - class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] - class RECT(Structure): - _fields_ = [("ul", POINT), ("lr", POINT)] - - r = RECT() - r.ul.x = 0 - r.ul.y = 1 - r.lr.x = 2 - r.lr.y = 3 - self.assertEquals(r._objects, None) - - r = RECT() - pt = POINT(1, 2) - r.ul = pt - self.assertEquals(r._objects, {'0': {}}) - r.ul.x = 22 - r.ul.y = 44 - self.assertEquals(r._objects, {'0': {}}) - r.lr = POINT() - self.assertEquals(r._objects, {'0': {}, '1': {}}) - -class ArrayTestCase(unittest.TestCase): - def test_cint_array(self): - INTARR = c_int * 3 - - ia = INTARR() - self.assertEquals(ia._objects, None) - ia[0] = 1 - ia[1] = 2 - ia[2] = 3 - self.assertEquals(ia._objects, None) - - class X(Structure): - _fields_ = [("x", c_int), - ("a", INTARR)] - - x = X() - x.x = 1000 - x.a[0] = 42 - x.a[1] = 96 - self.assertEquals(x._objects, None) - x.a = ia - self.assertEquals(x._objects, {'1': {}}) - -class PointerTestCase(unittest.TestCase): - def test_p_cint(self): - i = c_int(42) - x = pointer(i) - self.failUnlessEqual(x._objects, {'1': i}) - -class DeletePointerTestCase(unittest.TestCase): - def X_test(self): - class X(Structure): - _fields_ = [("p", POINTER(c_char_p))] - x = X() - i = c_char_p("abc def") - from sys import getrefcount as grc - print "2?", grc(i) - x.p = pointer(i) - print "3?", grc(i) - for i in range(320): - c_int(99) - x.p[0] - print x.p[0] -## del x -## print "2?", grc(i) -## del i - import gc - gc.collect() - for i in range(320): - c_int(99) - x.p[0] - print x.p[0] - print x.p.contents -## print x._objects - - x.p[0] = "spam spam" -## print x.p[0] - print "+" * 42 - print x._objects - -class PointerToStructure(unittest.TestCase): - def test(self): - class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] - class RECT(Structure): - _fields_ = [("a", POINTER(POINT)), - ("b", POINTER(POINT))] - r = RECT() - p1 = POINT(1, 2) - - r.a = pointer(p1) - r.b = pointer(p1) -## from pprint import pprint as pp -## pp(p1._objects) -## pp(r._objects) - - r.a[0].x = 42 - r.a[0].y = 99 - - # to avoid leaking when tests are run several times - # clean up the types left in the cache. - from ctypes import _pointer_type_cache - del _pointer_type_cache[POINT] - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_libc.py b/sys/lib/python/ctypes/test/test_libc.py deleted file mode 100644 index c39f3507c..000000000 --- a/sys/lib/python/ctypes/test/test_libc.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys, os -import unittest - -from ctypes import * -import _ctypes_test - -lib = CDLL(_ctypes_test.__file__) - -class LibTest(unittest.TestCase): - def test_sqrt(self): - lib.my_sqrt.argtypes = c_double, - lib.my_sqrt.restype = c_double - self.failUnlessEqual(lib.my_sqrt(4.0), 2.0) - import math - self.failUnlessEqual(lib.my_sqrt(2.0), math.sqrt(2.0)) - - def test_qsort(self): - comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char)) - lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc - lib.my_qsort.restype = None - - def sort(a, b): - return cmp(a[0], b[0]) - - chars = create_string_buffer("spam, spam, and spam") - lib.my_qsort(chars, len(chars)-1, sizeof(c_char), comparefunc(sort)) - self.failUnlessEqual(chars.raw, " ,,aaaadmmmnpppsss\x00") - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_loading.py b/sys/lib/python/ctypes/test/test_loading.py deleted file mode 100644 index 1e7870b79..000000000 --- a/sys/lib/python/ctypes/test/test_loading.py +++ /dev/null @@ -1,78 +0,0 @@ -from ctypes import * -import sys, unittest -import os, StringIO -from ctypes.util import find_library -from ctypes.test import is_resource_enabled - -libc_name = None -if os.name == "nt": - libc_name = "msvcrt" -elif os.name == "ce": - libc_name = "coredll" -elif sys.platform == "cygwin": - libc_name = "cygwin1.dll" -else: - libc_name = find_library("c") - -if True or is_resource_enabled("printing"): - print >> sys.stderr, "\tfind_library('c') -> ", find_library('c') - print >> sys.stderr, "\tfind_library('m') -> ", find_library('m') - -class LoaderTest(unittest.TestCase): - - unknowndll = "xxrandomnamexx" - - if libc_name is not None: - def test_load(self): - CDLL(libc_name) - CDLL(os.path.basename(libc_name)) - self.assertRaises(OSError, CDLL, self.unknowndll) - - if libc_name is not None and os.path.basename(libc_name) == "libc.so.6": - def test_load_version(self): - cdll.LoadLibrary("libc.so.6") - # linux uses version, libc 9 should not exist - self.assertRaises(OSError, cdll.LoadLibrary, "libc.so.9") - self.assertRaises(OSError, cdll.LoadLibrary, self.unknowndll) - - def test_find(self): - for name in ("c", "m"): - lib = find_library(name) - if lib: - cdll.LoadLibrary(lib) - CDLL(lib) - - if os.name in ("nt", "ce"): - def test_load_library(self): - if is_resource_enabled("printing"): - print find_library("kernel32") - print find_library("user32") - - if os.name == "nt": - windll.kernel32.GetModuleHandleW - windll["kernel32"].GetModuleHandleW - windll.LoadLibrary("kernel32").GetModuleHandleW - WinDLL("kernel32").GetModuleHandleW - elif os.name == "ce": - windll.coredll.GetModuleHandleW - windll["coredll"].GetModuleHandleW - windll.LoadLibrary("coredll").GetModuleHandleW - WinDLL("coredll").GetModuleHandleW - - def test_load_ordinal_functions(self): - import _ctypes_test - dll = WinDLL(_ctypes_test.__file__) - # We load the same function both via ordinal and name - func_ord = dll[2] - func_name = dll.GetString - # addressof gets the address where the function pointer is stored - a_ord = addressof(func_ord) - a_name = addressof(func_name) - f_ord_addr = c_void_p.from_address(a_ord).value - f_name_addr = c_void_p.from_address(a_name).value - self.failUnlessEqual(hex(f_ord_addr), hex(f_name_addr)) - - self.failUnlessRaises(AttributeError, dll.__getitem__, 1234) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_macholib.py b/sys/lib/python/ctypes/test/test_macholib.py deleted file mode 100644 index 4bb68ac63..000000000 --- a/sys/lib/python/ctypes/test/test_macholib.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -import sys -import unittest - -# Bob Ippolito: -""" -Ok.. the code to find the filename for __getattr__ should look -something like: - -import os -from macholib.dyld import dyld_find - -def find_lib(name): - possible = ['lib'+name+'.dylib', name+'.dylib', - name+'.framework/'+name] - for dylib in possible: - try: - return os.path.realpath(dyld_find(dylib)) - except ValueError: - pass - raise ValueError, "%s not found" % (name,) - -It'll have output like this: - - >>> find_lib('pthread') -'/usr/lib/libSystem.B.dylib' - >>> find_lib('z') -'/usr/lib/libz.1.dylib' - >>> find_lib('IOKit') -'/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit' - --bob - -""" - -from ctypes.macholib.dyld import dyld_find - -def find_lib(name): - possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name] - for dylib in possible: - try: - return os.path.realpath(dyld_find(dylib)) - except ValueError: - pass - raise ValueError, "%s not found" % (name,) - -class MachOTest(unittest.TestCase): - if sys.platform == "darwin": - def test_find(self): - - self.failUnlessEqual(find_lib('pthread'), - '/usr/lib/libSystem.B.dylib') - - result = find_lib('z') - self.failUnless(result.startswith('/usr/lib/libz.1')) - self.failUnless(result.endswith('.dylib')) - - self.failUnlessEqual(find_lib('IOKit'), - '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit') - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_memfunctions.py b/sys/lib/python/ctypes/test/test_memfunctions.py deleted file mode 100644 index aef7a739f..000000000 --- a/sys/lib/python/ctypes/test/test_memfunctions.py +++ /dev/null @@ -1,61 +0,0 @@ -import sys -import unittest -from ctypes import * - -class MemFunctionsTest(unittest.TestCase): - def test_memmove(self): - # large buffers apparently increase the chance that the memory - # is allocated in high address space. - a = create_string_buffer(1000000) - p = "Hello, World" - result = memmove(a, p, len(p)) - self.failUnlessEqual(a.value, "Hello, World") - - self.failUnlessEqual(string_at(result), "Hello, World") - self.failUnlessEqual(string_at(result, 5), "Hello") - self.failUnlessEqual(string_at(result, 16), "Hello, World\0\0\0\0") - self.failUnlessEqual(string_at(result, 0), "") - - def test_memset(self): - a = create_string_buffer(1000000) - result = memset(a, ord('x'), 16) - self.failUnlessEqual(a.value, "xxxxxxxxxxxxxxxx") - - self.failUnlessEqual(string_at(result), "xxxxxxxxxxxxxxxx") - self.failUnlessEqual(string_at(a), "xxxxxxxxxxxxxxxx") - self.failUnlessEqual(string_at(a, 20), "xxxxxxxxxxxxxxxx\0\0\0\0") - - def test_cast(self): - a = (c_ubyte * 32)(*map(ord, "abcdef")) - self.failUnlessEqual(cast(a, c_char_p).value, "abcdef") - self.failUnlessEqual(cast(a, POINTER(c_byte))[:7], - [97, 98, 99, 100, 101, 102, 0]) - - def test_string_at(self): - s = string_at("foo bar") - # XXX The following may be wrong, depending on how Python - # manages string instances - self.failUnlessEqual(2, sys.getrefcount(s)) - self.failUnless(s, "foo bar") - - self.failUnlessEqual(string_at("foo bar", 8), "foo bar\0") - self.failUnlessEqual(string_at("foo bar", 3), "foo") - - try: - create_unicode_buffer - except NameError: - pass - else: - def test_wstring_at(self): - p = create_unicode_buffer("Hello, World") - a = create_unicode_buffer(1000000) - result = memmove(a, p, len(p) * sizeof(c_wchar)) - self.failUnlessEqual(a.value, "Hello, World") - - self.failUnlessEqual(wstring_at(a), "Hello, World") - self.failUnlessEqual(wstring_at(a, 5), "Hello") - self.failUnlessEqual(wstring_at(a, 16), "Hello, World\0\0\0\0") - self.failUnlessEqual(wstring_at(a, 0), "") - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_numbers.py b/sys/lib/python/ctypes/test/test_numbers.py deleted file mode 100644 index c22688dba..000000000 --- a/sys/lib/python/ctypes/test/test_numbers.py +++ /dev/null @@ -1,230 +0,0 @@ -from ctypes import * -import unittest -import sys, struct - -def valid_ranges(*types): - # given a sequence of numeric types, collect their _type_ - # attribute, which is a single format character compatible with - # the struct module, use the struct module to calculate the - # minimum and maximum value allowed for this format. - # Returns a list of (min, max) values. - result = [] - for t in types: - fmt = t._type_ - size = struct.calcsize(fmt) - a = struct.unpack(fmt, ("\x00"*32)[:size])[0] - b = struct.unpack(fmt, ("\xFF"*32)[:size])[0] - c = struct.unpack(fmt, ("\x7F"+"\x00"*32)[:size])[0] - d = struct.unpack(fmt, ("\x80"+"\xFF"*32)[:size])[0] - result.append((min(a, b, c, d), max(a, b, c, d))) - return result - -ArgType = type(byref(c_int(0))) - -unsigned_types = [c_ubyte, c_ushort, c_uint, c_ulong] -signed_types = [c_byte, c_short, c_int, c_long, c_longlong] - -float_types = [c_double, c_float] - -try: - c_ulonglong - c_longlong -except NameError: - pass -else: - unsigned_types.append(c_ulonglong) - signed_types.append(c_longlong) - -unsigned_ranges = valid_ranges(*unsigned_types) -signed_ranges = valid_ranges(*signed_types) - -################################################################ - -class NumberTestCase(unittest.TestCase): - - def test_default_init(self): - # default values are set to zero - for t in signed_types + unsigned_types + float_types: - self.failUnlessEqual(t().value, 0) - - def test_unsigned_values(self): - # the value given to the constructor is available - # as the 'value' attribute - for t, (l, h) in zip(unsigned_types, unsigned_ranges): - self.failUnlessEqual(t(l).value, l) - self.failUnlessEqual(t(h).value, h) - - def test_signed_values(self): - # see above - for t, (l, h) in zip(signed_types, signed_ranges): - self.failUnlessEqual(t(l).value, l) - self.failUnlessEqual(t(h).value, h) - - def test_typeerror(self): - # Only numbers are allowed in the contructor, - # otherwise TypeError is raised - for t in signed_types + unsigned_types + float_types: - self.assertRaises(TypeError, t, "") - self.assertRaises(TypeError, t, None) - -## def test_valid_ranges(self): -## # invalid values of the correct type -## # raise ValueError (not OverflowError) -## for t, (l, h) in zip(unsigned_types, unsigned_ranges): -## self.assertRaises(ValueError, t, l-1) -## self.assertRaises(ValueError, t, h+1) - - def test_from_param(self): - # the from_param class method attribute always - # returns PyCArgObject instances - for t in signed_types + unsigned_types + float_types: - self.failUnlessEqual(ArgType, type(t.from_param(0))) - - def test_byref(self): - # calling byref returns also a PyCArgObject instance - for t in signed_types + unsigned_types + float_types: - parm = byref(t()) - self.failUnlessEqual(ArgType, type(parm)) - - - def test_floats(self): - # c_float and c_double can be created from - # Python int, long and float - for t in float_types: - self.failUnlessEqual(t(2.0).value, 2.0) - self.failUnlessEqual(t(2).value, 2.0) - self.failUnlessEqual(t(2L).value, 2.0) - - def test_integers(self): - # integers cannot be constructed from floats - for t in signed_types + unsigned_types: - self.assertRaises(TypeError, t, 3.14) - - def test_sizes(self): - for t in signed_types + unsigned_types + float_types: - size = struct.calcsize(t._type_) - # sizeof of the type... - self.failUnlessEqual(sizeof(t), size) - # and sizeof of an instance - self.failUnlessEqual(sizeof(t()), size) - - def test_alignments(self): - for t in signed_types + unsigned_types + float_types: - code = t._type_ # the typecode - align = struct.calcsize("c%c" % code) - struct.calcsize(code) - - # alignment of the type... - self.failUnlessEqual((code, alignment(t)), - (code, align)) - # and alignment of an instance - self.failUnlessEqual((code, alignment(t())), - (code, align)) - - def test_int_from_address(self): - from array import array - for t in signed_types + unsigned_types: - # the array module doesn't suppport all format codes - # (no 'q' or 'Q') - try: - array(t._type_) - except ValueError: - continue - a = array(t._type_, [100]) - - # v now is an integer at an 'external' memory location - v = t.from_address(a.buffer_info()[0]) - self.failUnlessEqual(v.value, a[0]) - self.failUnlessEqual(type(v), t) - - # changing the value at the memory location changes v's value also - a[0] = 42 - self.failUnlessEqual(v.value, a[0]) - - - def test_float_from_address(self): - from array import array - for t in float_types: - a = array(t._type_, [3.14]) - v = t.from_address(a.buffer_info()[0]) - self.failUnlessEqual(v.value, a[0]) - self.failUnless(type(v) is t) - a[0] = 2.3456e17 - self.failUnlessEqual(v.value, a[0]) - self.failUnless(type(v) is t) - - def test_char_from_address(self): - from ctypes import c_char - from array import array - - a = array('c', 'x') - v = c_char.from_address(a.buffer_info()[0]) - self.failUnlessEqual(v.value, a[0]) - self.failUnless(type(v) is c_char) - - a[0] = '?' - self.failUnlessEqual(v.value, a[0]) - - def test_init(self): - # c_int() can be initialized from Python's int, and c_int. - # Not from c_long or so, which seems strange, abd should - # probably be changed: - self.assertRaises(TypeError, c_int, c_long(42)) - -## def test_perf(self): -## check_perf() - -from ctypes import _SimpleCData -class c_int_S(_SimpleCData): - _type_ = "i" - __slots__ = [] - -def run_test(rep, msg, func, arg=None): -## items = [None] * rep - items = range(rep) - from time import clock - if arg is not None: - start = clock() - for i in items: - func(arg); func(arg); func(arg); func(arg); func(arg) - stop = clock() - else: - start = clock() - for i in items: - func(); func(); func(); func(); func() - stop = clock() - print "%15s: %.2f us" % (msg, ((stop-start)*1e6/5/rep)) - -def check_perf(): - # Construct 5 objects - from ctypes import c_int - - REP = 200000 - - run_test(REP, "int()", int) - run_test(REP, "int(999)", int) - run_test(REP, "c_int()", c_int) - run_test(REP, "c_int(999)", c_int) - run_test(REP, "c_int_S()", c_int_S) - run_test(REP, "c_int_S(999)", c_int_S) - -# Python 2.3 -OO, win2k, P4 700 MHz: -# -# int(): 0.87 us -# int(999): 0.87 us -# c_int(): 3.35 us -# c_int(999): 3.34 us -# c_int_S(): 3.23 us -# c_int_S(999): 3.24 us - -# Python 2.2 -OO, win2k, P4 700 MHz: -# -# int(): 0.89 us -# int(999): 0.89 us -# c_int(): 9.99 us -# c_int(999): 10.02 us -# c_int_S(): 9.87 us -# c_int_S(999): 9.85 us - -if __name__ == '__main__': -## check_perf() - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_objects.py b/sys/lib/python/ctypes/test/test_objects.py deleted file mode 100644 index 4d921d2e5..000000000 --- a/sys/lib/python/ctypes/test/test_objects.py +++ /dev/null @@ -1,70 +0,0 @@ -r''' -This tests the '_objects' attribute of ctypes instances. '_objects' -holds references to objects that must be kept alive as long as the -ctypes instance, to make sure that the memory buffer is valid. - -WARNING: The '_objects' attribute is exposed ONLY for debugging ctypes itself, -it MUST NEVER BE MODIFIED! - -'_objects' is initialized to a dictionary on first use, before that it -is None. - -Here is an array of string pointers: - ->>> from ctypes import * ->>> array = (c_char_p * 5)() ->>> print array._objects -None ->>> - -The memory block stores pointers to strings, and the strings itself -assigned from Python must be kept. - ->>> array[4] = 'foo bar' ->>> array._objects -{'4': 'foo bar'} ->>> array[4] -'foo bar' ->>> - -It gets more complicated when the ctypes instance itself is contained -in a 'base' object. - ->>> class X(Structure): -... _fields_ = [("x", c_int), ("y", c_int), ("array", c_char_p * 5)] -... ->>> x = X() ->>> print x._objects -None ->>> - -The'array' attribute of the 'x' object shares part of the memory buffer -of 'x' ('_b_base_' is either None, or the root object owning the memory block): - ->>> print x.array._b_base_ # doctest: +ELLIPSIS -<ctypes.test.test_objects.X object at 0x...> ->>> - ->>> x.array[0] = 'spam spam spam' ->>> x._objects -{'0:2': 'spam spam spam'} ->>> x.array._b_base_._objects -{'0:2': 'spam spam spam'} ->>> - -''' - -import unittest, doctest, sys - -import ctypes.test.test_objects - -class TestCase(unittest.TestCase): - if sys.hexversion > 0x02040000: - # Python 2.3 has no ELLIPSIS flag, so we don't test with this - # version: - def test(self): - doctest.testmod(ctypes.test.test_objects) - -if __name__ == '__main__': - if sys.hexversion > 0x02040000: - doctest.testmod(ctypes.test.test_objects) diff --git a/sys/lib/python/ctypes/test/test_parameters.py b/sys/lib/python/ctypes/test/test_parameters.py deleted file mode 100644 index 1b7f0dc86..000000000 --- a/sys/lib/python/ctypes/test/test_parameters.py +++ /dev/null @@ -1,188 +0,0 @@ -import unittest, sys - -class SimpleTypesTestCase(unittest.TestCase): - - def setUp(self): - import ctypes - try: - from _ctypes import set_conversion_mode - except ImportError: - pass - else: - self.prev_conv_mode = set_conversion_mode("ascii", "strict") - - def tearDown(self): - try: - from _ctypes import set_conversion_mode - except ImportError: - pass - else: - set_conversion_mode(*self.prev_conv_mode) - - - def test_subclasses(self): - from ctypes import c_void_p, c_char_p - # ctypes 0.9.5 and before did overwrite from_param in SimpleType_new - class CVOIDP(c_void_p): - def from_param(cls, value): - return value * 2 - from_param = classmethod(from_param) - - class CCHARP(c_char_p): - def from_param(cls, value): - return value * 4 - from_param = classmethod(from_param) - - self.failUnlessEqual(CVOIDP.from_param("abc"), "abcabc") - self.failUnlessEqual(CCHARP.from_param("abc"), "abcabcabcabc") - - try: - from ctypes import c_wchar_p - except ImportError: - return - - class CWCHARP(c_wchar_p): - def from_param(cls, value): - return value * 3 - from_param = classmethod(from_param) - - self.failUnlessEqual(CWCHARP.from_param("abc"), "abcabcabc") - - # XXX Replace by c_char_p tests - def test_cstrings(self): - from ctypes import c_char_p, byref - - # c_char_p.from_param on a Python String packs the string - # into a cparam object - s = "123" - self.failUnless(c_char_p.from_param(s)._obj is s) - - # new in 0.9.1: convert (encode) unicode to ascii - self.failUnlessEqual(c_char_p.from_param(u"123")._obj, "123") - self.assertRaises(UnicodeEncodeError, c_char_p.from_param, u"123\377") - - self.assertRaises(TypeError, c_char_p.from_param, 42) - - # calling c_char_p.from_param with a c_char_p instance - # returns the argument itself: - a = c_char_p("123") - self.failUnless(c_char_p.from_param(a) is a) - - def test_cw_strings(self): - from ctypes import byref - try: - from ctypes import c_wchar_p - except ImportError: -## print "(No c_wchar_p)" - return - s = u"123" - if sys.platform == "win32": - self.failUnless(c_wchar_p.from_param(s)._obj is s) - self.assertRaises(TypeError, c_wchar_p.from_param, 42) - - # new in 0.9.1: convert (decode) ascii to unicode - self.failUnlessEqual(c_wchar_p.from_param("123")._obj, u"123") - self.assertRaises(UnicodeDecodeError, c_wchar_p.from_param, "123\377") - - pa = c_wchar_p.from_param(c_wchar_p(u"123")) - self.failUnlessEqual(type(pa), c_wchar_p) - - def test_int_pointers(self): - from ctypes import c_short, c_uint, c_int, c_long, POINTER, pointer - LPINT = POINTER(c_int) - -## p = pointer(c_int(42)) -## x = LPINT.from_param(p) - x = LPINT.from_param(pointer(c_int(42))) - self.failUnlessEqual(x.contents.value, 42) - self.failUnlessEqual(LPINT(c_int(42)).contents.value, 42) - - self.failUnlessEqual(LPINT.from_param(None), 0) - - if c_int != c_long: - self.assertRaises(TypeError, LPINT.from_param, pointer(c_long(42))) - self.assertRaises(TypeError, LPINT.from_param, pointer(c_uint(42))) - self.assertRaises(TypeError, LPINT.from_param, pointer(c_short(42))) - - def test_byref_pointer(self): - # The from_param class method of POINTER(typ) classes accepts what is - # returned by byref(obj), it type(obj) == typ - from ctypes import c_short, c_uint, c_int, c_long, pointer, POINTER, byref - LPINT = POINTER(c_int) - - LPINT.from_param(byref(c_int(42))) - - self.assertRaises(TypeError, LPINT.from_param, byref(c_short(22))) - if c_int != c_long: - self.assertRaises(TypeError, LPINT.from_param, byref(c_long(22))) - self.assertRaises(TypeError, LPINT.from_param, byref(c_uint(22))) - - def test_byref_pointerpointer(self): - # See above - from ctypes import c_short, c_uint, c_int, c_long, pointer, POINTER, byref - - LPLPINT = POINTER(POINTER(c_int)) - LPLPINT.from_param(byref(pointer(c_int(42)))) - - self.assertRaises(TypeError, LPLPINT.from_param, byref(pointer(c_short(22)))) - if c_int != c_long: - self.assertRaises(TypeError, LPLPINT.from_param, byref(pointer(c_long(22)))) - self.assertRaises(TypeError, LPLPINT.from_param, byref(pointer(c_uint(22)))) - - def test_array_pointers(self): - from ctypes import c_short, c_uint, c_int, c_long, POINTER - INTARRAY = c_int * 3 - ia = INTARRAY() - self.failUnlessEqual(len(ia), 3) - self.failUnlessEqual([ia[i] for i in range(3)], [0, 0, 0]) - - # Pointers are only compatible with arrays containing items of - # the same type! - LPINT = POINTER(c_int) - LPINT.from_param((c_int*3)()) - self.assertRaises(TypeError, LPINT.from_param, c_short*3) - self.assertRaises(TypeError, LPINT.from_param, c_long*3) - self.assertRaises(TypeError, LPINT.from_param, c_uint*3) - -## def test_performance(self): -## check_perf() - - def test_noctypes_argtype(self): - import _ctypes_test - from ctypes import CDLL, c_void_p, ArgumentError - - func = CDLL(_ctypes_test.__file__)._testfunc_p_p - func.restype = c_void_p - # TypeError: has no from_param method - self.assertRaises(TypeError, setattr, func, "argtypes", (object,)) - - class Adapter(object): - def from_param(cls, obj): - return None - - func.argtypes = (Adapter(),) - self.failUnlessEqual(func(None), None) - self.failUnlessEqual(func(object()), None) - - class Adapter(object): - def from_param(cls, obj): - return obj - - func.argtypes = (Adapter(),) - # don't know how to convert parameter 1 - self.assertRaises(ArgumentError, func, object()) - self.failUnlessEqual(func(c_void_p(42)), 42) - - class Adapter(object): - def from_param(cls, obj): - raise ValueError(obj) - - func.argtypes = (Adapter(),) - # ArgumentError: argument 1: ValueError: 99 - self.assertRaises(ArgumentError, func, 99) - - -################################################################ - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_pointers.py b/sys/lib/python/ctypes/test/test_pointers.py deleted file mode 100644 index 586655af7..000000000 --- a/sys/lib/python/ctypes/test/test_pointers.py +++ /dev/null @@ -1,179 +0,0 @@ -import unittest - -from ctypes import * -import _ctypes_test - -ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, - c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float] -python_types = [int, int, int, int, int, long, - int, long, long, long, float, float] - -class PointersTestCase(unittest.TestCase): - - def test_pointer_crash(self): - - class A(POINTER(c_ulong)): - pass - - POINTER(c_ulong)(c_ulong(22)) - # Pointer can't set contents: has no _type_ - self.failUnlessRaises(TypeError, A, c_ulong(33)) - - def test_pass_pointers(self): - dll = CDLL(_ctypes_test.__file__) - func = dll._testfunc_p_p - func.restype = c_long - - i = c_int(12345678) -## func.argtypes = (POINTER(c_int),) - address = func(byref(i)) - self.failUnlessEqual(c_int.from_address(address).value, 12345678) - - func.restype = POINTER(c_int) - res = func(pointer(i)) - self.failUnlessEqual(res.contents.value, 12345678) - self.failUnlessEqual(res[0], 12345678) - - def test_change_pointers(self): - dll = CDLL(_ctypes_test.__file__) - func = dll._testfunc_p_p - - i = c_int(87654) - func.restype = POINTER(c_int) - func.argtypes = (POINTER(c_int),) - - res = func(pointer(i)) - self.failUnlessEqual(res[0], 87654) - self.failUnlessEqual(res.contents.value, 87654) - - # C code: *res = 54345 - res[0] = 54345 - self.failUnlessEqual(i.value, 54345) - - # C code: - # int x = 12321; - # res = &x - res.contents = c_int(12321) - self.failUnlessEqual(i.value, 54345) - - def test_callbacks_with_pointers(self): - # a function type receiving a pointer - PROTOTYPE = CFUNCTYPE(c_int, POINTER(c_int)) - - self.result = [] - - def func(arg): - for i in range(10): -## print arg[i], - self.result.append(arg[i]) -## print - return 0 - callback = PROTOTYPE(func) - - dll = CDLL(_ctypes_test.__file__) - # This function expects a function pointer, - # and calls this with an integer pointer as parameter. - # The int pointer points to a table containing the numbers 1..10 - doit = dll._testfunc_callback_with_pointer - -## i = c_int(42) -## callback(byref(i)) -## self.failUnless(i.value == 84) - - doit(callback) -## print self.result - doit(callback) -## print self.result - - def test_basics(self): - from operator import delitem - for ct, pt in zip(ctype_types, python_types): - i = ct(42) - p = pointer(i) -## print type(p.contents), ct - self.failUnless(type(p.contents) is ct) - # p.contents is the same as p[0] -## print p.contents -## self.failUnless(p.contents == 42) -## self.failUnless(p[0] == 42) - - self.assertRaises(TypeError, delitem, p, 0) - - def test_from_address(self): - from array import array - a = array('i', [100, 200, 300, 400, 500]) - addr = a.buffer_info()[0] - - p = POINTER(POINTER(c_int)) -## print dir(p) -## print p.from_address -## print p.from_address(addr)[0][0] - - def test_other(self): - class Table(Structure): - _fields_ = [("a", c_int), - ("b", c_int), - ("c", c_int)] - - pt = pointer(Table(1, 2, 3)) - - self.failUnlessEqual(pt.contents.a, 1) - self.failUnlessEqual(pt.contents.b, 2) - self.failUnlessEqual(pt.contents.c, 3) - - pt.contents.c = 33 - - from ctypes import _pointer_type_cache - del _pointer_type_cache[Table] - - def test_basic(self): - p = pointer(c_int(42)) - # Although a pointer can be indexed, it ha no length - self.assertRaises(TypeError, len, p) - self.failUnlessEqual(p[0], 42) - self.failUnlessEqual(p.contents.value, 42) - - def test_charpp(self): - """Test that a character pointer-to-pointer is correctly passed""" - dll = CDLL(_ctypes_test.__file__) - func = dll._testfunc_c_p_p - func.restype = c_char_p - argv = (c_char_p * 2)() - argc = c_int( 2 ) - argv[0] = 'hello' - argv[1] = 'world' - result = func( byref(argc), argv ) - assert result == 'world', result - - def test_bug_1467852(self): - # http://sourceforge.net/tracker/?func=detail&atid=532154&aid=1467852&group_id=71702 - x = c_int(5) - dummy = [] - for i in range(32000): - dummy.append(c_int(i)) - y = c_int(6) - p = pointer(x) - pp = pointer(p) - q = pointer(y) - pp[0] = q # <== - self.failUnlessEqual(p[0], 6) - def test_c_void_p(self): - # http://sourceforge.net/tracker/?func=detail&aid=1518190&group_id=5470&atid=105470 - if sizeof(c_void_p) == 4: - self.failUnlessEqual(c_void_p(0xFFFFFFFFL).value, - c_void_p(-1).value) - self.failUnlessEqual(c_void_p(0xFFFFFFFFFFFFFFFFL).value, - c_void_p(-1).value) - elif sizeof(c_void_p) == 8: - self.failUnlessEqual(c_void_p(0xFFFFFFFFL).value, - 0xFFFFFFFFL) - self.failUnlessEqual(c_void_p(0xFFFFFFFFFFFFFFFFL).value, - c_void_p(-1).value) - self.failUnlessEqual(c_void_p(0xFFFFFFFFFFFFFFFFFFFFFFFFL).value, - c_void_p(-1).value) - - self.assertRaises(TypeError, c_void_p, 3.14) # make sure floats are NOT accepted - self.assertRaises(TypeError, c_void_p, object()) # nor other objects - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_prototypes.py b/sys/lib/python/ctypes/test/test_prototypes.py deleted file mode 100644 index 9f020866f..000000000 --- a/sys/lib/python/ctypes/test/test_prototypes.py +++ /dev/null @@ -1,203 +0,0 @@ -from ctypes import * -import unittest - -# IMPORTANT INFO: -# -# Consider this call: -# func.restype = c_char_p -# func(c_char_p("123")) -# It returns -# "123" -# -# WHY IS THIS SO? -# -# argument tuple (c_char_p("123"), ) is destroyed after the function -# func is called, but NOT before the result is actually built. -# -# If the arglist would be destroyed BEFORE the result has been built, -# the c_char_p("123") object would already have a zero refcount, -# and the pointer passed to (and returned by) the function would -# probably point to deallocated space. -# -# In this case, there would have to be an additional reference to the argument... - -import _ctypes_test -testdll = CDLL(_ctypes_test.__file__) - -# Return machine address `a` as a (possibly long) non-negative integer. -# Starting with Python 2.5, id(anything) is always non-negative, and -# the ctypes addressof() inherits that via PyLong_FromVoidPtr(). -def positive_address(a): - if a >= 0: - return a - # View the bits in `a` as unsigned instead. - import struct - num_bits = struct.calcsize("P") * 8 # num bits in native machine address - a += 1L << num_bits - assert a >= 0 - return a - -def c_wbuffer(init): - n = len(init) + 1 - return (c_wchar * n)(*init) - -class CharPointersTestCase(unittest.TestCase): - - def setUp(self): - func = testdll._testfunc_p_p - func.restype = c_long - func.argtypes = None - - def test_int_pointer_arg(self): - func = testdll._testfunc_p_p - func.restype = c_long - self.failUnlessEqual(0, func(0)) - - ci = c_int(0) - - func.argtypes = POINTER(c_int), - self.failUnlessEqual(positive_address(addressof(ci)), - positive_address(func(byref(ci)))) - - func.argtypes = c_char_p, - self.assertRaises(ArgumentError, func, byref(ci)) - - func.argtypes = POINTER(c_short), - self.assertRaises(ArgumentError, func, byref(ci)) - - func.argtypes = POINTER(c_double), - self.assertRaises(ArgumentError, func, byref(ci)) - - def test_POINTER_c_char_arg(self): - func = testdll._testfunc_p_p - func.restype = c_char_p - func.argtypes = POINTER(c_char), - - self.failUnlessEqual(None, func(None)) - self.failUnlessEqual("123", func("123")) - self.failUnlessEqual(None, func(c_char_p(None))) - self.failUnlessEqual("123", func(c_char_p("123"))) - - self.failUnlessEqual("123", func(c_buffer("123"))) - ca = c_char("a") - self.failUnlessEqual("a", func(pointer(ca))[0]) - self.failUnlessEqual("a", func(byref(ca))[0]) - - def test_c_char_p_arg(self): - func = testdll._testfunc_p_p - func.restype = c_char_p - func.argtypes = c_char_p, - - self.failUnlessEqual(None, func(None)) - self.failUnlessEqual("123", func("123")) - self.failUnlessEqual(None, func(c_char_p(None))) - self.failUnlessEqual("123", func(c_char_p("123"))) - - self.failUnlessEqual("123", func(c_buffer("123"))) - ca = c_char("a") - self.failUnlessEqual("a", func(pointer(ca))[0]) - self.failUnlessEqual("a", func(byref(ca))[0]) - - def test_c_void_p_arg(self): - func = testdll._testfunc_p_p - func.restype = c_char_p - func.argtypes = c_void_p, - - self.failUnlessEqual(None, func(None)) - self.failUnlessEqual("123", func("123")) - self.failUnlessEqual("123", func(c_char_p("123"))) - self.failUnlessEqual(None, func(c_char_p(None))) - - self.failUnlessEqual("123", func(c_buffer("123"))) - ca = c_char("a") - self.failUnlessEqual("a", func(pointer(ca))[0]) - self.failUnlessEqual("a", func(byref(ca))[0]) - - func(byref(c_int())) - func(pointer(c_int())) - func((c_int * 3)()) - - try: - func.restype = c_wchar_p - except NameError: - pass - else: - self.failUnlessEqual(None, func(c_wchar_p(None))) - self.failUnlessEqual(u"123", func(c_wchar_p(u"123"))) - - def test_instance(self): - func = testdll._testfunc_p_p - func.restype = c_void_p - - class X: - _as_parameter_ = None - - func.argtypes = c_void_p, - self.failUnlessEqual(None, func(X())) - - func.argtypes = None - self.failUnlessEqual(None, func(X())) - -try: - c_wchar -except NameError: - pass -else: - class WCharPointersTestCase(unittest.TestCase): - - def setUp(self): - func = testdll._testfunc_p_p - func.restype = c_int - func.argtypes = None - - - def test_POINTER_c_wchar_arg(self): - func = testdll._testfunc_p_p - func.restype = c_wchar_p - func.argtypes = POINTER(c_wchar), - - self.failUnlessEqual(None, func(None)) - self.failUnlessEqual(u"123", func(u"123")) - self.failUnlessEqual(None, func(c_wchar_p(None))) - self.failUnlessEqual(u"123", func(c_wchar_p(u"123"))) - - self.failUnlessEqual(u"123", func(c_wbuffer(u"123"))) - ca = c_wchar("a") - self.failUnlessEqual(u"a", func(pointer(ca))[0]) - self.failUnlessEqual(u"a", func(byref(ca))[0]) - - def test_c_wchar_p_arg(self): - func = testdll._testfunc_p_p - func.restype = c_wchar_p - func.argtypes = c_wchar_p, - - c_wchar_p.from_param(u"123") - - self.failUnlessEqual(None, func(None)) - self.failUnlessEqual("123", func(u"123")) - self.failUnlessEqual(None, func(c_wchar_p(None))) - self.failUnlessEqual("123", func(c_wchar_p("123"))) - - # XXX Currently, these raise TypeErrors, although they shouldn't: - self.failUnlessEqual("123", func(c_wbuffer("123"))) - ca = c_wchar("a") - self.failUnlessEqual("a", func(pointer(ca))[0]) - self.failUnlessEqual("a", func(byref(ca))[0]) - -class ArrayTest(unittest.TestCase): - def test(self): - func = testdll._testfunc_ai8 - func.restype = POINTER(c_int) - func.argtypes = c_int * 8, - - func((c_int * 8)(1, 2, 3, 4, 5, 6, 7, 8)) - - # This did crash before: - - def func(): pass - CFUNCTYPE(None, c_int * 3)(func) - -################################################################ - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_python_api.py b/sys/lib/python/ctypes/test/test_python_api.py deleted file mode 100644 index 9d134740f..000000000 --- a/sys/lib/python/ctypes/test/test_python_api.py +++ /dev/null @@ -1,87 +0,0 @@ -from ctypes import * -import unittest, sys -from ctypes.test import is_resource_enabled - -################################################################ -# This section should be moved into ctypes\__init__.py, when it's ready. - -from _ctypes import PyObj_FromPtr - -################################################################ - -from sys import getrefcount as grc - - -class PythonAPITestCase(unittest.TestCase): - - def test_PyString_FromStringAndSize(self): - PyString_FromStringAndSize = pythonapi.PyString_FromStringAndSize - - PyString_FromStringAndSize.restype = py_object - PyString_FromStringAndSize.argtypes = c_char_p, c_int - - self.failUnlessEqual(PyString_FromStringAndSize("abcdefghi", 3), "abc") - - def test_PyString_FromString(self): - pythonapi.PyString_FromString.restype = py_object - pythonapi.PyString_FromString.argtypes = (c_char_p,) - - s = "abc" - refcnt = grc(s) - pyob = pythonapi.PyString_FromString(s) - self.failUnlessEqual(grc(s), refcnt) - self.failUnlessEqual(s, pyob) - del pyob - self.failUnlessEqual(grc(s), refcnt) - - if is_resource_enabled("refcount"): - # This test is unreliable, because it is possible that code in - # unittest changes the refcount of the '42' integer. So, it - # is disabled by default. - def test_PyInt_Long(self): - ref42 = grc(42) - pythonapi.PyInt_FromLong.restype = py_object - self.failUnlessEqual(pythonapi.PyInt_FromLong(42), 42) - - self.failUnlessEqual(grc(42), ref42) - - pythonapi.PyInt_AsLong.argtypes = (py_object,) - pythonapi.PyInt_AsLong.restype = c_long - - res = pythonapi.PyInt_AsLong(42) - self.failUnlessEqual(grc(res), ref42 + 1) - del res - self.failUnlessEqual(grc(42), ref42) - - def test_PyObj_FromPtr(self): - s = "abc def ghi jkl" - ref = grc(s) - # id(python-object) is the address - pyobj = PyObj_FromPtr(id(s)) - self.failUnless(s is pyobj) - - self.failUnlessEqual(grc(s), ref + 1) - del pyobj - self.failUnlessEqual(grc(s), ref) - - def test_PyOS_snprintf(self): - PyOS_snprintf = pythonapi.PyOS_snprintf - PyOS_snprintf.argtypes = POINTER(c_char), c_int, c_char_p - - buf = c_buffer(256) - PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes") - self.failUnlessEqual(buf.value, "Hello from ctypes") - - PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes", 1, 2, 3) - self.failUnlessEqual(buf.value, "Hello from ctypes") - - # not enough arguments - self.failUnlessRaises(TypeError, PyOS_snprintf, buf) - - def test_pyobject_repr(self): - self.failUnlessEqual(repr(py_object()), "py_object(<NULL>)") - self.failUnlessEqual(repr(py_object(42)), "py_object(42)") - self.failUnlessEqual(repr(py_object(object)), "py_object(%r)" % object) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_random_things.py b/sys/lib/python/ctypes/test/test_random_things.py deleted file mode 100644 index 78a665bc5..000000000 --- a/sys/lib/python/ctypes/test/test_random_things.py +++ /dev/null @@ -1,71 +0,0 @@ -from ctypes import * -import unittest, sys - -def callback_func(arg): - 42 / arg - raise ValueError, arg - -if sys.platform == "win32": - - class call_function_TestCase(unittest.TestCase): - # _ctypes.call_function is deprecated and private, but used by - # Gary Bishp's readline module. If we have it, we must test it as well. - - def test(self): - from _ctypes import call_function - hdll = windll.kernel32.LoadLibraryA("kernel32") - funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA") - - self.failUnlessEqual(call_function(funcaddr, (None,)), - windll.kernel32.GetModuleHandleA(None)) - -class CallbackTracbackTestCase(unittest.TestCase): - # When an exception is raised in a ctypes callback function, the C - # code prints a traceback. - # - # This test makes sure the exception types *and* the exception - # value is printed correctly. - # - # Changed in 0.9.3: No longer is '(in callback)' prepended to the - # error message - instead a additional frame for the C code is - # created, then a full traceback printed. When SystemExit is - # raised in a callback function, the interpreter exits. - - def capture_stderr(self, func, *args, **kw): - # helper - call function 'func', and return the captured stderr - import StringIO - old_stderr = sys.stderr - logger = sys.stderr = StringIO.StringIO() - try: - func(*args, **kw) - finally: - sys.stderr = old_stderr - return logger.getvalue() - - def test_ValueError(self): - cb = CFUNCTYPE(c_int, c_int)(callback_func) - out = self.capture_stderr(cb, 42) - self.failUnlessEqual(out.splitlines()[-1], - "ValueError: 42") - - def test_IntegerDivisionError(self): - cb = CFUNCTYPE(c_int, c_int)(callback_func) - out = self.capture_stderr(cb, 0) - self.failUnlessEqual(out.splitlines()[-1][:19], - "ZeroDivisionError: ") - - def test_FloatDivisionError(self): - cb = CFUNCTYPE(c_int, c_double)(callback_func) - out = self.capture_stderr(cb, 0.0) - self.failUnlessEqual(out.splitlines()[-1][:19], - "ZeroDivisionError: ") - - def test_TypeErrorDivisionError(self): - cb = CFUNCTYPE(c_int, c_char_p)(callback_func) - out = self.capture_stderr(cb, "spam") - self.failUnlessEqual(out.splitlines()[-1], - "TypeError: " - "unsupported operand type(s) for /: 'int' and 'str'") - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_refcounts.py b/sys/lib/python/ctypes/test/test_refcounts.py deleted file mode 100644 index 448f292cd..000000000 --- a/sys/lib/python/ctypes/test/test_refcounts.py +++ /dev/null @@ -1,98 +0,0 @@ -import unittest -import ctypes -import gc - -MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int) -OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong) - -import _ctypes_test -dll = ctypes.CDLL(_ctypes_test.__file__) - -class RefcountTestCase(unittest.TestCase): - - def test_1(self): - from sys import getrefcount as grc - - f = dll._testfunc_callback_i_if - f.restype = ctypes.c_int - f.argtypes = [ctypes.c_int, MyCallback] - - def callback(value): - #print "called back with", value - return value - - self.failUnlessEqual(grc(callback), 2) - cb = MyCallback(callback) - - self.failUnless(grc(callback) > 2) - result = f(-10, cb) - self.failUnlessEqual(result, -18) - cb = None - - gc.collect() - - self.failUnlessEqual(grc(callback), 2) - - - def test_refcount(self): - from sys import getrefcount as grc - def func(*args): - pass - # this is the standard refcount for func - self.failUnlessEqual(grc(func), 2) - - # the CFuncPtr instance holds atr least one refcount on func: - f = OtherCallback(func) - self.failUnless(grc(func) > 2) - - # and may release it again - del f - self.failUnless(grc(func) >= 2) - - # but now it must be gone - gc.collect() - self.failUnless(grc(func) == 2) - - class X(ctypes.Structure): - _fields_ = [("a", OtherCallback)] - x = X() - x.a = OtherCallback(func) - - # the CFuncPtr instance holds atr least one refcount on func: - self.failUnless(grc(func) > 2) - - # and may release it again - del x - self.failUnless(grc(func) >= 2) - - # and now it must be gone again - gc.collect() - self.failUnlessEqual(grc(func), 2) - - f = OtherCallback(func) - - # the CFuncPtr instance holds atr least one refcount on func: - self.failUnless(grc(func) > 2) - - # create a cycle - f.cycle = f - - del f - gc.collect() - self.failUnlessEqual(grc(func), 2) - -class AnotherLeak(unittest.TestCase): - def test_callback(self): - import sys - - proto = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int) - def func(a, b): - return a * b * 2 - f = proto(func) - - a = sys.getrefcount(ctypes.c_int) - f(1, 2) - self.failUnlessEqual(sys.getrefcount(ctypes.c_int), a) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_repr.py b/sys/lib/python/ctypes/test/test_repr.py deleted file mode 100644 index 1044f6713..000000000 --- a/sys/lib/python/ctypes/test/test_repr.py +++ /dev/null @@ -1,29 +0,0 @@ -from ctypes import * -import unittest - -subclasses = [] -for base in [c_byte, c_short, c_int, c_long, c_longlong, - c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong, - c_float, c_double]: - class X(base): - pass - subclasses.append(X) - -class X(c_char): - pass - -# This test checks if the __repr__ is correct for subclasses of simple types - -class ReprTest(unittest.TestCase): - def test_numbers(self): - for typ in subclasses: - base = typ.__bases__[0] - self.failUnless(repr(base(42)).startswith(base.__name__)) - self.failUnlessEqual("<X object at", repr(typ(42))[:12]) - - def test_char(self): - self.failUnlessEqual("c_char('x')", repr(c_char('x'))) - self.failUnlessEqual("<X object at", repr(X('x'))[:12]) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_returnfuncptrs.py b/sys/lib/python/ctypes/test/test_returnfuncptrs.py deleted file mode 100644 index 88dccf2ce..000000000 --- a/sys/lib/python/ctypes/test/test_returnfuncptrs.py +++ /dev/null @@ -1,35 +0,0 @@ -import unittest -from ctypes import * - -import _ctypes_test - -class ReturnFuncPtrTestCase(unittest.TestCase): - - def test_with_prototype(self): - # The _ctypes_test shared lib/dll exports quite some functions for testing. - # The get_strchr function returns a *pointer* to the C strchr function. - dll = CDLL(_ctypes_test.__file__) - get_strchr = dll.get_strchr - get_strchr.restype = CFUNCTYPE(c_char_p, c_char_p, c_char) - strchr = get_strchr() - self.failUnlessEqual(strchr("abcdef", "b"), "bcdef") - self.failUnlessEqual(strchr("abcdef", "x"), None) - self.assertRaises(ArgumentError, strchr, "abcdef", 3) - self.assertRaises(TypeError, strchr, "abcdef") - - def test_without_prototype(self): - dll = CDLL(_ctypes_test.__file__) - get_strchr = dll.get_strchr - # the default 'c_int' would not work on systems where sizeof(int) != sizeof(void *) - get_strchr.restype = c_void_p - addr = get_strchr() - # _CFuncPtr instances are now callable with an integer argument - # which denotes a function address: - strchr = CFUNCTYPE(c_char_p, c_char_p, c_char)(addr) - self.failUnless(strchr("abcdef", "b"), "bcdef") - self.failUnlessEqual(strchr("abcdef", "x"), None) - self.assertRaises(ArgumentError, strchr, "abcdef", 3) - self.assertRaises(TypeError, strchr, "abcdef") - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_simplesubclasses.py b/sys/lib/python/ctypes/test/test_simplesubclasses.py deleted file mode 100644 index 715517074..000000000 --- a/sys/lib/python/ctypes/test/test_simplesubclasses.py +++ /dev/null @@ -1,55 +0,0 @@ -import unittest -from ctypes import * - -class MyInt(c_int): - def __cmp__(self, other): - if type(other) != MyInt: - return -1 - return cmp(self.value, other.value) - -class Test(unittest.TestCase): - - def test_compare(self): - self.failUnlessEqual(MyInt(3), MyInt(3)) - self.failIfEqual(MyInt(42), MyInt(43)) - - def test_ignore_retval(self): - # Test if the return value of a callback is ignored - # if restype is None - proto = CFUNCTYPE(None) - def func(): - return (1, "abc", None) - - cb = proto(func) - self.failUnlessEqual(None, cb()) - - - def test_int_callback(self): - args = [] - def func(arg): - args.append(arg) - return arg - - cb = CFUNCTYPE(None, MyInt)(func) - - self.failUnlessEqual(None, cb(42)) - self.failUnlessEqual(type(args[-1]), MyInt) - - cb = CFUNCTYPE(c_int, c_int)(func) - - self.failUnlessEqual(42, cb(42)) - self.failUnlessEqual(type(args[-1]), int) - - def test_int_struct(self): - class X(Structure): - _fields_ = [("x", MyInt)] - - self.failUnlessEqual(X().x, MyInt()) - - s = X() - s.x = MyInt(42) - - self.failUnlessEqual(s.x, MyInt(42)) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_sizes.py b/sys/lib/python/ctypes/test/test_sizes.py deleted file mode 100644 index 208c00efc..000000000 --- a/sys/lib/python/ctypes/test/test_sizes.py +++ /dev/null @@ -1,27 +0,0 @@ -# Test specifically-sized containers. - -import unittest -from ctypes import * - -class SizesTestCase(unittest.TestCase): - def test_8(self): - self.failUnlessEqual(1, sizeof(c_int8)) - self.failUnlessEqual(1, sizeof(c_uint8)) - - def test_16(self): - self.failUnlessEqual(2, sizeof(c_int16)) - self.failUnlessEqual(2, sizeof(c_uint16)) - - def test_32(self): - self.failUnlessEqual(4, sizeof(c_int32)) - self.failUnlessEqual(4, sizeof(c_uint32)) - - def test_64(self): - self.failUnlessEqual(8, sizeof(c_int64)) - self.failUnlessEqual(8, sizeof(c_uint64)) - - def test_size_t(self): - self.failUnlessEqual(sizeof(c_void_p), sizeof(c_size_t)) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_slicing.py b/sys/lib/python/ctypes/test/test_slicing.py deleted file mode 100644 index 511c3d34a..000000000 --- a/sys/lib/python/ctypes/test/test_slicing.py +++ /dev/null @@ -1,120 +0,0 @@ -import unittest -from ctypes import * - -import _ctypes_test - -class SlicesTestCase(unittest.TestCase): - def test_getslice_cint(self): - a = (c_int * 100)(*xrange(1100, 1200)) - b = range(1100, 1200) - self.failUnlessEqual(a[0:2], b[0:2]) - self.failUnlessEqual(len(a), len(b)) - self.failUnlessEqual(a[5:7], b[5:7]) - self.failUnlessEqual(a[-1], b[-1]) - self.failUnlessEqual(a[:], b[:]) - - a[0:5] = range(5, 10) - self.failUnlessEqual(a[0:5], range(5, 10)) - - def test_setslice_cint(self): - a = (c_int * 100)(*xrange(1100, 1200)) - b = range(1100, 1200) - - a[32:47] = range(32, 47) - self.failUnlessEqual(a[32:47], range(32, 47)) - - from operator import setslice - - # TypeError: int expected instead of str instance - self.assertRaises(TypeError, setslice, a, 0, 5, "abcde") - # TypeError: int expected instead of str instance - self.assertRaises(TypeError, setslice, a, 0, 5, ["a", "b", "c", "d", "e"]) - # TypeError: int expected instead of float instance - self.assertRaises(TypeError, setslice, a, 0, 5, [1, 2, 3, 4, 3.14]) - # ValueError: Can only assign sequence of same size - self.assertRaises(ValueError, setslice, a, 0, 5, range(32)) - - def test_char_ptr(self): - s = "abcdefghijklmnopqrstuvwxyz" - - dll = CDLL(_ctypes_test.__file__) - dll.my_strdup.restype = POINTER(c_char) - dll.my_free.restype = None - res = dll.my_strdup(s) - self.failUnlessEqual(res[:len(s)], s) - - import operator - self.assertRaises(TypeError, operator.setslice, - res, 0, 5, u"abcde") - dll.my_free(res) - - dll.my_strdup.restype = POINTER(c_byte) - res = dll.my_strdup(s) - self.failUnlessEqual(res[:len(s)], range(ord("a"), ord("z")+1)) - dll.my_free(res) - - def test_char_ptr_with_free(self): - dll = CDLL(_ctypes_test.__file__) - s = "abcdefghijklmnopqrstuvwxyz" - - class allocated_c_char_p(c_char_p): - pass - - dll.my_free.restype = None - def errcheck(result, func, args): - retval = result.value - dll.my_free(result) - return retval - - dll.my_strdup.restype = allocated_c_char_p - dll.my_strdup.errcheck = errcheck - try: - res = dll.my_strdup(s) - self.failUnlessEqual(res, s) - finally: - del dll.my_strdup.errcheck - - - def test_char_array(self): - s = "abcdefghijklmnopqrstuvwxyz\0" - - p = (c_char * 27)(*s) - self.failUnlessEqual(p[:], s) - - - try: - c_wchar - except NameError: - pass - else: - def test_wchar_ptr(self): - s = u"abcdefghijklmnopqrstuvwxyz\0" - - dll = CDLL(_ctypes_test.__file__) - dll.my_wcsdup.restype = POINTER(c_wchar) - dll.my_wcsdup.argtypes = POINTER(c_wchar), - dll.my_free.restype = None - res = dll.my_wcsdup(s) - self.failUnlessEqual(res[:len(s)], s) - - import operator - self.assertRaises(TypeError, operator.setslice, - res, 0, 5, u"abcde") - dll.my_free(res) - - if sizeof(c_wchar) == sizeof(c_short): - dll.my_wcsdup.restype = POINTER(c_short) - elif sizeof(c_wchar) == sizeof(c_int): - dll.my_wcsdup.restype = POINTER(c_int) - elif sizeof(c_wchar) == sizeof(c_long): - dll.my_wcsdup.restype = POINTER(c_long) - else: - return - res = dll.my_wcsdup(s) - self.failUnlessEqual(res[:len(s)-1], range(ord("a"), ord("z")+1)) - dll.my_free(res) - -################################################################ - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_stringptr.py b/sys/lib/python/ctypes/test/test_stringptr.py deleted file mode 100644 index 6ee6ae044..000000000 --- a/sys/lib/python/ctypes/test/test_stringptr.py +++ /dev/null @@ -1,75 +0,0 @@ -import unittest -from ctypes import * - -import _ctypes_test - -lib = CDLL(_ctypes_test.__file__) - -class StringPtrTestCase(unittest.TestCase): - - def test__POINTER_c_char(self): - class X(Structure): - _fields_ = [("str", POINTER(c_char))] - x = X() - - # NULL pointer access - self.assertRaises(ValueError, getattr, x.str, "contents") - b = c_buffer("Hello, World") - from sys import getrefcount as grc - self.failUnlessEqual(grc(b), 2) - x.str = b - self.failUnlessEqual(grc(b), 3) - - # POINTER(c_char) and Python string is NOT compatible - # POINTER(c_char) and c_buffer() is compatible - for i in range(len(b)): - self.failUnlessEqual(b[i], x.str[i]) - - self.assertRaises(TypeError, setattr, x, "str", "Hello, World") - - def test__c_char_p(self): - class X(Structure): - _fields_ = [("str", c_char_p)] - x = X() - - # c_char_p and Python string is compatible - # c_char_p and c_buffer is NOT compatible - self.failUnlessEqual(x.str, None) - x.str = "Hello, World" - self.failUnlessEqual(x.str, "Hello, World") - b = c_buffer("Hello, World") - self.failUnlessRaises(TypeError, setattr, x, "str", b) - - - def test_functions(self): - strchr = lib.my_strchr - strchr.restype = c_char_p - - # c_char_p and Python string is compatible - # c_char_p and c_buffer are now compatible - strchr.argtypes = c_char_p, c_char - self.failUnlessEqual(strchr("abcdef", "c"), "cdef") - self.failUnlessEqual(strchr(c_buffer("abcdef"), "c"), "cdef") - - # POINTER(c_char) and Python string is NOT compatible - # POINTER(c_char) and c_buffer() is compatible - strchr.argtypes = POINTER(c_char), c_char - buf = c_buffer("abcdef") - self.failUnlessEqual(strchr(buf, "c"), "cdef") - self.failUnlessEqual(strchr("abcdef", "c"), "cdef") - - # XXX These calls are dangerous, because the first argument - # to strchr is no longer valid after the function returns! - # So we must keep a reference to buf separately - - strchr.restype = POINTER(c_char) - buf = c_buffer("abcdef") - r = strchr(buf, "c") - x = r[0], r[1], r[2], r[3], r[4] - self.failUnlessEqual(x, ("c", "d", "e", "f", "\000")) - del buf - # x1 will NOT be the same as x, usually: - x1 = r[0], r[1], r[2], r[3], r[4] - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_strings.py b/sys/lib/python/ctypes/test/test_strings.py deleted file mode 100644 index b5072290c..000000000 --- a/sys/lib/python/ctypes/test/test_strings.py +++ /dev/null @@ -1,215 +0,0 @@ -import unittest -from ctypes import * - -class StringArrayTestCase(unittest.TestCase): - def test(self): - BUF = c_char * 4 - - buf = BUF("a", "b", "c") - self.failUnlessEqual(buf.value, "abc") - self.failUnlessEqual(buf.raw, "abc\000") - - buf.value = "ABCD" - self.failUnlessEqual(buf.value, "ABCD") - self.failUnlessEqual(buf.raw, "ABCD") - - buf.value = "x" - self.failUnlessEqual(buf.value, "x") - self.failUnlessEqual(buf.raw, "x\000CD") - - buf[1] = "Z" - self.failUnlessEqual(buf.value, "xZCD") - self.failUnlessEqual(buf.raw, "xZCD") - - self.assertRaises(ValueError, setattr, buf, "value", "aaaaaaaa") - self.assertRaises(TypeError, setattr, buf, "value", 42) - - def test_c_buffer_value(self): - buf = c_buffer(32) - - buf.value = "Hello, World" - self.failUnlessEqual(buf.value, "Hello, World") - - self.failUnlessRaises(TypeError, setattr, buf, "value", buffer("Hello, World")) - self.assertRaises(TypeError, setattr, buf, "value", buffer("abc")) - self.assertRaises(ValueError, setattr, buf, "raw", buffer("x" * 100)) - - def test_c_buffer_raw(self): - buf = c_buffer(32) - - buf.raw = buffer("Hello, World") - self.failUnlessEqual(buf.value, "Hello, World") - self.assertRaises(TypeError, setattr, buf, "value", buffer("abc")) - self.assertRaises(ValueError, setattr, buf, "raw", buffer("x" * 100)) - - def test_param_1(self): - BUF = c_char * 4 - buf = BUF() -## print c_char_p.from_param(buf) - - def test_param_2(self): - BUF = c_char * 4 - buf = BUF() -## print BUF.from_param(c_char_p("python")) -## print BUF.from_param(BUF(*"pyth")) - -try: - c_wchar -except NameError: - pass -else: - class WStringArrayTestCase(unittest.TestCase): - def test(self): - BUF = c_wchar * 4 - - buf = BUF(u"a", u"b", u"c") - self.failUnlessEqual(buf.value, u"abc") - - buf.value = u"ABCD" - self.failUnlessEqual(buf.value, u"ABCD") - - buf.value = u"x" - self.failUnlessEqual(buf.value, u"x") - - buf[1] = u"Z" - self.failUnlessEqual(buf.value, u"xZCD") - -class StringTestCase(unittest.TestCase): - def XX_test_basic_strings(self): - cs = c_string("abcdef") - - # Cannot call len on a c_string any longer - self.assertRaises(TypeError, len, cs) - self.failUnlessEqual(sizeof(cs), 7) - - # The value property is the string up to the first terminating NUL. - self.failUnlessEqual(cs.value, "abcdef") - self.failUnlessEqual(c_string("abc\000def").value, "abc") - - # The raw property is the total buffer contents: - self.failUnlessEqual(cs.raw, "abcdef\000") - self.failUnlessEqual(c_string("abc\000def").raw, "abc\000def\000") - - # We can change the value: - cs.value = "ab" - self.failUnlessEqual(cs.value, "ab") - self.failUnlessEqual(cs.raw, "ab\000\000\000\000\000") - - cs.raw = "XY" - self.failUnlessEqual(cs.value, "XY") - self.failUnlessEqual(cs.raw, "XY\000\000\000\000\000") - - self.assertRaises(TypeError, c_string, u"123") - - def XX_test_sized_strings(self): - - # New in releases later than 0.4.0: - self.assertRaises(TypeError, c_string, None) - - # New in releases later than 0.4.0: - # c_string(number) returns an empty string of size number - self.failUnless(len(c_string(32).raw) == 32) - self.assertRaises(ValueError, c_string, -1) - self.assertRaises(ValueError, c_string, 0) - - # These tests fail, because it is no longer initialized -## self.failUnless(c_string(2).value == "") -## self.failUnless(c_string(2).raw == "\000\000") - self.failUnless(c_string(2).raw[-1] == "\000") - self.failUnless(len(c_string(2).raw) == 2) - - def XX_test_initialized_strings(self): - - self.failUnless(c_string("ab", 4).raw[:2] == "ab") - self.failUnless(c_string("ab", 4).raw[-1] == "\000") - self.failUnless(c_string("ab", 2).raw == "a\000") - - def XX_test_toolong(self): - cs = c_string("abcdef") - # Much too long string: - self.assertRaises(ValueError, setattr, cs, "value", "123456789012345") - - # One char too long values: - self.assertRaises(ValueError, setattr, cs, "value", "1234567") - -## def test_perf(self): -## check_perf() - -try: - c_wchar -except NameError: - pass -else: - class WStringTestCase(unittest.TestCase): - def test_wchar(self): - c_wchar(u"x") - repr(byref(c_wchar(u"x"))) - c_wchar("x") - - - def X_test_basic_wstrings(self): - cs = c_wstring(u"abcdef") - - # XXX This behaviour is about to change: - # len returns the size of the internal buffer in bytes. - # This includes the terminating NUL character. - self.failUnless(sizeof(cs) == 14) - - # The value property is the string up to the first terminating NUL. - self.failUnless(cs.value == u"abcdef") - self.failUnless(c_wstring(u"abc\000def").value == u"abc") - - self.failUnless(c_wstring(u"abc\000def").value == u"abc") - - # The raw property is the total buffer contents: - self.failUnless(cs.raw == u"abcdef\000") - self.failUnless(c_wstring(u"abc\000def").raw == u"abc\000def\000") - - # We can change the value: - cs.value = u"ab" - self.failUnless(cs.value == u"ab") - self.failUnless(cs.raw == u"ab\000\000\000\000\000") - - self.assertRaises(TypeError, c_wstring, "123") - self.assertRaises(ValueError, c_wstring, 0) - - def X_test_toolong(self): - cs = c_wstring(u"abcdef") - # Much too long string: - self.assertRaises(ValueError, setattr, cs, "value", u"123456789012345") - - # One char too long values: - self.assertRaises(ValueError, setattr, cs, "value", u"1234567") - - -def run_test(rep, msg, func, arg): - items = range(rep) - from time import clock - start = clock() - for i in items: - func(arg); func(arg); func(arg); func(arg); func(arg) - stop = clock() - print "%20s: %.2f us" % (msg, ((stop-start)*1e6/5/rep)) - -def check_perf(): - # Construct 5 objects - - REP = 200000 - - run_test(REP, "c_string(None)", c_string, None) - run_test(REP, "c_string('abc')", c_string, 'abc') - -# Python 2.3 -OO, win2k, P4 700 MHz: -# -# c_string(None): 1.75 us -# c_string('abc'): 2.74 us - -# Python 2.2 -OO, win2k, P4 700 MHz: -# -# c_string(None): 2.95 us -# c_string('abc'): 3.67 us - - -if __name__ == '__main__': -## check_perf() - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_struct_fields.py b/sys/lib/python/ctypes/test/test_struct_fields.py deleted file mode 100644 index ef5fb5020..000000000 --- a/sys/lib/python/ctypes/test/test_struct_fields.py +++ /dev/null @@ -1,50 +0,0 @@ -import unittest -from ctypes import * - -class StructFieldsTestCase(unittest.TestCase): - # Structure/Union classes must get 'finalized' sooner or - # later, when one of these things happen: - # - # 1. _fields_ is set. - # 2. An instance is created. - # 3. The type is used as field of another Structure/Union. - # 4. The type is subclassed - # - # When they are finalized, assigning _fields_ is no longer allowed. - - def test_1_A(self): - class X(Structure): - pass - self.failUnlessEqual(sizeof(X), 0) # not finalized - X._fields_ = [] # finalized - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - - def test_1_B(self): - class X(Structure): - _fields_ = [] # finalized - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - - def test_2(self): - class X(Structure): - pass - X() - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - - def test_3(self): - class X(Structure): - pass - class Y(Structure): - _fields_ = [("x", X)] # finalizes X - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - - def test_4(self): - class X(Structure): - pass - class Y(X): - pass - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - Y._fields_ = [] - self.assertRaises(AttributeError, setattr, X, "_fields_", []) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_structures.py b/sys/lib/python/ctypes/test/test_structures.py deleted file mode 100644 index 613163d0c..000000000 --- a/sys/lib/python/ctypes/test/test_structures.py +++ /dev/null @@ -1,415 +0,0 @@ -import unittest -from ctypes import * -from struct import calcsize - -class SubclassesTest(unittest.TestCase): - def test_subclass(self): - class X(Structure): - _fields_ = [("a", c_int)] - - class Y(X): - _fields_ = [("b", c_int)] - - class Z(X): - pass - - self.failUnlessEqual(sizeof(X), sizeof(c_int)) - self.failUnlessEqual(sizeof(Y), sizeof(c_int)*2) - self.failUnlessEqual(sizeof(Z), sizeof(c_int)) - self.failUnlessEqual(X._fields_, [("a", c_int)]) - self.failUnlessEqual(Y._fields_, [("b", c_int)]) - self.failUnlessEqual(Z._fields_, [("a", c_int)]) - - def test_subclass_delayed(self): - class X(Structure): - pass - self.failUnlessEqual(sizeof(X), 0) - X._fields_ = [("a", c_int)] - - class Y(X): - pass - self.failUnlessEqual(sizeof(Y), sizeof(X)) - Y._fields_ = [("b", c_int)] - - class Z(X): - pass - - self.failUnlessEqual(sizeof(X), sizeof(c_int)) - self.failUnlessEqual(sizeof(Y), sizeof(c_int)*2) - self.failUnlessEqual(sizeof(Z), sizeof(c_int)) - self.failUnlessEqual(X._fields_, [("a", c_int)]) - self.failUnlessEqual(Y._fields_, [("b", c_int)]) - self.failUnlessEqual(Z._fields_, [("a", c_int)]) - -class StructureTestCase(unittest.TestCase): - formats = {"c": c_char, - "b": c_byte, - "B": c_ubyte, - "h": c_short, - "H": c_ushort, - "i": c_int, - "I": c_uint, - "l": c_long, - "L": c_ulong, - "q": c_longlong, - "Q": c_ulonglong, - "f": c_float, - "d": c_double, - } - - def test_simple_structs(self): - for code, tp in self.formats.items(): - class X(Structure): - _fields_ = [("x", c_char), - ("y", tp)] - self.failUnlessEqual((sizeof(X), code), - (calcsize("c%c0%c" % (code, code)), code)) - - def test_unions(self): - for code, tp in self.formats.items(): - class X(Union): - _fields_ = [("x", c_char), - ("y", tp)] - self.failUnlessEqual((sizeof(X), code), - (calcsize("%c" % (code)), code)) - - def test_struct_alignment(self): - class X(Structure): - _fields_ = [("x", c_char * 3)] - self.failUnlessEqual(alignment(X), calcsize("s")) - self.failUnlessEqual(sizeof(X), calcsize("3s")) - - class Y(Structure): - _fields_ = [("x", c_char * 3), - ("y", c_int)] - self.failUnlessEqual(alignment(Y), calcsize("i")) - self.failUnlessEqual(sizeof(Y), calcsize("3si")) - - class SI(Structure): - _fields_ = [("a", X), - ("b", Y)] - self.failUnlessEqual(alignment(SI), max(alignment(Y), alignment(X))) - self.failUnlessEqual(sizeof(SI), calcsize("3s0i 3si 0i")) - - class IS(Structure): - _fields_ = [("b", Y), - ("a", X)] - - self.failUnlessEqual(alignment(SI), max(alignment(X), alignment(Y))) - self.failUnlessEqual(sizeof(IS), calcsize("3si 3s 0i")) - - class XX(Structure): - _fields_ = [("a", X), - ("b", X)] - self.failUnlessEqual(alignment(XX), alignment(X)) - self.failUnlessEqual(sizeof(XX), calcsize("3s 3s 0s")) - - def test_emtpy(self): - # I had problems with these - # - # Although these are patological cases: Empty Structures! - class X(Structure): - _fields_ = [] - - class Y(Union): - _fields_ = [] - - # Is this really the correct alignment, or should it be 0? - self.failUnless(alignment(X) == alignment(Y) == 1) - self.failUnless(sizeof(X) == sizeof(Y) == 0) - - class XX(Structure): - _fields_ = [("a", X), - ("b", X)] - - self.failUnlessEqual(alignment(XX), 1) - self.failUnlessEqual(sizeof(XX), 0) - - def test_fields(self): - # test the offset and size attributes of Structure/Unoin fields. - class X(Structure): - _fields_ = [("x", c_int), - ("y", c_char)] - - self.failUnlessEqual(X.x.offset, 0) - self.failUnlessEqual(X.x.size, sizeof(c_int)) - - self.failUnlessEqual(X.y.offset, sizeof(c_int)) - self.failUnlessEqual(X.y.size, sizeof(c_char)) - - # readonly - self.assertRaises((TypeError, AttributeError), setattr, X.x, "offset", 92) - self.assertRaises((TypeError, AttributeError), setattr, X.x, "size", 92) - - class X(Union): - _fields_ = [("x", c_int), - ("y", c_char)] - - self.failUnlessEqual(X.x.offset, 0) - self.failUnlessEqual(X.x.size, sizeof(c_int)) - - self.failUnlessEqual(X.y.offset, 0) - self.failUnlessEqual(X.y.size, sizeof(c_char)) - - # readonly - self.assertRaises((TypeError, AttributeError), setattr, X.x, "offset", 92) - self.assertRaises((TypeError, AttributeError), setattr, X.x, "size", 92) - - # XXX Should we check nested data types also? - # offset is always relative to the class... - - def test_packed(self): - class X(Structure): - _fields_ = [("a", c_byte), - ("b", c_longlong)] - _pack_ = 1 - - self.failUnlessEqual(sizeof(X), 9) - self.failUnlessEqual(X.b.offset, 1) - - class X(Structure): - _fields_ = [("a", c_byte), - ("b", c_longlong)] - _pack_ = 2 - self.failUnlessEqual(sizeof(X), 10) - self.failUnlessEqual(X.b.offset, 2) - - class X(Structure): - _fields_ = [("a", c_byte), - ("b", c_longlong)] - _pack_ = 4 - self.failUnlessEqual(sizeof(X), 12) - self.failUnlessEqual(X.b.offset, 4) - - import struct - longlong_size = struct.calcsize("q") - longlong_align = struct.calcsize("bq") - longlong_size - - class X(Structure): - _fields_ = [("a", c_byte), - ("b", c_longlong)] - _pack_ = 8 - - self.failUnlessEqual(sizeof(X), longlong_align + longlong_size) - self.failUnlessEqual(X.b.offset, min(8, longlong_align)) - - - d = {"_fields_": [("a", "b"), - ("b", "q")], - "_pack_": -1} - self.assertRaises(ValueError, type(Structure), "X", (Structure,), d) - - def test_initializers(self): - class Person(Structure): - _fields_ = [("name", c_char*6), - ("age", c_int)] - - self.assertRaises(TypeError, Person, 42) - self.assertRaises(ValueError, Person, "asldkjaslkdjaslkdj") - self.assertRaises(TypeError, Person, "Name", "HI") - - # short enough - self.failUnlessEqual(Person("12345", 5).name, "12345") - # exact fit - self.failUnlessEqual(Person("123456", 5).name, "123456") - # too long - self.assertRaises(ValueError, Person, "1234567", 5) - - - def test_keyword_initializers(self): - class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] - pt = POINT(1, 2) - self.failUnlessEqual((pt.x, pt.y), (1, 2)) - - pt = POINT(y=2, x=1) - self.failUnlessEqual((pt.x, pt.y), (1, 2)) - - def test_invalid_field_types(self): - class POINT(Structure): - pass - self.assertRaises(TypeError, setattr, POINT, "_fields_", [("x", 1), ("y", 2)]) - - def test_intarray_fields(self): - class SomeInts(Structure): - _fields_ = [("a", c_int * 4)] - - # can use tuple to initialize array (but not list!) - self.failUnlessEqual(SomeInts((1, 2)).a[:], [1, 2, 0, 0]) - self.failUnlessEqual(SomeInts((1, 2, 3, 4)).a[:], [1, 2, 3, 4]) - # too long - # XXX Should raise ValueError?, not RuntimeError - self.assertRaises(RuntimeError, SomeInts, (1, 2, 3, 4, 5)) - - def test_nested_initializers(self): - # test initializing nested structures - class Phone(Structure): - _fields_ = [("areacode", c_char*6), - ("number", c_char*12)] - - class Person(Structure): - _fields_ = [("name", c_char * 12), - ("phone", Phone), - ("age", c_int)] - - p = Person("Someone", ("1234", "5678"), 5) - - self.failUnlessEqual(p.name, "Someone") - self.failUnlessEqual(p.phone.areacode, "1234") - self.failUnlessEqual(p.phone.number, "5678") - self.failUnlessEqual(p.age, 5) - - def test_structures_with_wchar(self): - try: - c_wchar - except NameError: - return # no unicode - - class PersonW(Structure): - _fields_ = [("name", c_wchar * 12), - ("age", c_int)] - - p = PersonW(u"Someone") - self.failUnlessEqual(p.name, "Someone") - - self.failUnlessEqual(PersonW(u"1234567890").name, u"1234567890") - self.failUnlessEqual(PersonW(u"12345678901").name, u"12345678901") - # exact fit - self.failUnlessEqual(PersonW(u"123456789012").name, u"123456789012") - #too long - self.assertRaises(ValueError, PersonW, u"1234567890123") - - def test_init_errors(self): - class Phone(Structure): - _fields_ = [("areacode", c_char*6), - ("number", c_char*12)] - - class Person(Structure): - _fields_ = [("name", c_char * 12), - ("phone", Phone), - ("age", c_int)] - - cls, msg = self.get_except(Person, "Someone", (1, 2)) - self.failUnlessEqual(cls, RuntimeError) - # In Python 2.5, Exception is a new-style class, and the repr changed - if issubclass(Exception, object): - self.failUnlessEqual(msg, - "(Phone) <type 'exceptions.TypeError'>: " - "expected string or Unicode object, int found") - else: - self.failUnlessEqual(msg, - "(Phone) exceptions.TypeError: " - "expected string or Unicode object, int found") - - cls, msg = self.get_except(Person, "Someone", ("a", "b", "c")) - self.failUnlessEqual(cls, RuntimeError) - if issubclass(Exception, object): - self.failUnlessEqual(msg, - "(Phone) <type 'exceptions.ValueError'>: too many initializers") - else: - self.failUnlessEqual(msg, "(Phone) exceptions.ValueError: too many initializers") - - - def get_except(self, func, *args): - try: - func(*args) - except Exception, detail: - return detail.__class__, str(detail) - - -## def test_subclass_creation(self): -## meta = type(Structure) -## # same as 'class X(Structure): pass' -## # fails, since we need either a _fields_ or a _abstract_ attribute -## cls, msg = self.get_except(meta, "X", (Structure,), {}) -## self.failUnlessEqual((cls, msg), -## (AttributeError, "class must define a '_fields_' attribute")) - - def test_abstract_class(self): - class X(Structure): - _abstract_ = "something" - # try 'X()' - cls, msg = self.get_except(eval, "X()", locals()) - self.failUnlessEqual((cls, msg), (TypeError, "abstract class")) - - def test_methods(self): -## class X(Structure): -## _fields_ = [] - - self.failUnless("in_dll" in dir(type(Structure))) - self.failUnless("from_address" in dir(type(Structure))) - self.failUnless("in_dll" in dir(type(Structure))) - -class PointerMemberTestCase(unittest.TestCase): - - def test(self): - # a Structure with a POINTER field - class S(Structure): - _fields_ = [("array", POINTER(c_int))] - - s = S() - # We can assign arrays of the correct type - s.array = (c_int * 3)(1, 2, 3) - items = [s.array[i] for i in range(3)] - self.failUnlessEqual(items, [1, 2, 3]) - - # The following are bugs, but are included here because the unittests - # also describe the current behaviour. - # - # This fails with SystemError: bad arg to internal function - # or with IndexError (with a patch I have) - - s.array[0] = 42 - - items = [s.array[i] for i in range(3)] - self.failUnlessEqual(items, [42, 2, 3]) - - s.array[0] = 1 - -## s.array[1] = 42 - - items = [s.array[i] for i in range(3)] - self.failUnlessEqual(items, [1, 2, 3]) - - def test_none_to_pointer_fields(self): - class S(Structure): - _fields_ = [("x", c_int), - ("p", POINTER(c_int))] - - s = S() - s.x = 12345678 - s.p = None - self.failUnlessEqual(s.x, 12345678) - -class TestRecursiveStructure(unittest.TestCase): - def test_contains_itself(self): - class Recursive(Structure): - pass - - try: - Recursive._fields_ = [("next", Recursive)] - except AttributeError, details: - self.failUnless("Structure or union cannot contain itself" in - str(details)) - else: - self.fail("Structure or union cannot contain itself") - - - def test_vice_versa(self): - class First(Structure): - pass - class Second(Structure): - pass - - First._fields_ = [("second", Second)] - - try: - Second._fields_ = [("first", First)] - except AttributeError, details: - self.failUnless("_fields_ is final" in - str(details)) - else: - self.fail("AttributeError not raised") - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_unaligned_structures.py b/sys/lib/python/ctypes/test/test_unaligned_structures.py deleted file mode 100644 index 89343ba48..000000000 --- a/sys/lib/python/ctypes/test/test_unaligned_structures.py +++ /dev/null @@ -1,45 +0,0 @@ -import sys, unittest -from ctypes import * - -structures = [] -byteswapped_structures = [] - - -if sys.byteorder == "little": - SwappedStructure = BigEndianStructure -else: - SwappedStructure = LittleEndianStructure - -for typ in [c_short, c_int, c_long, c_longlong, - c_float, c_double, - c_ushort, c_uint, c_ulong, c_ulonglong]: - class X(Structure): - _pack_ = 1 - _fields_ = [("pad", c_byte), - ("value", typ)] - class Y(SwappedStructure): - _pack_ = 1 - _fields_ = [("pad", c_byte), - ("value", typ)] - structures.append(X) - byteswapped_structures.append(Y) - -class TestStructures(unittest.TestCase): - def test_native(self): - for typ in structures: -## print typ.value - self.failUnlessEqual(typ.value.offset, 1) - o = typ() - o.value = 4 - self.failUnlessEqual(o.value, 4) - - def test_swapped(self): - for typ in byteswapped_structures: -## print >> sys.stderr, typ.value - self.failUnlessEqual(typ.value.offset, 1) - o = typ() - o.value = 4 - self.failUnlessEqual(o.value, 4) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_unicode.py b/sys/lib/python/ctypes/test/test_unicode.py deleted file mode 100644 index 78c5cf87c..000000000 --- a/sys/lib/python/ctypes/test/test_unicode.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: latin-1 -import unittest -import ctypes - -try: - ctypes.c_wchar -except AttributeError: - pass -else: - import _ctypes_test - dll = ctypes.CDLL(_ctypes_test.__file__) - wcslen = dll.my_wcslen - wcslen.argtypes = [ctypes.c_wchar_p] - - - class UnicodeTestCase(unittest.TestCase): - def setUp(self): - self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict") - - def tearDown(self): - ctypes.set_conversion_mode(*self.prev_conv_mode) - - def test_ascii_strict(self): - ctypes.set_conversion_mode("ascii", "strict") - # no conversions take place with unicode arguments - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) - # string args are converted - self.failUnlessEqual(wcslen("abc"), 3) - self.failUnlessRaises(ctypes.ArgumentError, wcslen, "abä") - - def test_ascii_replace(self): - ctypes.set_conversion_mode("ascii", "replace") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) - self.failUnlessEqual(wcslen("abc"), 3) - self.failUnlessEqual(wcslen("abä"), 3) - - def test_ascii_ignore(self): - ctypes.set_conversion_mode("ascii", "ignore") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) - # ignore error mode skips non-ascii characters - self.failUnlessEqual(wcslen("abc"), 3) - self.failUnlessEqual(wcslen("äöüß"), 0) - - def test_latin1_strict(self): - ctypes.set_conversion_mode("latin-1", "strict") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) - self.failUnlessEqual(wcslen("abc"), 3) - self.failUnlessEqual(wcslen("äöüß"), 4) - - def test_buffers(self): - ctypes.set_conversion_mode("ascii", "strict") - buf = ctypes.create_unicode_buffer("abc") - self.failUnlessEqual(len(buf), 3+1) - - ctypes.set_conversion_mode("ascii", "replace") - buf = ctypes.create_unicode_buffer("abäöü") - self.failUnlessEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0") - - ctypes.set_conversion_mode("ascii", "ignore") - buf = ctypes.create_unicode_buffer("abäöü") - # is that correct? not sure. But with 'ignore', you get what you pay for.. - self.failUnlessEqual(buf[:], u"ab\0\0\0\0") - - import _ctypes_test - func = ctypes.CDLL(_ctypes_test.__file__)._testfunc_p_p - - class StringTestCase(UnicodeTestCase): - def setUp(self): - self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict") - func.argtypes = [ctypes.c_char_p] - func.restype = ctypes.c_char_p - - def tearDown(self): - ctypes.set_conversion_mode(*self.prev_conv_mode) - func.argtypes = None - func.restype = ctypes.c_int - - def test_ascii_replace(self): - ctypes.set_conversion_mode("ascii", "strict") - self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.assertRaises(ctypes.ArgumentError, func, u"abä") - - def test_ascii_ignore(self): - ctypes.set_conversion_mode("ascii", "ignore") - self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.failUnlessEqual(func(u"äöüß"), "") - - def test_ascii_replace(self): - ctypes.set_conversion_mode("ascii", "replace") - self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.failUnlessEqual(func(u"äöüß"), "????") - - def test_buffers(self): - ctypes.set_conversion_mode("ascii", "strict") - buf = ctypes.create_string_buffer(u"abc") - self.failUnlessEqual(len(buf), 3+1) - - ctypes.set_conversion_mode("ascii", "replace") - buf = ctypes.create_string_buffer(u"abäöü") - self.failUnlessEqual(buf[:], "ab???\0") - - ctypes.set_conversion_mode("ascii", "ignore") - buf = ctypes.create_string_buffer(u"abäöü") - # is that correct? not sure. But with 'ignore', you get what you pay for.. - self.failUnlessEqual(buf[:], "ab\0\0\0\0") - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_values.py b/sys/lib/python/ctypes/test/test_values.py deleted file mode 100644 index 7ba3e21ef..000000000 --- a/sys/lib/python/ctypes/test/test_values.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -A testcase which accesses *values* in a dll. -""" - -import unittest -from ctypes import * - -import _ctypes_test - -class ValuesTestCase(unittest.TestCase): - - def test_an_integer(self): - ctdll = CDLL(_ctypes_test.__file__) - an_integer = c_int.in_dll(ctdll, "an_integer") - x = an_integer.value - self.failUnlessEqual(x, ctdll.get_an_integer()) - an_integer.value *= 2 - self.failUnlessEqual(x*2, ctdll.get_an_integer()) - - def test_undefined(self): - ctdll = CDLL(_ctypes_test.__file__) - self.assertRaises(ValueError, c_int.in_dll, ctdll, "Undefined_Symbol") - - class Win_ValuesTestCase(unittest.TestCase): - """This test only works when python itself is a dll/shared library""" - - def test_optimizeflag(self): - # This test accesses the Py_OptimizeFlag intger, which is - # exported by the Python dll. - - # It's value is set depending on the -O and -OO flags: - # if not given, it is 0 and __debug__ is 1. - # If -O is given, the flag is 1, for -OO it is 2. - # docstrings are also removed in the latter case. - opt = c_int.in_dll(pydll, "Py_OptimizeFlag").value - if __debug__: - self.failUnlessEqual(opt, 0) - elif ValuesTestCase.__doc__ is not None: - self.failUnlessEqual(opt, 1) - else: - self.failUnlessEqual(opt, 2) - - def test_frozentable(self): - # Python exports a PyImport_FrozenModules symbol. This is a - # pointer to an array of struct _frozen entries. The end of the - # array is marked by an entry containing a NULL name and zero - # size. - - # In standard Python, this table contains a __hello__ - # module, and a __phello__ package containing a spam - # module. - class struct_frozen(Structure): - _fields_ = [("name", c_char_p), - ("code", POINTER(c_ubyte)), - ("size", c_int)] - FrozenTable = POINTER(struct_frozen) - - ft = FrozenTable.in_dll(pydll, "PyImport_FrozenModules") - # ft is a pointer to the struct_frozen entries: - items = [] - for entry in ft: - # This is dangerous. We *can* iterate over a pointer, but - # the loop will not terminate (maybe with an access - # violation;-) because the pointer instance has no size. - if entry.name is None: - break - items.append((entry.name, entry.size)) - import sys - if sys.version_info[:2] >= (2, 3): - expected = [("__hello__", 104), ("__phello__", -104), ("__phello__.spam", 104)] - else: - expected = [("__hello__", 100), ("__phello__", -100), ("__phello__.spam", 100)] - self.failUnlessEqual(items, expected) - - from ctypes import _pointer_type_cache - del _pointer_type_cache[struct_frozen] - - def test_undefined(self): - self.assertRaises(ValueError, c_int.in_dll, pydll, "Undefined_Symbol") - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_varsize_struct.py b/sys/lib/python/ctypes/test/test_varsize_struct.py deleted file mode 100644 index 06d232315..000000000 --- a/sys/lib/python/ctypes/test/test_varsize_struct.py +++ /dev/null @@ -1,50 +0,0 @@ -from ctypes import * -import unittest - -class VarSizeTest(unittest.TestCase): - def test_resize(self): - class X(Structure): - _fields_ = [("item", c_int), - ("array", c_int * 1)] - - self.failUnlessEqual(sizeof(X), sizeof(c_int) * 2) - x = X() - x.item = 42 - x.array[0] = 100 - self.failUnlessEqual(sizeof(x), sizeof(c_int) * 2) - - # make room for one additional item - new_size = sizeof(X) + sizeof(c_int) * 1 - resize(x, new_size) - self.failUnlessEqual(sizeof(x), new_size) - self.failUnlessEqual((x.item, x.array[0]), (42, 100)) - - # make room for 10 additional items - new_size = sizeof(X) + sizeof(c_int) * 9 - resize(x, new_size) - self.failUnlessEqual(sizeof(x), new_size) - self.failUnlessEqual((x.item, x.array[0]), (42, 100)) - - # make room for one additional item - new_size = sizeof(X) + sizeof(c_int) * 1 - resize(x, new_size) - self.failUnlessEqual(sizeof(x), new_size) - self.failUnlessEqual((x.item, x.array[0]), (42, 100)) - - def test_array_invalid_length(self): - # cannot create arrays with non-positive size - self.failUnlessRaises(ValueError, lambda: c_int * -1) - self.failUnlessRaises(ValueError, lambda: c_int * -3) - - def test_zerosized_array(self): - array = (c_int * 0)() - # accessing elements of zero-sized arrays raise IndexError - self.failUnlessRaises(IndexError, array.__setitem__, 0, None) - self.failUnlessRaises(IndexError, array.__getitem__, 0) - self.failUnlessRaises(IndexError, array.__setitem__, 1, None) - self.failUnlessRaises(IndexError, array.__getitem__, 1) - self.failUnlessRaises(IndexError, array.__setitem__, -1, None) - self.failUnlessRaises(IndexError, array.__getitem__, -1) - -if __name__ == "__main__": - unittest.main() diff --git a/sys/lib/python/ctypes/test/test_win32.py b/sys/lib/python/ctypes/test/test_win32.py deleted file mode 100644 index db530d3af..000000000 --- a/sys/lib/python/ctypes/test/test_win32.py +++ /dev/null @@ -1,60 +0,0 @@ -# Windows specific tests - -from ctypes import * -from ctypes.test import is_resource_enabled -import unittest, sys - -import _ctypes_test - -if sys.platform == "win32": - - class WindowsTestCase(unittest.TestCase): - def test_callconv_1(self): - # Testing stdcall function - - IsWindow = windll.user32.IsWindow - # ValueError: Procedure probably called with not enough arguments (4 bytes missing) - self.assertRaises(ValueError, IsWindow) - - # This one should succeeed... - self.failUnlessEqual(0, IsWindow(0)) - - # ValueError: Procedure probably called with too many arguments (8 bytes in excess) - self.assertRaises(ValueError, IsWindow, 0, 0, 0) - - def test_callconv_2(self): - # Calling stdcall function as cdecl - - IsWindow = cdll.user32.IsWindow - - # ValueError: Procedure called with not enough arguments (4 bytes missing) - # or wrong calling convention - self.assertRaises(ValueError, IsWindow, None) - - if is_resource_enabled("SEH"): - def test_SEH(self): - # Call functions with invalid arguments, and make sure that access violations - # are trapped and raise an exception. - self.assertRaises(WindowsError, windll.kernel32.GetModuleHandleA, 32) - -class Structures(unittest.TestCase): - - def test_struct_by_value(self): - class POINT(Structure): - _fields_ = [("x", c_long), - ("y", c_long)] - - class RECT(Structure): - _fields_ = [("left", c_long), - ("top", c_long), - ("right", c_long), - ("bottom", c_long)] - - dll = CDLL(_ctypes_test.__file__) - - pt = POINT(10, 10) - rect = RECT(0, 0, 20, 20) - self.failUnlessEqual(1, dll.PointInRect(byref(rect), pt)) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/email/test/__init__.py b/sys/lib/python/email/test/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/sys/lib/python/email/test/__init__.py +++ /dev/null diff --git a/sys/lib/python/email/test/data/PyBanner048.gif b/sys/lib/python/email/test/data/PyBanner048.gif Binary files differdeleted file mode 100644 index 1a5c87f64..000000000 --- a/sys/lib/python/email/test/data/PyBanner048.gif +++ /dev/null diff --git a/sys/lib/python/email/test/data/audiotest.au b/sys/lib/python/email/test/data/audiotest.au Binary files differdeleted file mode 100644 index 1ad28ce1f..000000000 --- a/sys/lib/python/email/test/data/audiotest.au +++ /dev/null diff --git a/sys/lib/python/email/test/data/msg_01.txt b/sys/lib/python/email/test/data/msg_01.txt deleted file mode 100644 index 7e33bcf96..000000000 --- a/sys/lib/python/email/test/data/msg_01.txt +++ /dev/null @@ -1,19 +0,0 @@ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) - id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 - - -Hi, - -Do you like this message? - --Me diff --git a/sys/lib/python/email/test/data/msg_02.txt b/sys/lib/python/email/test/data/msg_02.txt deleted file mode 100644 index 43f248038..000000000 --- a/sys/lib/python/email/test/data/msg_02.txt +++ /dev/null @@ -1,135 +0,0 @@ -MIME-version: 1.0 -From: ppp-request@zzz.org -Sender: ppp-admin@zzz.org -To: ppp@zzz.org -Subject: Ppp digest, Vol 1 #2 - 5 msgs -Date: Fri, 20 Apr 2001 20:18:00 -0400 (EDT) -X-Mailer: Mailman v2.0.4 -X-Mailman-Version: 2.0.4 -Content-Type: multipart/mixed; boundary="192.168.1.2.889.32614.987812255.500.21814" - ---192.168.1.2.889.32614.987812255.500.21814 -Content-type: text/plain; charset=us-ascii -Content-description: Masthead (Ppp digest, Vol 1 #2) - -Send Ppp mailing list submissions to - ppp@zzz.org - -To subscribe or unsubscribe via the World Wide Web, visit - http://www.zzz.org/mailman/listinfo/ppp -or, via email, send a message with subject or body 'help' to - ppp-request@zzz.org - -You can reach the person managing the list at - ppp-admin@zzz.org - -When replying, please edit your Subject line so it is more specific -than "Re: Contents of Ppp digest..." - - ---192.168.1.2.889.32614.987812255.500.21814 -Content-type: text/plain; charset=us-ascii -Content-description: Today's Topics (5 msgs) - -Today's Topics: - - 1. testing #1 (Barry A. Warsaw) - 2. testing #2 (Barry A. Warsaw) - 3. testing #3 (Barry A. Warsaw) - 4. testing #4 (Barry A. Warsaw) - 5. testing #5 (Barry A. Warsaw) - ---192.168.1.2.889.32614.987812255.500.21814 -Content-Type: multipart/digest; boundary="__--__--" - ---__--__-- - -Message: 1 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -Date: Fri, 20 Apr 2001 20:16:13 -0400 -To: ppp@zzz.org -From: barry@digicool.com (Barry A. Warsaw) -Subject: [Ppp] testing #1 -Precedence: bulk - - -hello - - ---__--__-- - -Message: 2 -Date: Fri, 20 Apr 2001 20:16:21 -0400 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -To: ppp@zzz.org -From: barry@digicool.com (Barry A. Warsaw) -Precedence: bulk - - -hello - - ---__--__-- - -Message: 3 -Date: Fri, 20 Apr 2001 20:16:25 -0400 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -To: ppp@zzz.org -From: barry@digicool.com (Barry A. Warsaw) -Subject: [Ppp] testing #3 -Precedence: bulk - - -hello - - ---__--__-- - -Message: 4 -Date: Fri, 20 Apr 2001 20:16:28 -0400 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -To: ppp@zzz.org -From: barry@digicool.com (Barry A. Warsaw) -Subject: [Ppp] testing #4 -Precedence: bulk - - -hello - - ---__--__-- - -Message: 5 -Date: Fri, 20 Apr 2001 20:16:32 -0400 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -To: ppp@zzz.org -From: barry@digicool.com (Barry A. Warsaw) -Subject: [Ppp] testing #5 -Precedence: bulk - - -hello - - - - ---__--__---- ---192.168.1.2.889.32614.987812255.500.21814 -Content-type: text/plain; charset=us-ascii -Content-description: Digest Footer - -_______________________________________________ -Ppp mailing list -Ppp@zzz.org -http://www.zzz.org/mailman/listinfo/ppp - - ---192.168.1.2.889.32614.987812255.500.21814-- - -End of Ppp Digest - diff --git a/sys/lib/python/email/test/data/msg_03.txt b/sys/lib/python/email/test/data/msg_03.txt deleted file mode 100644 index c748ebf11..000000000 --- a/sys/lib/python/email/test/data/msg_03.txt +++ /dev/null @@ -1,16 +0,0 @@ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) - id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 - - -Hi, - -Do you like this message? - --Me diff --git a/sys/lib/python/email/test/data/msg_04.txt b/sys/lib/python/email/test/data/msg_04.txt deleted file mode 100644 index 1f633c449..000000000 --- a/sys/lib/python/email/test/data/msg_04.txt +++ /dev/null @@ -1,37 +0,0 @@ -Return-Path: <barry@python.org> -Delivered-To: barry@python.org -Received: by mail.python.org (Postfix, from userid 889) - id C2BF0D37C6; Tue, 11 Sep 2001 00:05:05 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="h90VIIIKmx" -Content-Transfer-Encoding: 7bit -Message-ID: <15261.36209.358846.118674@anthem.python.org> -From: barry@python.org (Barry A. Warsaw) -To: barry@python.org -Subject: a simple multipart -Date: Tue, 11 Sep 2001 00:05:05 -0400 -X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid -X-Attribution: BAW -X-Oblique-Strategy: Make a door into a window - - ---h90VIIIKmx -Content-Type: text/plain -Content-Disposition: inline; - filename="msg.txt" -Content-Transfer-Encoding: 7bit - -a simple kind of mirror -to reflect upon our own - ---h90VIIIKmx -Content-Type: text/plain -Content-Disposition: inline; - filename="msg.txt" -Content-Transfer-Encoding: 7bit - -a simple kind of mirror -to reflect upon our own - ---h90VIIIKmx-- - diff --git a/sys/lib/python/email/test/data/msg_05.txt b/sys/lib/python/email/test/data/msg_05.txt deleted file mode 100644 index 87d5e9cbf..000000000 --- a/sys/lib/python/email/test/data/msg_05.txt +++ /dev/null @@ -1,28 +0,0 @@ -From: foo -Subject: bar -To: baz -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - boundary="D1690A7AC1.996856090/mail.example.com" -Message-Id: <20010803162810.0CA8AA7ACC@mail.example.com> - -This is a MIME-encapsulated message. - ---D1690A7AC1.996856090/mail.example.com -Content-Type: text/plain - -Yadda yadda yadda - ---D1690A7AC1.996856090/mail.example.com - -Yadda yadda yadda - ---D1690A7AC1.996856090/mail.example.com -Content-Type: message/rfc822 - -From: nobody@python.org - -Yadda yadda yadda - ---D1690A7AC1.996856090/mail.example.com-- - diff --git a/sys/lib/python/email/test/data/msg_06.txt b/sys/lib/python/email/test/data/msg_06.txt deleted file mode 100644 index 69f3a47ff..000000000 --- a/sys/lib/python/email/test/data/msg_06.txt +++ /dev/null @@ -1,33 +0,0 @@ -Return-Path: <barry@python.org> -Delivered-To: barry@python.org -MIME-Version: 1.0 -Content-Type: message/rfc822 -Content-Description: forwarded message -Content-Transfer-Encoding: 7bit -Message-ID: <15265.9482.641338.555352@python.org> -From: barry@zope.com (Barry A. Warsaw) -Sender: barry@python.org -To: barry@python.org -Subject: forwarded message from Barry A. Warsaw -Date: Thu, 13 Sep 2001 17:28:42 -0400 -X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid -X-Attribution: BAW -X-Oblique-Strategy: Be dirty -X-Url: http://barry.wooz.org - -MIME-Version: 1.0 -Content-Type: text/plain; charset=us-ascii -Return-Path: <barry@python.org> -Delivered-To: barry@python.org -Message-ID: <15265.9468.713530.98441@python.org> -From: barry@zope.com (Barry A. Warsaw) -Sender: barry@python.org -To: barry@python.org -Subject: testing -Date: Thu, 13 Sep 2001 17:28:28 -0400 -X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid -X-Attribution: BAW -X-Oblique-Strategy: Spectrum analysis -X-Url: http://barry.wooz.org - - diff --git a/sys/lib/python/email/test/data/msg_07.txt b/sys/lib/python/email/test/data/msg_07.txt deleted file mode 100644 index 721f3a0d3..000000000 --- a/sys/lib/python/email/test/data/msg_07.txt +++ /dev/null @@ -1,83 +0,0 @@ -MIME-Version: 1.0 -From: Barry <barry@digicool.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Here is your dingus fish -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - -Hi there, - -This is the dingus fish. - ---BOUNDARY -Content-Type: image/gif; name="dingusfish.gif" -Content-Transfer-Encoding: base64 -content-disposition: attachment; filename="dingusfish.gif" - -R0lGODdhAAEAAfAAAP///wAAACwAAAAAAAEAAQAC/oSPqcvtD6OctNqLs968+w+G4kiW5omm6sq2 -7gvH8kzX9o3n+s73/g8MCofEovGITGICTKbyCV0FDNOo9SqpQqpOrJfXzTQj2vD3TGtqL+NtGQ2f -qTXmxzuOd7WXdcc9DyjU53ewFni4s0fGhdiYaEhGBelICTNoV1j5NUnFcrmUqemjNifJVWpaOqaI -oFq3SspZsSraE7sHq3jr1MZqWvi662vxV4tD+pvKW6aLDOCLyur8PDwbanyDeq0N3DctbQYeLDvR -RY6t95m6UB0d3mwIrV7e2VGNvjjffukeJp4w7F65KecGFsTHQGAygOrgrWs1jt28Rc88KESYcGLA -/obvTkH6p+CinWJiJmIMqXGQwH/y4qk0SYjgQTczT3ajKZGfuI0uJ4kkVI/DT5s3/ejkxI0aT4Y+ -YTYgWbImUaXk9nlLmnSh1qJiJFl0OpUqRK4oOy7NyRQtHWofhoYVxkwWXKUSn0YsS+fUV6lhqfYb -6ayd3Z5qQdG1B7bvQzaJjwUV2lixMUZ7JVsOlfjWVr/3NB/uFvnySBN6Dcb6rGwaRM3wsormw5cC -M9NxWy/bWdufudCvy8bOAjXjVVwta/uO21sE5RHBCzNFXtgq9ORtH4eYjVP4Yryo026nvkFmCeyA -B29efV6ravCMK5JwWd5897Qrx7ll38o6iHDZ/rXPR//feevhF4l7wjUGX3xq1eeRfM4RSJGBIV1D -z1gKPkfWag3mVBVvva1RlX5bAJTPR/2YqNtw/FkIYYEi/pIZiAdpcxpoHtmnYYoZtvhUftzdx5ZX -JSKDW405zkGcZzzGZ6KEv4FI224oDmijlEf+xp6MJK5ojY/ASeVUR+wsKRuJ+XFZ5o7ZeEime8t1 -ouUsU6YjF5ZtUihhkGfCdFQLWQFJ3UXxmElfhQnR+eCdcDbkFZp6vTRmj56ApCihn5QGpaToNZmR -n3NVSpZcQpZ2KEONusaiCsKAug0wkQbJSFO+PTSjneGxOuFjPlUk3ovWvdIerjUg9ZGIOtGq/qeX -eCYrrCX+1UPsgTKGGRSbzd5q156d/gpfbJxe66eD5iQKrXj7RGgruGxs62qebBHUKS32CKluCiqZ -qh+pmehmEb71noAUoe5e9Zm17S7773V10pjrtG4CmuurCV/n6zLK5turWNhqOvFXbjhZrMD0YhKe -wR0zOyuvsh6MWrGoIuzvyWu5y1WIFAqmJselypxXh6dKLNOKEB98L88bS2rkNqqlKzCNJp9c0G0j -Gzh0iRrCbHSXmPR643QS+4rWhgFmnSbSuXCjS0xAOWkU2UdLqyuUNfHSFdUouy3bm5i5GnDM3tG8 -doJ4r5tqu3pPbRSVfvs8uJzeNXhp3n4j/tZ42SwH7eaWUUOjc3qFV9453UHTXZfcLH+OeNs5g36x -lBnHvTm7EbMbLeuaLncao8vWCXimfo1o+843Ak6y4ChNeGntvAYvfLK4ezmoyNIbNCLTCXO9ZV3A -E8/s88RczPzDwI4Ob7XZyl7+9Miban29h+tJZPrE21wgvBphDfrrfPdCTPKJD/y98L1rZwHcV6Jq -Zab0metpuNIX/qAFPoz171WUaUb4HAhBSzHuHfjzHb3kha/2Cctis/ORArVHNYfFyYRH2pYIRzic -isVOfPWD1b6mRTqpCRBozzof6UZVvFXRxWIr3GGrEviGYgyPMfahheiSaLs/9QeFu7oZ/ndSY8DD -ya9x+uPed+7mxN2IzIISBOMLFYWVqC3Pew1T2nFuuCiwZS5/v6II10i4t1OJcUH2U9zxKodHsGGv -Oa+zkvNUYUOa/TCCRutF9MzDwdlUMJADTCGSbDQ5OV4PTamDoPEi6Ecc/RF5RWwkcdSXvSOaDWSn -I9LlvubFTQpuc6JKXLcKeb+xdbKRBnwREemXyjg6ME65aJiOuBgrktzykfPLJBKR9ClMavJ62/Ff -BlNIyod9yX9wcSXexnXFpvkrbXk64xsx5Db7wXKP5fSgsvwIMM/9631VLBfkmtbHRXpqmtei52hG -pUwSlo+BASQoeILDOBgREECxBBh5/iYmNsQ9dIv5+OI++QkqdsJPc3uykz5fkM+OraeekcQF7X4n -B5S67za5U967PmooGQhUXfF7afXyCD7ONdRe17QogYjVx38uLwtrS6nhTnm15LQUnu9E2uK6CNI/ -1HOABj0ESwOjut4FEpFQpdNAm4K2LHnDWHNcmKB2ioKBogysVZtMO2nSxUdZ8Yk2kJc7URioLVI0 -YgmtIwZj4LoeKemgnOnbUdGnzZ4Oa6scqiolBGqS6RgWNLu0RMhcaE6rhhU4hiuqFXPAG8fGwTPW -FKeLMtdVmXLSs5YJGF/YeVm7rREMlY3UYE+yCxbaMXX8y15m5zVHq6GOKDMynzII/jdUHdyVqIy0 -ifX2+r/EgtZcvRzSb72gU9ui87M2VecjKildW/aFqaYhKoryUjfB/g4qtyVuc60xFDGmCxwjW+qu -zjuwl2GkOWn66+3QiiEctvd04OVvcCVzjgT7lrkvjVGKKHmmlDUKowSeikb5kK/mJReuWOxONx+s -ULsl+Lqb0CVn0SrVyJ6wt4t6yTeSCafhPhAf0OXn6L60UMxiLolFAtmN35S2Ob1lZpQ1r/n0Qb5D -oQ1zJiRVDgF8N3Q8TYfbi3DyWCy3lT1nxyBs6FT3S2GOzWRlxwKvlRP0RPJA9SjxEy0UoEnkA+M4 -cnzLMJrBGWLFEaaUb5lvpqbq/loOaU5+DFuHPxo82/OZuM8FXG3oVNZhtWpMpb/0Xu5m/LfLhHZQ -7yuVI0MqZ7NE43imC8jH3IwGZlbPm0xkJYs7+2U48hXTsFSMqgGDvai0kLxyynKNT/waj+q1c1tz -GjOpPBgdCSq3UKZxCSsqFIY+O6JbAWGWcV1pwqLyj5sGqCF1xb1F3varUWqrJv6cN3PrUXzijtfZ -FshpBL3Xwr4GIPvU2N8EjrJgS1zl21rbXQMXeXc5jjFyrhpCzijSv/RQtyPSzHCFMhlME95fHglt -pRsX+dfSQjUeHAlpWzJ5iOo79Ldnaxai6bXTcGO3fp07ri7HLEmXXPlYi8bv/qVxvNcdra6m7Rlb -6JBTb5fd66VhFRjGArh2n7R1rDW4P5NOT9K0I183T2scYkeZ3q/VFyLb09U9ajzXBS8Kgkhc4mBS -kYY9cy3Vy9lUnuNJH8HGIclUilwnBtjUOH0gteGOZ4c/XNrhXLSYDyxfnD8z1pDy7rYRvDolhnbe -UMzxCZUs40s6s7UIvBnLgc0+vKuOkIXeOrDymlp+Zxra4MZLBbVrqD/jTJ597pDmnw5c4+DbyB88 -9Cg9DodYcSuMZT/114pptqc/EuTjRPvH/z5slzI3tluOEBBLqOXLOX+0I5929tO97wkvl/atCz+y -xJrdwteW2FNW/NSmBP+f/maYtVs/bYyBC7Ox3jsYZHL05CIrBa/nS+b3bHfiYm4Ueil1YZZSgAUI -fFZ1dxUmeA2oQRQ3RuGXNGLFV9/XbGFGPV6kfzk1TBBCd+izc7q1H+OHMJwmaBX2IQNYVAKHYepV -SSGCe6CnbYHHETKGNe43EDvFgZr0gB/nVHPHZ80VV1ojOiI3XDvYIkl4ayo4bxQIgrFXWTvBI0nH -VElWMuw2aLUWCRHHf8ymVCHjFlJnOSojfevCYyyyZDH0IcvHhrsnQ5O1OsWzONuVVKIxSxiFZ/tR -fKDAf6xFTnw4O9Qig2VCfW2hJQrmMOuHW0W3dLQmCMO2ccdUd/xyfflH/olTiHZVdGwb8nIwRzSE -J15jFlOJuBZBZ4CiyHyd2IFylFlB+HgHhYabhWOGwYO1ZH/Og1dtQlFMk352CGRSIFTapnWQEUtN -l4zv8S0aaCFDyGCBqDUxZYpxGHX01y/JuH1xhn7TOCnNCI4eKDs5WGX4R425F4vF1o3BJ4vO0otq -I3rimI7jJY1jISqnBxknCIvruF83mF5wN4X7qGLIhR8A2Vg0yFERSIXn9Vv3GHy3Vj/WIkKddlYi -yIMv2I/VMjTLpW7pt05SWIZR0RPyxpB4SIUM9lBPGBl0GC7oSEEwRYLe4pJpZY2P0zbI1n+Oc44w -qY3PUnmF0ixjVpDD/mJ9wpOBGTVgXlaCaZiPcIWK5NiKBIiPdGaQ0TWGvAiG7nMchdZb7Vgf8zNi -MuMyzRdy/lePe9iC4TRx7WhhOQI/QiSVNAmAa2lT/piFbuh7ofJoYSZzrSZ1bvmWw3eN2nKUPVky -uPN5/VRfohRd0VYZoqhKIlU6TXYhJxmPUIloAwc1bPmHEpaZYZORHNlXUJM07hATwHR8MJYqkwWR -WaIezFhxSFlc8/Fq82hEnpeRozg3ULhhr9lAGtVEkCg5ZNRuuVleBPaZadhG0ZgkyPmDOTOKzViM -YgOcpukKqQcbjAWS0IleQ2ROjdh6A+md1qWdBRSX7iSYgFRTtRmBpJioieXJiHfJiMGIR9fJOn8I -MSfXYhspn4ooSa2mSAj4n+8Bmg03fBJZoPOJgsVZRxu1oOMRPXYYjdqjihFaEoZpXBREanuJoRI6 -cibFinq4ngUKh/wQd/H5ofYCZ0HJXR62opZFaAT0iFIZo4DIiUojkjeqKiuoZirKo5Y1a7AWckGa -BkuYoD5lpDK6eUs6CkDqpETwl1EqpfhJpVeKpVl6EgUAADs= - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_08.txt b/sys/lib/python/email/test/data/msg_08.txt deleted file mode 100644 index b5630836c..000000000 --- a/sys/lib/python/email/test/data/msg_08.txt +++ /dev/null @@ -1,24 +0,0 @@ -MIME-Version: 1.0 -From: Barry Warsaw <barry@zope.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Lyrics -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/html; charset="iso-8859-1" - - ---BOUNDARY -Content-Type: text/plain; charset="iso-8859-2" - - ---BOUNDARY -Content-Type: text/plain; charset="koi8-r" - - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_09.txt b/sys/lib/python/email/test/data/msg_09.txt deleted file mode 100644 index 575c4c205..000000000 --- a/sys/lib/python/email/test/data/msg_09.txt +++ /dev/null @@ -1,24 +0,0 @@ -MIME-Version: 1.0 -From: Barry Warsaw <barry@zope.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Lyrics -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/html; charset="iso-8859-1" - - ---BOUNDARY -Content-Type: text/plain - - ---BOUNDARY -Content-Type: text/plain; charset="koi8-r" - - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_10.txt b/sys/lib/python/email/test/data/msg_10.txt deleted file mode 100644 index bd30d13ad..000000000 --- a/sys/lib/python/email/test/data/msg_10.txt +++ /dev/null @@ -1,32 +0,0 @@ -MIME-Version: 1.0 -From: Barry Warsaw <barry@zope.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Lyrics -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit - -This is a 7bit encoded message. - ---BOUNDARY -Content-Type: text/html; charset="iso-8859-1" -Content-Transfer-Encoding: Quoted-Printable - -=A1This is a Quoted Printable encoded message! - ---BOUNDARY -Content-Type: text/plain; charset="iso-8859-1" -Content-Transfer-Encoding: Base64 - -VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2Uu - - ---BOUNDARY -Content-Type: text/plain; charset="iso-8859-1" - -This has no Content-Transfer-Encoding: header. - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_11.txt b/sys/lib/python/email/test/data/msg_11.txt deleted file mode 100644 index 8f7f1991c..000000000 --- a/sys/lib/python/email/test/data/msg_11.txt +++ /dev/null @@ -1,7 +0,0 @@ -Content-Type: message/rfc822 -MIME-Version: 1.0 -Subject: The enclosing message - -Subject: An enclosed message - -Here is the body of the message. diff --git a/sys/lib/python/email/test/data/msg_12.txt b/sys/lib/python/email/test/data/msg_12.txt deleted file mode 100644 index 4bec8d944..000000000 --- a/sys/lib/python/email/test/data/msg_12.txt +++ /dev/null @@ -1,36 +0,0 @@ -MIME-Version: 1.0 -From: Barry Warsaw <barry@zope.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Lyrics -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/html; charset="iso-8859-1" - - ---BOUNDARY -Content-Type: multipart/mixed; boundary="ANOTHER" - ---ANOTHER -Content-Type: text/plain; charset="iso-8859-2" - - ---ANOTHER -Content-Type: text/plain; charset="iso-8859-3" - ---ANOTHER-- - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/plain; charset="koi8-r" - - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_12a.txt b/sys/lib/python/email/test/data/msg_12a.txt deleted file mode 100644 index e94224ecf..000000000 --- a/sys/lib/python/email/test/data/msg_12a.txt +++ /dev/null @@ -1,38 +0,0 @@ -MIME-Version: 1.0 -From: Barry Warsaw <barry@zope.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Lyrics -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/html; charset="iso-8859-1" - - ---BOUNDARY -Content-Type: multipart/mixed; boundary="ANOTHER" - ---ANOTHER -Content-Type: text/plain; charset="iso-8859-2" - - ---ANOTHER -Content-Type: text/plain; charset="iso-8859-3" - - ---ANOTHER-- - - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - - ---BOUNDARY -Content-Type: text/plain; charset="koi8-r" - - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_13.txt b/sys/lib/python/email/test/data/msg_13.txt deleted file mode 100644 index 8e6d52d5b..000000000 --- a/sys/lib/python/email/test/data/msg_13.txt +++ /dev/null @@ -1,94 +0,0 @@ -MIME-Version: 1.0 -From: Barry <barry@digicool.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Here is your dingus fish -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="OUTER" - ---OUTER -Content-Type: text/plain; charset="us-ascii" - -A text/plain part - ---OUTER -Content-Type: multipart/mixed; boundary=BOUNDARY - - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" - -Hi there, - -This is the dingus fish. - ---BOUNDARY -Content-Type: image/gif; name="dingusfish.gif" -Content-Transfer-Encoding: base64 -content-disposition: attachment; filename="dingusfish.gif" - -R0lGODdhAAEAAfAAAP///wAAACwAAAAAAAEAAQAC/oSPqcvtD6OctNqLs968+w+G4kiW5omm6sq2 -7gvH8kzX9o3n+s73/g8MCofEovGITGICTKbyCV0FDNOo9SqpQqpOrJfXzTQj2vD3TGtqL+NtGQ2f -qTXmxzuOd7WXdcc9DyjU53ewFni4s0fGhdiYaEhGBelICTNoV1j5NUnFcrmUqemjNifJVWpaOqaI -oFq3SspZsSraE7sHq3jr1MZqWvi662vxV4tD+pvKW6aLDOCLyur8PDwbanyDeq0N3DctbQYeLDvR -RY6t95m6UB0d3mwIrV7e2VGNvjjffukeJp4w7F65KecGFsTHQGAygOrgrWs1jt28Rc88KESYcGLA -/obvTkH6p+CinWJiJmIMqXGQwH/y4qk0SYjgQTczT3ajKZGfuI0uJ4kkVI/DT5s3/ejkxI0aT4Y+ -YTYgWbImUaXk9nlLmnSh1qJiJFl0OpUqRK4oOy7NyRQtHWofhoYVxkwWXKUSn0YsS+fUV6lhqfYb -6ayd3Z5qQdG1B7bvQzaJjwUV2lixMUZ7JVsOlfjWVr/3NB/uFvnySBN6Dcb6rGwaRM3wsormw5cC -M9NxWy/bWdufudCvy8bOAjXjVVwta/uO21sE5RHBCzNFXtgq9ORtH4eYjVP4Yryo026nvkFmCeyA -B29efV6ravCMK5JwWd5897Qrx7ll38o6iHDZ/rXPR//feevhF4l7wjUGX3xq1eeRfM4RSJGBIV1D -z1gKPkfWag3mVBVvva1RlX5bAJTPR/2YqNtw/FkIYYEi/pIZiAdpcxpoHtmnYYoZtvhUftzdx5ZX -JSKDW405zkGcZzzGZ6KEv4FI224oDmijlEf+xp6MJK5ojY/ASeVUR+wsKRuJ+XFZ5o7ZeEime8t1 -ouUsU6YjF5ZtUihhkGfCdFQLWQFJ3UXxmElfhQnR+eCdcDbkFZp6vTRmj56ApCihn5QGpaToNZmR -n3NVSpZcQpZ2KEONusaiCsKAug0wkQbJSFO+PTSjneGxOuFjPlUk3ovWvdIerjUg9ZGIOtGq/qeX -eCYrrCX+1UPsgTKGGRSbzd5q156d/gpfbJxe66eD5iQKrXj7RGgruGxs62qebBHUKS32CKluCiqZ -qh+pmehmEb71noAUoe5e9Zm17S7773V10pjrtG4CmuurCV/n6zLK5turWNhqOvFXbjhZrMD0YhKe -wR0zOyuvsh6MWrGoIuzvyWu5y1WIFAqmJselypxXh6dKLNOKEB98L88bS2rkNqqlKzCNJp9c0G0j -Gzh0iRrCbHSXmPR643QS+4rWhgFmnSbSuXCjS0xAOWkU2UdLqyuUNfHSFdUouy3bm5i5GnDM3tG8 -doJ4r5tqu3pPbRSVfvs8uJzeNXhp3n4j/tZ42SwH7eaWUUOjc3qFV9453UHTXZfcLH+OeNs5g36x -lBnHvTm7EbMbLeuaLncao8vWCXimfo1o+843Ak6y4ChNeGntvAYvfLK4ezmoyNIbNCLTCXO9ZV3A -E8/s88RczPzDwI4Ob7XZyl7+9Miban29h+tJZPrE21wgvBphDfrrfPdCTPKJD/y98L1rZwHcV6Jq -Zab0metpuNIX/qAFPoz171WUaUb4HAhBSzHuHfjzHb3kha/2Cctis/ORArVHNYfFyYRH2pYIRzic -isVOfPWD1b6mRTqpCRBozzof6UZVvFXRxWIr3GGrEviGYgyPMfahheiSaLs/9QeFu7oZ/ndSY8DD -ya9x+uPed+7mxN2IzIISBOMLFYWVqC3Pew1T2nFuuCiwZS5/v6II10i4t1OJcUH2U9zxKodHsGGv -Oa+zkvNUYUOa/TCCRutF9MzDwdlUMJADTCGSbDQ5OV4PTamDoPEi6Ecc/RF5RWwkcdSXvSOaDWSn -I9LlvubFTQpuc6JKXLcKeb+xdbKRBnwREemXyjg6ME65aJiOuBgrktzykfPLJBKR9ClMavJ62/Ff -BlNIyod9yX9wcSXexnXFpvkrbXk64xsx5Db7wXKP5fSgsvwIMM/9631VLBfkmtbHRXpqmtei52hG -pUwSlo+BASQoeILDOBgREECxBBh5/iYmNsQ9dIv5+OI++QkqdsJPc3uykz5fkM+OraeekcQF7X4n -B5S67za5U967PmooGQhUXfF7afXyCD7ONdRe17QogYjVx38uLwtrS6nhTnm15LQUnu9E2uK6CNI/ -1HOABj0ESwOjut4FEpFQpdNAm4K2LHnDWHNcmKB2ioKBogysVZtMO2nSxUdZ8Yk2kJc7URioLVI0 -YgmtIwZj4LoeKemgnOnbUdGnzZ4Oa6scqiolBGqS6RgWNLu0RMhcaE6rhhU4hiuqFXPAG8fGwTPW -FKeLMtdVmXLSs5YJGF/YeVm7rREMlY3UYE+yCxbaMXX8y15m5zVHq6GOKDMynzII/jdUHdyVqIy0 -ifX2+r/EgtZcvRzSb72gU9ui87M2VecjKildW/aFqaYhKoryUjfB/g4qtyVuc60xFDGmCxwjW+qu -zjuwl2GkOWn66+3QiiEctvd04OVvcCVzjgT7lrkvjVGKKHmmlDUKowSeikb5kK/mJReuWOxONx+s -ULsl+Lqb0CVn0SrVyJ6wt4t6yTeSCafhPhAf0OXn6L60UMxiLolFAtmN35S2Ob1lZpQ1r/n0Qb5D -oQ1zJiRVDgF8N3Q8TYfbi3DyWCy3lT1nxyBs6FT3S2GOzWRlxwKvlRP0RPJA9SjxEy0UoEnkA+M4 -cnzLMJrBGWLFEaaUb5lvpqbq/loOaU5+DFuHPxo82/OZuM8FXG3oVNZhtWpMpb/0Xu5m/LfLhHZQ -7yuVI0MqZ7NE43imC8jH3IwGZlbPm0xkJYs7+2U48hXTsFSMqgGDvai0kLxyynKNT/waj+q1c1tz -GjOpPBgdCSq3UKZxCSsqFIY+O6JbAWGWcV1pwqLyj5sGqCF1xb1F3varUWqrJv6cN3PrUXzijtfZ -FshpBL3Xwr4GIPvU2N8EjrJgS1zl21rbXQMXeXc5jjFyrhpCzijSv/RQtyPSzHCFMhlME95fHglt -pRsX+dfSQjUeHAlpWzJ5iOo79Ldnaxai6bXTcGO3fp07ri7HLEmXXPlYi8bv/qVxvNcdra6m7Rlb -6JBTb5fd66VhFRjGArh2n7R1rDW4P5NOT9K0I183T2scYkeZ3q/VFyLb09U9ajzXBS8Kgkhc4mBS -kYY9cy3Vy9lUnuNJH8HGIclUilwnBtjUOH0gteGOZ4c/XNrhXLSYDyxfnD8z1pDy7rYRvDolhnbe -UMzxCZUs40s6s7UIvBnLgc0+vKuOkIXeOrDymlp+Zxra4MZLBbVrqD/jTJ597pDmnw5c4+DbyB88 -9Cg9DodYcSuMZT/114pptqc/EuTjRPvH/z5slzI3tluOEBBLqOXLOX+0I5929tO97wkvl/atCz+y -xJrdwteW2FNW/NSmBP+f/maYtVs/bYyBC7Ox3jsYZHL05CIrBa/nS+b3bHfiYm4Ueil1YZZSgAUI -fFZ1dxUmeA2oQRQ3RuGXNGLFV9/XbGFGPV6kfzk1TBBCd+izc7q1H+OHMJwmaBX2IQNYVAKHYepV -SSGCe6CnbYHHETKGNe43EDvFgZr0gB/nVHPHZ80VV1ojOiI3XDvYIkl4ayo4bxQIgrFXWTvBI0nH -VElWMuw2aLUWCRHHf8ymVCHjFlJnOSojfevCYyyyZDH0IcvHhrsnQ5O1OsWzONuVVKIxSxiFZ/tR -fKDAf6xFTnw4O9Qig2VCfW2hJQrmMOuHW0W3dLQmCMO2ccdUd/xyfflH/olTiHZVdGwb8nIwRzSE -J15jFlOJuBZBZ4CiyHyd2IFylFlB+HgHhYabhWOGwYO1ZH/Og1dtQlFMk352CGRSIFTapnWQEUtN -l4zv8S0aaCFDyGCBqDUxZYpxGHX01y/JuH1xhn7TOCnNCI4eKDs5WGX4R425F4vF1o3BJ4vO0otq -I3rimI7jJY1jISqnBxknCIvruF83mF5wN4X7qGLIhR8A2Vg0yFERSIXn9Vv3GHy3Vj/WIkKddlYi -yIMv2I/VMjTLpW7pt05SWIZR0RPyxpB4SIUM9lBPGBl0GC7oSEEwRYLe4pJpZY2P0zbI1n+Oc44w -qY3PUnmF0ixjVpDD/mJ9wpOBGTVgXlaCaZiPcIWK5NiKBIiPdGaQ0TWGvAiG7nMchdZb7Vgf8zNi -MuMyzRdy/lePe9iC4TRx7WhhOQI/QiSVNAmAa2lT/piFbuh7ofJoYSZzrSZ1bvmWw3eN2nKUPVky -uPN5/VRfohRd0VYZoqhKIlU6TXYhJxmPUIloAwc1bPmHEpaZYZORHNlXUJM07hATwHR8MJYqkwWR -WaIezFhxSFlc8/Fq82hEnpeRozg3ULhhr9lAGtVEkCg5ZNRuuVleBPaZadhG0ZgkyPmDOTOKzViM -YgOcpukKqQcbjAWS0IleQ2ROjdh6A+md1qWdBRSX7iSYgFRTtRmBpJioieXJiHfJiMGIR9fJOn8I -MSfXYhspn4ooSa2mSAj4n+8Bmg03fBJZoPOJgsVZRxu1oOMRPXYYjdqjihFaEoZpXBREanuJoRI6 -cibFinq4ngUKh/wQd/H5ofYCZ0HJXR62opZFaAT0iFIZo4DIiUojkjeqKiuoZirKo5Y1a7AWckGa -BkuYoD5lpDK6eUs6CkDqpETwl1EqpfhJpVeKpVl6EgUAADs= - ---BOUNDARY-- - ---OUTER-- diff --git a/sys/lib/python/email/test/data/msg_14.txt b/sys/lib/python/email/test/data/msg_14.txt deleted file mode 100644 index 5d98d2fd1..000000000 --- a/sys/lib/python/email/test/data/msg_14.txt +++ /dev/null @@ -1,23 +0,0 @@ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) - id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: text; charset=us-ascii -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 - - -Hi, - -I'm sorry but I'm using a drainbread ISP, which although big and -wealthy can't seem to generate standard compliant email. :( - -This message has a Content-Type: header with no subtype. I hope you -can still read it. - --Me diff --git a/sys/lib/python/email/test/data/msg_15.txt b/sys/lib/python/email/test/data/msg_15.txt deleted file mode 100644 index 33b8487aa..000000000 --- a/sys/lib/python/email/test/data/msg_15.txt +++ /dev/null @@ -1,52 +0,0 @@ -Return-Path: <xx@xx.dk> -Received: from fepD.post.tele.dk (195.41.46.149) by mail.groupcare.dk (LSMTP for Windows NT v1.1b) with SMTP id <0.0014F8A2@mail.groupcare.dk>; Mon, 30 Apr 2001 12:17:50 +0200 -User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2106 -Subject: XX -From: xx@xx.dk -To: XX -Message-ID: <xxxx> -Mime-version: 1.0 -Content-type: multipart/mixed; - boundary="MS_Mac_OE_3071477847_720252_MIME_Part" - -> Denne meddelelse er i MIME-format. Da dit postl¾sningsprogram ikke forstŒr dette format, kan del af eller hele meddelelsen v¾re ul¾selig. - ---MS_Mac_OE_3071477847_720252_MIME_Part -Content-type: multipart/alternative; - boundary="MS_Mac_OE_3071477847_720252_MIME_Part" - - ---MS_Mac_OE_3071477847_720252_MIME_Part -Content-type: text/plain; charset="ISO-8859-1" -Content-transfer-encoding: quoted-printable - -Some removed test. - ---MS_Mac_OE_3071477847_720252_MIME_Part -Content-type: text/html; charset="ISO-8859-1" -Content-transfer-encoding: quoted-printable - -<HTML> -<HEAD> -<TITLE>Some removed HTML</TITLE> -</HEAD> -<BODY> -Some removed text. -</BODY> -</HTML> - - ---MS_Mac_OE_3071477847_720252_MIME_Part-- - - ---MS_Mac_OE_3071477847_720252_MIME_Part -Content-type: image/gif; name="xx.gif"; - x-mac-creator="6F676C65"; - x-mac-type="47494666" -Content-disposition: attachment -Content-transfer-encoding: base64 - -Some removed base64 encoded chars. - ---MS_Mac_OE_3071477847_720252_MIME_Part-- - diff --git a/sys/lib/python/email/test/data/msg_16.txt b/sys/lib/python/email/test/data/msg_16.txt deleted file mode 100644 index 56167e9f5..000000000 --- a/sys/lib/python/email/test/data/msg_16.txt +++ /dev/null @@ -1,123 +0,0 @@ -Return-Path: <> -Delivered-To: scr-admin@socal-raves.org -Received: from cougar.noc.ucla.edu (cougar.noc.ucla.edu [169.232.10.18]) - by babylon.socal-raves.org (Postfix) with ESMTP id CCC2C51B84 - for <scr-admin@socal-raves.org>; Sun, 23 Sep 2001 20:13:54 -0700 (PDT) -Received: from sims-ms-daemon by cougar.noc.ucla.edu - (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) - id <0GK500B01D0B8Y@cougar.noc.ucla.edu> for scr-admin@socal-raves.org; Sun, - 23 Sep 2001 20:14:35 -0700 (PDT) -Received: from cougar.noc.ucla.edu - (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) - id <0GK500B01D0B8X@cougar.noc.ucla.edu>; Sun, 23 Sep 2001 20:14:35 -0700 (PDT) -Date: Sun, 23 Sep 2001 20:14:35 -0700 (PDT) -From: Internet Mail Delivery <postmaster@ucla.edu> -Subject: Delivery Notification: Delivery has failed -To: scr-admin@socal-raves.org -Message-id: <0GK500B04D0B8X@cougar.noc.ucla.edu> -MIME-version: 1.0 -Sender: scr-owner@socal-raves.org -Errors-To: scr-owner@socal-raves.org -X-BeenThere: scr@socal-raves.org -X-Mailman-Version: 2.1a3 -Precedence: bulk -List-Help: <mailto:scr-request@socal-raves.org?subject=help> -List-Post: <mailto:scr@socal-raves.org> -List-Subscribe: <http://socal-raves.org/mailman/listinfo/scr>, - <mailto:scr-request@socal-raves.org?subject=subscribe> -List-Id: SoCal-Raves <scr.socal-raves.org> -List-Unsubscribe: <http://socal-raves.org/mailman/listinfo/scr>, - <mailto:scr-request@socal-raves.org?subject=unsubscribe> -List-Archive: <http://socal-raves.org/mailman/private/scr/> -Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)" - - ---Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) -Content-type: text/plain; charset=ISO-8859-1 - -This report relates to a message you sent with the following header fields: - - Message-id: <002001c144a6$8752e060$56104586@oxy.edu> - Date: Sun, 23 Sep 2001 20:10:55 -0700 - From: "Ian T. Henry" <henryi@oxy.edu> - To: SoCal Raves <scr@socal-raves.org> - Subject: [scr] yeah for Ians!! - -Your message cannot be delivered to the following recipients: - - Recipient address: jangel1@cougar.noc.ucla.edu - Reason: recipient reached disk quota - - ---Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) -Content-type: message/DELIVERY-STATUS - -Original-envelope-id: 0GK500B4HD0888@cougar.noc.ucla.edu -Reporting-MTA: dns; cougar.noc.ucla.edu - -Action: failed -Status: 5.0.0 (recipient reached disk quota) -Original-recipient: rfc822;jangel1@cougar.noc.ucla.edu -Final-recipient: rfc822;jangel1@cougar.noc.ucla.edu - ---Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) -Content-type: MESSAGE/RFC822 - -Return-path: scr-admin@socal-raves.org -Received: from sims-ms-daemon by cougar.noc.ucla.edu - (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) - id <0GK500B01D0B8X@cougar.noc.ucla.edu>; Sun, 23 Sep 2001 20:14:35 -0700 (PDT) -Received: from panther.noc.ucla.edu by cougar.noc.ucla.edu - (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) - with ESMTP id <0GK500B4GD0888@cougar.noc.ucla.edu> for jangel1@sims-ms-daemon; - Sun, 23 Sep 2001 20:14:33 -0700 (PDT) -Received: from babylon.socal-raves.org - (ip-209-85-222-117.dreamhost.com [209.85.222.117]) - by panther.noc.ucla.edu (8.9.1a/8.9.1) with ESMTP id UAA09793 for - <jangel1@ucla.edu>; Sun, 23 Sep 2001 20:14:32 -0700 (PDT) -Received: from babylon (localhost [127.0.0.1]) by babylon.socal-raves.org - (Postfix) with ESMTP id D3B2951B70; Sun, 23 Sep 2001 20:13:47 -0700 (PDT) -Received: by babylon.socal-raves.org (Postfix, from userid 60001) - id A611F51B82; Sun, 23 Sep 2001 20:13:46 -0700 (PDT) -Received: from tiger.cc.oxy.edu (tiger.cc.oxy.edu [134.69.3.112]) - by babylon.socal-raves.org (Postfix) with ESMTP id ADA7351B70 for - <scr@socal-raves.org>; Sun, 23 Sep 2001 20:13:44 -0700 (PDT) -Received: from ent (n16h86.dhcp.oxy.edu [134.69.16.86]) - by tiger.cc.oxy.edu (8.8.8/8.8.8) with SMTP id UAA08100 for - <scr@socal-raves.org>; Sun, 23 Sep 2001 20:14:24 -0700 (PDT) -Date: Sun, 23 Sep 2001 20:10:55 -0700 -From: "Ian T. Henry" <henryi@oxy.edu> -Subject: [scr] yeah for Ians!! -Sender: scr-admin@socal-raves.org -To: SoCal Raves <scr@socal-raves.org> -Errors-to: scr-admin@socal-raves.org -Message-id: <002001c144a6$8752e060$56104586@oxy.edu> -MIME-version: 1.0 -X-Mailer: Microsoft Outlook Express 5.50.4522.1200 -Content-type: text/plain; charset=us-ascii -Precedence: bulk -Delivered-to: scr-post@babylon.socal-raves.org -Delivered-to: scr@socal-raves.org -X-Converted-To-Plain-Text: from multipart/alternative by demime 0.98e -X-Converted-To-Plain-Text: Alternative section used was text/plain -X-BeenThere: scr@socal-raves.org -X-Mailman-Version: 2.1a3 -List-Help: <mailto:scr-request@socal-raves.org?subject=help> -List-Post: <mailto:scr@socal-raves.org> -List-Subscribe: <http://socal-raves.org/mailman/listinfo/scr>, - <mailto:scr-request@socal-raves.org?subject=subscribe> -List-Id: SoCal-Raves <scr.socal-raves.org> -List-Unsubscribe: <http://socal-raves.org/mailman/listinfo/scr>, - <mailto:scr-request@socal-raves.org?subject=unsubscribe> -List-Archive: <http://socal-raves.org/mailman/private/scr/> - -I always love to find more Ian's that are over 3 years old!! - -Ian -_______________________________________________ -For event info, list questions, or to unsubscribe, see http://www.socal-raves.org/ - - - ---Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)-- - diff --git a/sys/lib/python/email/test/data/msg_17.txt b/sys/lib/python/email/test/data/msg_17.txt deleted file mode 100644 index 8d86e4180..000000000 --- a/sys/lib/python/email/test/data/msg_17.txt +++ /dev/null @@ -1,12 +0,0 @@ -MIME-Version: 1.0 -From: Barry <barry@digicool.com> -To: Dingus Lovers <cravindogs@cravindogs.com> -Subject: Here is your dingus fish -Date: Fri, 20 Apr 2001 19:35:02 -0400 -Content-Type: multipart/mixed; boundary="BOUNDARY" - -Hi there, - -This is the dingus fish. - -[Non-text (image/gif) part of message omitted, filename dingusfish.gif] diff --git a/sys/lib/python/email/test/data/msg_18.txt b/sys/lib/python/email/test/data/msg_18.txt deleted file mode 100644 index f9f4904d3..000000000 --- a/sys/lib/python/email/test/data/msg_18.txt +++ /dev/null @@ -1,6 +0,0 @@ -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; - spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" - diff --git a/sys/lib/python/email/test/data/msg_19.txt b/sys/lib/python/email/test/data/msg_19.txt deleted file mode 100644 index 49bf7fccd..000000000 --- a/sys/lib/python/email/test/data/msg_19.txt +++ /dev/null @@ -1,43 +0,0 @@ -Send Ppp mailing list submissions to - ppp@zzz.org - -To subscribe or unsubscribe via the World Wide Web, visit - http://www.zzz.org/mailman/listinfo/ppp -or, via email, send a message with subject or body 'help' to - ppp-request@zzz.org - -You can reach the person managing the list at - ppp-admin@zzz.org - -When replying, please edit your Subject line so it is more specific -than "Re: Contents of Ppp digest..." - -Today's Topics: - - 1. testing #1 (Barry A. Warsaw) - 2. testing #2 (Barry A. Warsaw) - 3. testing #3 (Barry A. Warsaw) - 4. testing #4 (Barry A. Warsaw) - 5. testing #5 (Barry A. Warsaw) - -hello - - -hello - - -hello - - -hello - - -hello - - - -_______________________________________________ -Ppp mailing list -Ppp@zzz.org -http://www.zzz.org/mailman/listinfo/ppp - diff --git a/sys/lib/python/email/test/data/msg_20.txt b/sys/lib/python/email/test/data/msg_20.txt deleted file mode 100644 index 1a6a88783..000000000 --- a/sys/lib/python/email/test/data/msg_20.txt +++ /dev/null @@ -1,22 +0,0 @@ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) - id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Cc: ccc@zzz.org -CC: ddd@zzz.org -cc: eee@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 - - -Hi, - -Do you like this message? - --Me diff --git a/sys/lib/python/email/test/data/msg_21.txt b/sys/lib/python/email/test/data/msg_21.txt deleted file mode 100644 index 23590b255..000000000 --- a/sys/lib/python/email/test/data/msg_21.txt +++ /dev/null @@ -1,20 +0,0 @@ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: Test -Content-Type: multipart/mixed; boundary="BOUNDARY" - -MIME message ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -One ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -Two ---BOUNDARY-- -End of MIME message diff --git a/sys/lib/python/email/test/data/msg_22.txt b/sys/lib/python/email/test/data/msg_22.txt deleted file mode 100644 index af9de5fa2..000000000 --- a/sys/lib/python/email/test/data/msg_22.txt +++ /dev/null @@ -1,46 +0,0 @@ -Mime-Version: 1.0 -Message-Id: <a05001902b7f1c33773e9@[134.84.183.138]> -Date: Tue, 16 Oct 2001 13:59:25 +0300 -To: a@example.com -From: b@example.com -Content-Type: multipart/mixed; boundary="============_-1208892523==_============" - ---============_-1208892523==_============ -Content-Type: text/plain; charset="us-ascii" ; format="flowed" - -Text text text. ---============_-1208892523==_============ -Content-Id: <a05001902b7f1c33773e9@[134.84.183.138].0.0> -Content-Type: image/jpeg; name="wibble.JPG" - ; x-mac-type="4A504547" - ; x-mac-creator="474B4F4E" -Content-Disposition: attachment; filename="wibble.JPG" -Content-Transfer-Encoding: base64 - -/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB -AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABIEBAREA -g6bCjjw/pIZSjO6FWFpldjySOmCNrO7DBZibUXhTwtCixw+GtAijVdqxxaPp0aKvmGXa -qrbBQvms0mAMeYS/3iTV1dG0hHaRNK01XblnWxtVdjkHLMIgTyqnk9VB7CrP2KzIINpa -4O7I+zxYO9WV8jZg71Zlb+8rMDkEirAVQFAUAKAFAAAUAYAUDgADgY6DjpRtXj5RxjHA -4wQRj0wQCMdCAewpaKKK/9k= ---============_-1208892523==_============ -Content-Id: <a05001902b7f1c33773e9@[134.84.183.138].0.1> -Content-Type: image/jpeg; name="wibble2.JPG" - ; x-mac-type="4A504547" - ; x-mac-creator="474B4F4E" -Content-Disposition: attachment; filename="wibble2.JPG" -Content-Transfer-Encoding: base64 - -/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB -AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABJ0BAREA -/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA -W6NFJJBEkU10kKGTcWMDwxuU+0JHvk8qAtOpNwqSR0n8c3BlDyXHlqsUltHEiTvdXLxR -7vMiGDNJAJWkAMk8ZkCFp5G2oo5W++INrbQtNfTQxJAuXlupz9oS4d5Y1W+E2XlWZJJE -Y7LWYQxTLE1zuMbfBPxw8X2fibVdIbSbI6nLZxX635t9TjtYreWR7WGKJTLJFFKSlozO -0ShxIXM43uC3/9k= ---============_-1208892523==_============ -Content-Type: text/plain; charset="us-ascii" ; format="flowed" - -Text text text. ---============_-1208892523==_============-- - diff --git a/sys/lib/python/email/test/data/msg_23.txt b/sys/lib/python/email/test/data/msg_23.txt deleted file mode 100644 index bb2e8ec36..000000000 --- a/sys/lib/python/email/test/data/msg_23.txt +++ /dev/null @@ -1,8 +0,0 @@ -From: aperson@dom.ain -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain - -A message part ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_24.txt b/sys/lib/python/email/test/data/msg_24.txt deleted file mode 100644 index 4e52339e8..000000000 --- a/sys/lib/python/email/test/data/msg_24.txt +++ /dev/null @@ -1,10 +0,0 @@ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY - - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_25.txt b/sys/lib/python/email/test/data/msg_25.txt deleted file mode 100644 index 9e35275fe..000000000 --- a/sys/lib/python/email/test/data/msg_25.txt +++ /dev/null @@ -1,117 +0,0 @@ -From MAILER-DAEMON Fri Apr 06 16:46:09 2001 -Received: from [204.245.199.98] (helo=zinfandel.lacita.com) - by www.linux.org.uk with esmtp (Exim 3.13 #1) - id 14lYR6-0008Iv-00 - for linuxuser-admin@www.linux.org.uk; Fri, 06 Apr 2001 16:46:09 +0100 -Received: from localhost (localhost) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with internal id JAB03225; Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) -Date: Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) -From: Mail Delivery Subsystem <MAILER-DAEMON@zinfandel.lacita.com> -Subject: Returned mail: Too many hops 19 (17 max): from <linuxuser-admin@www.linux.org.uk> via [199.164.235.226], to <scoffman@wellpartner.com> -Message-Id: <200104061723.JAB03225@zinfandel.lacita.com> -To: <linuxuser-admin@www.linux.org.uk> -To: postmaster@zinfandel.lacita.com -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - bo -Auto-Submitted: auto-generated (failure) - -This is a MIME-encapsulated message - ---JAB03225.986577786/zinfandel.lacita.com - -The original message was received at Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) -from [199.164.235.226] - - ----- The following addresses have delivery notifications ----- -<scoffman@wellpartner.com> (unrecoverable error) - - ----- Transcript of session follows ----- -554 Too many hops 19 (17 max): from <linuxuser-admin@www.linux.org.uk> via [199.164.235.226], to <scoffman@wellpartner.com> - ---JAB03225.986577786/zinfandel.lacita.com -Content-Type: message/delivery-status - -Reporting-MTA: dns; zinfandel.lacita.com -Received-From-MTA: dns; [199.164.235.226] -Arrival-Date: Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) - -Final-Recipient: rfc822; scoffman@wellpartner.com -Action: failed -Status: 5.4.6 -Last-Attempt-Date: Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) - ---JAB03225.986577786/zinfandel.lacita.com -Content-Type: text/rfc822-headers - -Return-Path: linuxuser-admin@www.linux.org.uk -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03225 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03221 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:22:18 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03217 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:21:37 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03213 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:20:56 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03209 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:20:15 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03205 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:19:33 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03201 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:18:52 -0800 (GMT-0800) -Received: from zinfandel.lacita.com ([204.245.199.98]) - by - fo -Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03197 for <scoffman@wellpartner.com>; Fri, 6 Apr 2001 09:17:54 -0800 (GMT-0800) -Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) - by - fo -Received: from localhost.localdomain - ([ - by - id -Received: from [212.1.130.11] (helo=s1.uklinux.net ident=root) - by - id - fo -Received: from server (ppp-2-22.cvx4.telinco.net [212.1.149.22]) - by - fo -From: Daniel James <daniel@linuxuser.co.uk> -Organization: LinuxUser -To: linuxuser@www.linux.org.uk -X-Mailer: KMail [version 1.1.99] -Content-Type: text/plain; - c -MIME-Version: 1.0 -Message-Id: <01040616033903.00962@server> -Content-Transfer-Encoding: 8bit -Subject: [LinuxUser] bulletin no. 45 -Sender: linuxuser-admin@www.linux.org.uk -Errors-To: linuxuser-admin@www.linux.org.uk -X-BeenThere: linuxuser@www.linux.org.uk -X-Mailman-Version: 2.0.3 -Precedence: bulk -List-Help: <mailto:linuxuser-request@www.linux.org.uk?subject=help> -List-Post: <mailto:linuxuser@www.linux.org.uk> -List-Subscribe: <http://www.linux.org.uk/mailman/listinfo/linuxuser>, - <m -List-Id: bulletins from LinuxUser magazine <linuxuser.www.linux.org.uk> -List-Unsubscribe: <http://www.linux.org.uk/mailman/listinfo/linuxuser>, - <m -List-Archive: <http://www.linux.org.uk/pipermail/linuxuser/> -Date: Fri, 6 Apr 2001 16:03:39 +0100 - ---JAB03225.986577786/zinfandel.lacita.com-- - - diff --git a/sys/lib/python/email/test/data/msg_26.txt b/sys/lib/python/email/test/data/msg_26.txt deleted file mode 100644 index 6c71bced9..000000000 --- a/sys/lib/python/email/test/data/msg_26.txt +++ /dev/null @@ -1,45 +0,0 @@ -Received: from xcar [192.168.0.2] by jeeves.wooster.local
- (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100
-Date: Sun, 12 May 2002 08:56:15 +0100
-From: Father Time <father.time@xcar.wooster.local>
-To: timbo@jeeves.wooster.local
-Subject: IMAP file test
-Message-ID: <6df65d354b.father.time@rpc.wooster.local>
-X-Organization: Home
-User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03
-MIME-Version: 1.0
-Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680"
-Status: R
-X-UIDL: 319998302
-
-This message is in MIME format which your mailer apparently does not support.
-You either require a newer version of your software which supports MIME, or
-a separate MIME decoding utility. Alternatively, ask the sender of this
-message to resend it in a different format.
-
---1618492860--2051301190--113853680
-Content-Type: text/plain; charset=us-ascii
-
-Simple email with attachment.
-
-
---1618492860--2051301190--113853680
-Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03
-Content-Disposition: attachment; filename="clock.bmp"
-Content-Transfer-Encoding: base64
-
-Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA
-AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A
-zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA
-C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/
-f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3////
-////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B/////
-8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA
-AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA
-sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0
-z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA
-AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH
-MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA
-AAAAAAAIAAAAAAAAAIAAAAAA
-
---1618492860--2051301190--113853680--
diff --git a/sys/lib/python/email/test/data/msg_27.txt b/sys/lib/python/email/test/data/msg_27.txt deleted file mode 100644 index d0191769d..000000000 --- a/sys/lib/python/email/test/data/msg_27.txt +++ /dev/null @@ -1,15 +0,0 @@ -Return-Path: <aperson@dom.ain> -Received: by mail.dom.ain (Postfix, from userid 889) - id B9D0AD35DB; Tue, 4 Jun 2002 21:46:59 -0400 (EDT) -Message-ID: <15613.28051.707126.569693@dom.ain> -Date: Tue, 4 Jun 2002 21:46:59 -0400 -MIME-Version: 1.0 -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit -Subject: bug demonstration - 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 - more text -From: aperson@dom.ain (Anne P. Erson) -To: bperson@dom.ain (Barney P. Erson) - -test diff --git a/sys/lib/python/email/test/data/msg_28.txt b/sys/lib/python/email/test/data/msg_28.txt deleted file mode 100644 index 1e4824cab..000000000 --- a/sys/lib/python/email/test/data/msg_28.txt +++ /dev/null @@ -1,25 +0,0 @@ -From: aperson@dom.ain -MIME-Version: 1.0 -Content-Type: multipart/digest; boundary=BOUNDARY - ---BOUNDARY -Content-Type: message/rfc822 - -Content-Type: text/plain; charset=us-ascii -To: aa@bb.org -From: cc@dd.org -Subject: ee - -message 1 - ---BOUNDARY -Content-Type: message/rfc822 - -Content-Type: text/plain; charset=us-ascii -To: aa@bb.org -From: cc@dd.org -Subject: ee - -message 2 - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_29.txt b/sys/lib/python/email/test/data/msg_29.txt deleted file mode 100644 index 1fab56161..000000000 --- a/sys/lib/python/email/test/data/msg_29.txt +++ /dev/null @@ -1,22 +0,0 @@ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) - id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: text/plain; charset=us-ascii; - title*0*="us-ascii'en'This%20is%20even%20more%20"; - title*1*="%2A%2A%2Afun%2A%2A%2A%20"; - title*2="isn't it!" -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 - - -Hi, - -Do you like this message? - --Me diff --git a/sys/lib/python/email/test/data/msg_30.txt b/sys/lib/python/email/test/data/msg_30.txt deleted file mode 100644 index 4334bb6e6..000000000 --- a/sys/lib/python/email/test/data/msg_30.txt +++ /dev/null @@ -1,23 +0,0 @@ -From: aperson@dom.ain -MIME-Version: 1.0 -Content-Type: multipart/digest; boundary=BOUNDARY - ---BOUNDARY - -Content-Type: text/plain; charset=us-ascii -To: aa@bb.org -From: cc@dd.org -Subject: ee - -message 1 - ---BOUNDARY - -Content-Type: text/plain; charset=us-ascii -To: aa@bb.org -From: cc@dd.org -Subject: ee - -message 2 - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_31.txt b/sys/lib/python/email/test/data/msg_31.txt deleted file mode 100644 index 1e58e56cf..000000000 --- a/sys/lib/python/email/test/data/msg_31.txt +++ /dev/null @@ -1,15 +0,0 @@ -From: aperson@dom.ain -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary=BOUNDARY_ - ---BOUNDARY -Content-Type: text/plain - -message 1 - ---BOUNDARY -Content-Type: text/plain - -message 2 - ---BOUNDARY-- diff --git a/sys/lib/python/email/test/data/msg_32.txt b/sys/lib/python/email/test/data/msg_32.txt deleted file mode 100644 index 07ec5af9a..000000000 --- a/sys/lib/python/email/test/data/msg_32.txt +++ /dev/null @@ -1,14 +0,0 @@ -Delivered-To: freebsd-isp@freebsd.org -Date: Tue, 26 Sep 2000 12:23:03 -0500 -From: Anne Person <aperson@example.com> -To: Barney Dude <bdude@example.com> -Subject: Re: Limiting Perl CPU Utilization... -Mime-Version: 1.0 -Content-Type: text/plain; charset*=ansi-x3.4-1968''us-ascii -Content-Disposition: inline -User-Agent: Mutt/1.3.8i -Sender: owner-freebsd-isp@FreeBSD.ORG -Precedence: bulk -X-Loop: FreeBSD.org - -Some message. diff --git a/sys/lib/python/email/test/data/msg_33.txt b/sys/lib/python/email/test/data/msg_33.txt deleted file mode 100644 index 042787a4f..000000000 --- a/sys/lib/python/email/test/data/msg_33.txt +++ /dev/null @@ -1,29 +0,0 @@ -Delivered-To: freebsd-isp@freebsd.org -Date: Wed, 27 Sep 2000 11:11:09 -0500 -From: Anne Person <aperson@example.com> -To: Barney Dude <bdude@example.com> -Subject: Re: Limiting Perl CPU Utilization... -Mime-Version: 1.0 -Content-Type: multipart/signed; micalg*=ansi-x3.4-1968''pgp-md5; - protocol*=ansi-x3.4-1968''application%2Fpgp-signature; - boundary*="ansi-x3.4-1968''EeQfGwPcQSOJBaQU" -Content-Disposition: inline -Sender: owner-freebsd-isp@FreeBSD.ORG -Precedence: bulk -X-Loop: FreeBSD.org - - ---EeQfGwPcQSOJBaQU -Content-Type: text/plain; charset*=ansi-x3.4-1968''us-ascii -Content-Disposition: inline -Content-Transfer-Encoding: quoted-printable - -part 1 - ---EeQfGwPcQSOJBaQU -Content-Type: text/plain -Content-Disposition: inline - -part 2 - ---EeQfGwPcQSOJBaQU-- diff --git a/sys/lib/python/email/test/data/msg_34.txt b/sys/lib/python/email/test/data/msg_34.txt deleted file mode 100644 index 055dfea53..000000000 --- a/sys/lib/python/email/test/data/msg_34.txt +++ /dev/null @@ -1,19 +0,0 @@ -From: aperson@dom.ain -To: bperson@dom.ain -Content-Type: multipart/digest; boundary=XYZ - ---XYZ -Content-Type: text/plain - - -This is a text plain part that is counter to recommended practice in -RFC 2046, $5.1.5, but is not illegal - ---XYZ - -From: cperson@dom.ain -To: dperson@dom.ain - -A submessage - ---XYZ-- diff --git a/sys/lib/python/email/test/data/msg_35.txt b/sys/lib/python/email/test/data/msg_35.txt deleted file mode 100644 index be7d5a2f7..000000000 --- a/sys/lib/python/email/test/data/msg_35.txt +++ /dev/null @@ -1,4 +0,0 @@ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: here's something interesting -counter to RFC 2822, there's no separating newline here diff --git a/sys/lib/python/email/test/data/msg_36.txt b/sys/lib/python/email/test/data/msg_36.txt deleted file mode 100644 index 5632c3062..000000000 --- a/sys/lib/python/email/test/data/msg_36.txt +++ /dev/null @@ -1,40 +0,0 @@ -Mime-Version: 1.0 -Content-Type: Multipart/Mixed; Boundary="NextPart" -To: IETF-Announce:; -From: Internet-Drafts@ietf.org -Subject: I-D ACTION:draft-ietf-mboned-mix-00.txt -Date: Tue, 22 Dec 1998 16:55:06 -0500 - ---NextPart - -Blah blah blah - ---NextPart -Content-Type: Multipart/Alternative; Boundary="OtherAccess" - ---OtherAccess -Content-Type: Message/External-body; - access-type="mail-server"; - server="mailserv@ietf.org" - -Content-Type: text/plain -Content-ID: <19981222151406.I-D@ietf.org> - -ENCODING mime -FILE /internet-drafts/draft-ietf-mboned-mix-00.txt - ---OtherAccess -Content-Type: Message/External-body; - name="draft-ietf-mboned-mix-00.txt"; - site="ftp.ietf.org"; - access-type="anon-ftp"; - directory="internet-drafts" - -Content-Type: text/plain -Content-ID: <19981222151406.I-D@ietf.org> - - ---OtherAccess-- - ---NextPart-- - diff --git a/sys/lib/python/email/test/data/msg_37.txt b/sys/lib/python/email/test/data/msg_37.txt deleted file mode 100644 index 038d34a1a..000000000 --- a/sys/lib/python/email/test/data/msg_37.txt +++ /dev/null @@ -1,22 +0,0 @@ -Content-Type: multipart/mixed; boundary=ABCDE - ---ABCDE -Content-Type: text/x-one - -Blah - ---ABCDE ---ABCDE -Content-Type: text/x-two - -Blah - ---ABCDE ---ABCDE ---ABCDE ---ABCDE -Content-Type: text/x-two - -Blah - ---ABCDE-- diff --git a/sys/lib/python/email/test/data/msg_38.txt b/sys/lib/python/email/test/data/msg_38.txt deleted file mode 100644 index 006df81cb..000000000 --- a/sys/lib/python/email/test/data/msg_38.txt +++ /dev/null @@ -1,101 +0,0 @@ -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" - -------- =_aaaaaaaaaa0 -Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1" -Content-ID: <20592.1022586929.1@example.com> - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa2" -Content-ID: <20592.1022586929.2@example.com> - -------- =_aaaaaaaaaa2 -Content-Type: text/plain -Content-ID: <20592.1022586929.3@example.com> -Content-Description: very tricky -Content-Transfer-Encoding: 7bit - - -Unlike the test test_nested-multiples-with-internal-boundary, this -piece of text not only contains the outer boundary tags -------- =_aaaaaaaaaa1 -and -------- =_aaaaaaaaaa0 -but puts them at the start of a line! And, to be even nastier, it -even includes a couple of end tags, such as this one: - -------- =_aaaaaaaaaa1-- - -and this one, which is from a multipart we haven't even seen yet! - -------- =_aaaaaaaaaa4-- - -This will, I'm sure, cause much breakage of MIME parsers. But, as -far as I can tell, it's perfectly legal. I have not yet ever seen -a case of this in the wild, but I've seen *similar* things. - - -------- =_aaaaaaaaaa2 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.4@example.com> -Content-Description: patch2 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa2-- - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa3" -Content-ID: <20592.1022586929.6@example.com> - -------- =_aaaaaaaaaa3 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.7@example.com> -Content-Description: patch3 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa3 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.8@example.com> -Content-Description: patch4 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa3-- - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa4" -Content-ID: <20592.1022586929.10@example.com> - -------- =_aaaaaaaaaa4 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.11@example.com> -Content-Description: patch5 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa4 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.12@example.com> -Content-Description: patch6 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa4-- - -------- =_aaaaaaaaaa1-- - -------- =_aaaaaaaaaa0 -Content-Type: text/plain; charset="us-ascii" -Content-ID: <20592.1022586929.15@example.com> - --- -It's never too late to have a happy childhood. - -------- =_aaaaaaaaaa0-- diff --git a/sys/lib/python/email/test/data/msg_39.txt b/sys/lib/python/email/test/data/msg_39.txt deleted file mode 100644 index 124b26919..000000000 --- a/sys/lib/python/email/test/data/msg_39.txt +++ /dev/null @@ -1,83 +0,0 @@ -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" - -------- =_aaaaaaaaaa0 -Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1" -Content-ID: <20592.1022586929.1@example.com> - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" -Content-ID: <20592.1022586929.2@example.com> - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.3@example.com> -Content-Description: patch1 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.4@example.com> -Content-Description: patch2 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1-- - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" -Content-ID: <20592.1022586929.6@example.com> - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.7@example.com> -Content-Description: patch3 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.8@example.com> -Content-Description: patch4 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1-- - -------- =_aaaaaaaaaa1 -Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" -Content-ID: <20592.1022586929.10@example.com> - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.11@example.com> -Content-Description: patch5 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1 -Content-Type: application/octet-stream -Content-ID: <20592.1022586929.12@example.com> -Content-Description: patch6 -Content-Transfer-Encoding: base64 - -XXX - -------- =_aaaaaaaaaa1-- - -------- =_aaaaaaaaaa1-- - -------- =_aaaaaaaaaa0 -Content-Type: text/plain; charset="us-ascii" -Content-ID: <20592.1022586929.15@example.com> - --- -It's never too late to have a happy childhood. - -------- =_aaaaaaaaaa0-- diff --git a/sys/lib/python/email/test/data/msg_40.txt b/sys/lib/python/email/test/data/msg_40.txt deleted file mode 100644 index 1435fa1e1..000000000 --- a/sys/lib/python/email/test/data/msg_40.txt +++ /dev/null @@ -1,10 +0,0 @@ -MIME-Version: 1.0 -Content-Type: text/html; boundary="--961284236552522269" - -----961284236552522269 -Content-Type: text/html; -Content-Transfer-Encoding: 7Bit - -<html></html> - -----961284236552522269-- diff --git a/sys/lib/python/email/test/data/msg_41.txt b/sys/lib/python/email/test/data/msg_41.txt deleted file mode 100644 index 76cdd1cb7..000000000 --- a/sys/lib/python/email/test/data/msg_41.txt +++ /dev/null @@ -1,8 +0,0 @@ -From: "Allison Dunlap" <xxx@example.com> -To: yyy@example.com -Subject: 64423 -Date: Sun, 11 Jul 2004 16:09:27 -0300 -MIME-Version: 1.0 -Content-Type: multipart/alternative; - -Blah blah blah diff --git a/sys/lib/python/email/test/data/msg_42.txt b/sys/lib/python/email/test/data/msg_42.txt deleted file mode 100644 index a75f8f4a0..000000000 --- a/sys/lib/python/email/test/data/msg_42.txt +++ /dev/null @@ -1,20 +0,0 @@ -Content-Type: multipart/mixed; boundary="AAA" -From: Mail Delivery Subsystem <xxx@example.com> -To: yyy@example.com - -This is a MIME-encapsulated message - ---AAA - -Stuff - ---AAA -Content-Type: message/rfc822 - -From: webmaster@python.org -To: zzz@example.com -Content-Type: multipart/mixed; boundary="BBB" - ---BBB-- - ---AAA-- diff --git a/sys/lib/python/email/test/data/msg_43.txt b/sys/lib/python/email/test/data/msg_43.txt deleted file mode 100644 index 797d12c56..000000000 --- a/sys/lib/python/email/test/data/msg_43.txt +++ /dev/null @@ -1,217 +0,0 @@ -From SRS0=aO/p=ON=bag.python.org=None@bounce2.pobox.com Fri Nov 26 21:40:36 2004 -X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] - [nil nil nil nil nil nil nil "MAILER DAEMON <>" "MAILER DAEMON <>" nil nil "Banned file: auto__mail.python.bat in mail from you" "^From:" nil nil nil nil "Banned file: auto__mail.python.bat in mail from you" nil nil nil nil nil nil nil] - nil) -MIME-Version: 1.0 -Message-Id: <edab.7804f5cb8070@python.org> -Content-Type: multipart/report; report-type=delivery-status; - charset=utf-8; - boundary="----------=_1101526904-1956-5" -X-Virus-Scanned: by XS4ALL Virus Scanner -X-UIDL: 4\G!!!<c"!UV["!M7C!! -From: MAILER DAEMON <> -To: <webmaster@python.org> -Subject: Banned file: auto__mail.python.bat in mail from you -Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -This is a multi-part message in MIME format... - -------------=_1101526904-1956-5 -Content-Type: text/plain; charset="utf-8" -Content-Disposition: inline -Content-Transfer-Encoding: 7bit - -BANNED FILENAME ALERT - -Your message to: xxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxx@dot.ca.gov, xxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxxxxx@dot.ca.gov -was blocked by our Spam Firewall. The email you sent with the following subject has NOT BEEN DELIVERED: - -Subject: Delivery_failure_notice - -An attachment in that mail was of a file type that the Spam Firewall is set to block. - - - -------------=_1101526904-1956-5 -Content-Type: message/delivery-status -Content-Disposition: inline -Content-Transfer-Encoding: 7bit -Content-Description: Delivery error report - -Reporting-MTA: dns; sacspam01.dot.ca.gov -Received-From-MTA: smtp; sacspam01.dot.ca.gov ([127.0.0.1]) -Arrival-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -Final-Recipient: rfc822; xxxxxxx@dot.ca.gov -Action: failed -Status: 5.7.1 -Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat -Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) - -------------=_1101526904-1956-5 -Content-Type: text/rfc822-headers -Content-Disposition: inline -Content-Transfer-Encoding: 7bit -Content-Description: Undelivered-message headers - -Received: from kgsav.org (ppp-70-242-162-63.dsl.spfdmo.swbell.net [70.242.162.63]) - by sacspam01.dot.ca.gov (Spam Firewall) with SMTP - id A232AD03DE3A; Fri, 26 Nov 2004 19:41:35 -0800 (PST) -From: webmaster@python.org -To: xxxxx@dot.ca.gov -Date: Sat, 27 Nov 2004 03:35:30 UTC -Subject: Delivery_failure_notice -Importance: Normal -X-Priority: 3 (Normal) -X-MSMail-Priority: Normal -Message-ID: <edab.7804f5cb8070@python.org> -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="====67bd2b7a5.f99f7" -Content-Transfer-Encoding: 7bit - -------------=_1101526904-1956-5-- - diff --git a/sys/lib/python/email/test/data/msg_44.txt b/sys/lib/python/email/test/data/msg_44.txt deleted file mode 100644 index ae462a61b..000000000 --- a/sys/lib/python/email/test/data/msg_44.txt +++ /dev/null @@ -1,35 +0,0 @@ -Return-Path: <barry@python.org> -Delivered-To: barry@python.org -Received: by mail.python.org (Postfix, from userid 889) - id C2BF0D37C6; Tue, 11 Sep 2001 00:05:05 -0400 (EDT) -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="h90VIIIKmx" -Content-Transfer-Encoding: 7bit -Message-ID: <15261.36209.358846.118674@anthem.python.org> -From: barry@python.org (Barry A. Warsaw) -To: barry@python.org -Subject: a simple multipart -Date: Tue, 11 Sep 2001 00:05:05 -0400 -X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid -X-Attribution: BAW -X-Oblique-Strategy: Make a door into a window - - ---h90VIIIKmx -Content-Type: text/plain -Content-Disposition: inline; name="msg.txt" -Content-Transfer-Encoding: 7bit - -a simple kind of mirror -to reflect upon our own - ---h90VIIIKmx -Content-Type: text/plain -Content-Disposition: inline; name="msg.txt" -Content-Transfer-Encoding: 7bit - -a simple kind of mirror -to reflect upon our own - ---h90VIIIKmx-- - diff --git a/sys/lib/python/email/test/test_email.py b/sys/lib/python/email/test/test_email.py deleted file mode 100644 index a03299991..000000000 --- a/sys/lib/python/email/test/test_email.py +++ /dev/null @@ -1,3274 +0,0 @@ -# Copyright (C) 2001-2007 Python Software Foundation -# Contact: email-sig@python.org -# email package unit tests - -import os -import sys -import time -import base64 -import difflib -import unittest -import warnings -from cStringIO import StringIO - -import email - -from email.Charset import Charset -from email.Header import Header, decode_header, make_header -from email.Parser import Parser, HeaderParser -from email.Generator import Generator, DecodedGenerator -from email.Message import Message -from email.MIMEAudio import MIMEAudio -from email.MIMEText import MIMEText -from email.MIMEImage import MIMEImage -from email.MIMEBase import MIMEBase -from email.MIMEMessage import MIMEMessage -from email.MIMEMultipart import MIMEMultipart -from email import Utils -from email import Errors -from email import Encoders -from email import Iterators -from email import base64MIME -from email import quopriMIME - -from test.test_support import findfile, run_unittest -from email.test import __file__ as landmark - - -NL = '\n' -EMPTYSTRING = '' -SPACE = ' ' - - - -def openfile(filename, mode='r'): - path = os.path.join(os.path.dirname(landmark), 'data', filename) - return open(path, mode) - - - -# Base test class -class TestEmailBase(unittest.TestCase): - def ndiffAssertEqual(self, first, second): - """Like failUnlessEqual except use ndiff for readable output.""" - if first <> second: - sfirst = str(first) - ssecond = str(second) - diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines()) - fp = StringIO() - print >> fp, NL, NL.join(diff) - raise self.failureException, fp.getvalue() - - def _msgobj(self, filename): - fp = openfile(findfile(filename)) - try: - msg = email.message_from_file(fp) - finally: - fp.close() - return msg - - - -# Test various aspects of the Message class's API -class TestMessageAPI(TestEmailBase): - def test_get_all(self): - eq = self.assertEqual - msg = self._msgobj('msg_20.txt') - eq(msg.get_all('cc'), ['ccc@zzz.org', 'ddd@zzz.org', 'eee@zzz.org']) - eq(msg.get_all('xx', 'n/a'), 'n/a') - - def test_getset_charset(self): - eq = self.assertEqual - msg = Message() - eq(msg.get_charset(), None) - charset = Charset('iso-8859-1') - msg.set_charset(charset) - eq(msg['mime-version'], '1.0') - eq(msg.get_content_type(), 'text/plain') - eq(msg['content-type'], 'text/plain; charset="iso-8859-1"') - eq(msg.get_param('charset'), 'iso-8859-1') - eq(msg['content-transfer-encoding'], 'quoted-printable') - eq(msg.get_charset().input_charset, 'iso-8859-1') - # Remove the charset - msg.set_charset(None) - eq(msg.get_charset(), None) - eq(msg['content-type'], 'text/plain') - # Try adding a charset when there's already MIME headers present - msg = Message() - msg['MIME-Version'] = '2.0' - msg['Content-Type'] = 'text/x-weird' - msg['Content-Transfer-Encoding'] = 'quinted-puntable' - msg.set_charset(charset) - eq(msg['mime-version'], '2.0') - eq(msg['content-type'], 'text/x-weird; charset="iso-8859-1"') - eq(msg['content-transfer-encoding'], 'quinted-puntable') - - def test_set_charset_from_string(self): - eq = self.assertEqual - msg = Message() - msg.set_charset('us-ascii') - eq(msg.get_charset().input_charset, 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - - def test_set_payload_with_charset(self): - msg = Message() - charset = Charset('iso-8859-1') - msg.set_payload('This is a string payload', charset) - self.assertEqual(msg.get_charset().input_charset, 'iso-8859-1') - - def test_get_charsets(self): - eq = self.assertEqual - - msg = self._msgobj('msg_08.txt') - charsets = msg.get_charsets() - eq(charsets, [None, 'us-ascii', 'iso-8859-1', 'iso-8859-2', 'koi8-r']) - - msg = self._msgobj('msg_09.txt') - charsets = msg.get_charsets('dingbat') - eq(charsets, ['dingbat', 'us-ascii', 'iso-8859-1', 'dingbat', - 'koi8-r']) - - msg = self._msgobj('msg_12.txt') - charsets = msg.get_charsets() - eq(charsets, [None, 'us-ascii', 'iso-8859-1', None, 'iso-8859-2', - 'iso-8859-3', 'us-ascii', 'koi8-r']) - - def test_get_filename(self): - eq = self.assertEqual - - msg = self._msgobj('msg_04.txt') - filenames = [p.get_filename() for p in msg.get_payload()] - eq(filenames, ['msg.txt', 'msg.txt']) - - msg = self._msgobj('msg_07.txt') - subpart = msg.get_payload(1) - eq(subpart.get_filename(), 'dingusfish.gif') - - def test_get_filename_with_name_parameter(self): - eq = self.assertEqual - - msg = self._msgobj('msg_44.txt') - filenames = [p.get_filename() for p in msg.get_payload()] - eq(filenames, ['msg.txt', 'msg.txt']) - - def test_get_boundary(self): - eq = self.assertEqual - msg = self._msgobj('msg_07.txt') - # No quotes! - eq(msg.get_boundary(), 'BOUNDARY') - - def test_set_boundary(self): - eq = self.assertEqual - # This one has no existing boundary parameter, but the Content-Type: - # header appears fifth. - msg = self._msgobj('msg_01.txt') - msg.set_boundary('BOUNDARY') - header, value = msg.items()[4] - eq(header.lower(), 'content-type') - eq(value, 'text/plain; charset="us-ascii"; boundary="BOUNDARY"') - # This one has a Content-Type: header, with a boundary, stuck in the - # middle of its headers. Make sure the order is preserved; it should - # be fifth. - msg = self._msgobj('msg_04.txt') - msg.set_boundary('BOUNDARY') - header, value = msg.items()[4] - eq(header.lower(), 'content-type') - eq(value, 'multipart/mixed; boundary="BOUNDARY"') - # And this one has no Content-Type: header at all. - msg = self._msgobj('msg_03.txt') - self.assertRaises(Errors.HeaderParseError, - msg.set_boundary, 'BOUNDARY') - - def test_get_decoded_payload(self): - eq = self.assertEqual - msg = self._msgobj('msg_10.txt') - # The outer message is a multipart - eq(msg.get_payload(decode=True), None) - # Subpart 1 is 7bit encoded - eq(msg.get_payload(0).get_payload(decode=True), - 'This is a 7bit encoded message.\n') - # Subpart 2 is quopri - eq(msg.get_payload(1).get_payload(decode=True), - '\xa1This is a Quoted Printable encoded message!\n') - # Subpart 3 is base64 - eq(msg.get_payload(2).get_payload(decode=True), - 'This is a Base64 encoded message.') - # Subpart 4 has no Content-Transfer-Encoding: header. - eq(msg.get_payload(3).get_payload(decode=True), - 'This has no Content-Transfer-Encoding: header.\n') - - def test_get_decoded_uu_payload(self): - eq = self.assertEqual - msg = Message() - msg.set_payload('begin 666 -\n+:&5L;&\\@=V]R;&0 \n \nend\n') - for cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): - msg['content-transfer-encoding'] = cte - eq(msg.get_payload(decode=True), 'hello world') - # Now try some bogus data - msg.set_payload('foo') - eq(msg.get_payload(decode=True), 'foo') - - def test_decode_bogus_uu_payload_quietly(self): - msg = Message() - msg.set_payload('begin 664 foo.txt\n%<W1F=0000H \n \nend\n') - msg['Content-Transfer-Encoding'] = 'x-uuencode' - old_stderr = sys.stderr - try: - sys.stderr = sfp = StringIO() - # We don't care about the payload - msg.get_payload(decode=True) - finally: - sys.stderr = old_stderr - self.assertEqual(sfp.getvalue(), '') - - def test_decoded_generator(self): - eq = self.assertEqual - msg = self._msgobj('msg_07.txt') - fp = openfile('msg_17.txt') - try: - text = fp.read() - finally: - fp.close() - s = StringIO() - g = DecodedGenerator(s) - g.flatten(msg) - eq(s.getvalue(), text) - - def test__contains__(self): - msg = Message() - msg['From'] = 'Me' - msg['to'] = 'You' - # Check for case insensitivity - self.failUnless('from' in msg) - self.failUnless('From' in msg) - self.failUnless('FROM' in msg) - self.failUnless('to' in msg) - self.failUnless('To' in msg) - self.failUnless('TO' in msg) - - def test_as_string(self): - eq = self.assertEqual - msg = self._msgobj('msg_01.txt') - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - eq(text, msg.as_string()) - fullrepr = str(msg) - lines = fullrepr.split('\n') - self.failUnless(lines[0].startswith('From ')) - eq(text, NL.join(lines[1:])) - - def test_bad_param(self): - msg = email.message_from_string("Content-Type: blarg; baz; boo\n") - self.assertEqual(msg.get_param('baz'), '') - - def test_missing_filename(self): - msg = email.message_from_string("From: foo\n") - self.assertEqual(msg.get_filename(), None) - - def test_bogus_filename(self): - msg = email.message_from_string( - "Content-Disposition: blarg; filename\n") - self.assertEqual(msg.get_filename(), '') - - def test_missing_boundary(self): - msg = email.message_from_string("From: foo\n") - self.assertEqual(msg.get_boundary(), None) - - def test_get_params(self): - eq = self.assertEqual - msg = email.message_from_string( - 'X-Header: foo=one; bar=two; baz=three\n') - eq(msg.get_params(header='x-header'), - [('foo', 'one'), ('bar', 'two'), ('baz', 'three')]) - msg = email.message_from_string( - 'X-Header: foo; bar=one; baz=two\n') - eq(msg.get_params(header='x-header'), - [('foo', ''), ('bar', 'one'), ('baz', 'two')]) - eq(msg.get_params(), None) - msg = email.message_from_string( - 'X-Header: foo; bar="one"; baz=two\n') - eq(msg.get_params(header='x-header'), - [('foo', ''), ('bar', 'one'), ('baz', 'two')]) - - def test_get_param_liberal(self): - msg = Message() - msg['Content-Type'] = 'Content-Type: Multipart/mixed; boundary = "CPIMSSMTPC06p5f3tG"' - self.assertEqual(msg.get_param('boundary'), 'CPIMSSMTPC06p5f3tG') - - def test_get_param(self): - eq = self.assertEqual - msg = email.message_from_string( - "X-Header: foo=one; bar=two; baz=three\n") - eq(msg.get_param('bar', header='x-header'), 'two') - eq(msg.get_param('quuz', header='x-header'), None) - eq(msg.get_param('quuz'), None) - msg = email.message_from_string( - 'X-Header: foo; bar="one"; baz=two\n') - eq(msg.get_param('foo', header='x-header'), '') - eq(msg.get_param('bar', header='x-header'), 'one') - eq(msg.get_param('baz', header='x-header'), 'two') - # XXX: We are not RFC-2045 compliant! We cannot parse: - # msg["Content-Type"] = 'text/plain; weird="hey; dolly? [you] @ <\\"home\\">?"' - # msg.get_param("weird") - # yet. - - def test_get_param_funky_continuation_lines(self): - msg = self._msgobj('msg_22.txt') - self.assertEqual(msg.get_payload(1).get_param('name'), 'wibble.JPG') - - def test_get_param_with_semis_in_quotes(self): - msg = email.message_from_string( - 'Content-Type: image/pjpeg; name="Jim&&Jill"\n') - self.assertEqual(msg.get_param('name'), 'Jim&&Jill') - self.assertEqual(msg.get_param('name', unquote=False), - '"Jim&&Jill"') - - def test_has_key(self): - msg = email.message_from_string('Header: exists') - self.failUnless(msg.has_key('header')) - self.failUnless(msg.has_key('Header')) - self.failUnless(msg.has_key('HEADER')) - self.failIf(msg.has_key('headeri')) - - def test_set_param(self): - eq = self.assertEqual - msg = Message() - msg.set_param('charset', 'iso-2022-jp') - eq(msg.get_param('charset'), 'iso-2022-jp') - msg.set_param('importance', 'high value') - eq(msg.get_param('importance'), 'high value') - eq(msg.get_param('importance', unquote=False), '"high value"') - eq(msg.get_params(), [('text/plain', ''), - ('charset', 'iso-2022-jp'), - ('importance', 'high value')]) - eq(msg.get_params(unquote=False), [('text/plain', ''), - ('charset', '"iso-2022-jp"'), - ('importance', '"high value"')]) - msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy') - eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx') - - def test_del_param(self): - eq = self.assertEqual - msg = self._msgobj('msg_05.txt') - eq(msg.get_params(), - [('multipart/report', ''), ('report-type', 'delivery-status'), - ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) - old_val = msg.get_param("report-type") - msg.del_param("report-type") - eq(msg.get_params(), - [('multipart/report', ''), - ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) - msg.set_param("report-type", old_val) - eq(msg.get_params(), - [('multipart/report', ''), - ('boundary', 'D1690A7AC1.996856090/mail.example.com'), - ('report-type', old_val)]) - - def test_del_param_on_other_header(self): - msg = Message() - msg.add_header('Content-Disposition', 'attachment', filename='bud.gif') - msg.del_param('filename', 'content-disposition') - self.assertEqual(msg['content-disposition'], 'attachment') - - def test_set_type(self): - eq = self.assertEqual - msg = Message() - self.assertRaises(ValueError, msg.set_type, 'text') - msg.set_type('text/plain') - eq(msg['content-type'], 'text/plain') - msg.set_param('charset', 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - msg.set_type('text/html') - eq(msg['content-type'], 'text/html; charset="us-ascii"') - - def test_set_type_on_other_header(self): - msg = Message() - msg['X-Content-Type'] = 'text/plain' - msg.set_type('application/octet-stream', 'X-Content-Type') - self.assertEqual(msg['x-content-type'], 'application/octet-stream') - - def test_get_content_type_missing(self): - msg = Message() - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_type_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_type(), 'message/rfc822') - - def test_get_content_type_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_type(), - 'message/rfc822') - - def test_get_content_type_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_type(), - 'message/rfc822') - - def test_get_content_type_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_type_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_maintype_missing(self): - msg = Message() - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_maintype_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_maintype_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_subtype_missing(self): - msg = Message() - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_subtype_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_subtype_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_maintype_error(self): - msg = Message() - msg['Content-Type'] = 'no-slash-in-this-string' - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_subtype_error(self): - msg = Message() - msg['Content-Type'] = 'no-slash-in-this-string' - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_replace_header(self): - eq = self.assertEqual - msg = Message() - msg.add_header('First', 'One') - msg.add_header('Second', 'Two') - msg.add_header('Third', 'Three') - eq(msg.keys(), ['First', 'Second', 'Third']) - eq(msg.values(), ['One', 'Two', 'Three']) - msg.replace_header('Second', 'Twenty') - eq(msg.keys(), ['First', 'Second', 'Third']) - eq(msg.values(), ['One', 'Twenty', 'Three']) - msg.add_header('First', 'Eleven') - msg.replace_header('First', 'One Hundred') - eq(msg.keys(), ['First', 'Second', 'Third', 'First']) - eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven']) - self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing') - - def test_broken_base64_payload(self): - x = 'AwDp0P7//y6LwKEAcPa/6Q=9' - msg = Message() - msg['content-type'] = 'audio/x-midi' - msg['content-transfer-encoding'] = 'base64' - msg.set_payload(x) - self.assertEqual(msg.get_payload(decode=True), x) - - def test_get_content_charset(self): - msg = Message() - msg.set_charset('us-ascii') - self.assertEqual('us-ascii', msg.get_content_charset()) - msg.set_charset(u'us-ascii') - self.assertEqual('us-ascii', msg.get_content_charset()) - - - -# Test the email.Encoders module -class TestEncoders(unittest.TestCase): - def test_encode_empty_payload(self): - eq = self.assertEqual - msg = Message() - msg.set_charset('us-ascii') - eq(msg['content-transfer-encoding'], '7bit') - - def test_default_cte(self): - eq = self.assertEqual - msg = MIMEText('hello world') - eq(msg['content-transfer-encoding'], '7bit') - - def test_default_cte(self): - eq = self.assertEqual - # With no explicit _charset its us-ascii, and all are 7-bit - msg = MIMEText('hello world') - eq(msg['content-transfer-encoding'], '7bit') - # Similar, but with 8-bit data - msg = MIMEText('hello \xf8 world') - eq(msg['content-transfer-encoding'], '8bit') - # And now with a different charset - msg = MIMEText('hello \xf8 world', _charset='iso-8859-1') - eq(msg['content-transfer-encoding'], 'quoted-printable') - - - -# Test long header wrapping -class TestLongHeaders(TestEmailBase): - def test_split_long_continuation(self): - eq = self.ndiffAssertEqual - msg = email.message_from_string("""\ -Subject: bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text - -test -""") - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -Subject: bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text - -test -""") - - def test_another_long_almost_unsplittable_header(self): - eq = self.ndiffAssertEqual - hstr = """\ -bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text""" - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text""") - h = Header(hstr) - eq(h.encode(), """\ -bug demonstration - 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 - more text""") - - def test_long_nonstring(self): - eq = self.ndiffAssertEqual - g = Charset("iso-8859-1") - cz = Charset("iso-8859-2") - utf8 = Charset("utf-8") - g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") - h = Header(g_head, g, header_name='Subject') - h.append(cz_head, cz) - h.append(utf8_head, utf8) - msg = Message() - msg['Subject'] = h - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= - =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= - =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= - =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= - =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= - =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= - =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= - =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= - =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= - =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= - =?utf-8?b?44Gm44GE44G+44GZ44CC?= - -""") - eq(h.encode(), """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= - =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= - =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= - =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= - =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= - =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= - =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= - =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= - =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= - =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= - =?utf-8?b?44Gm44GE44G+44GZ44CC?=""") - - def test_long_header_encode(self): - eq = self.ndiffAssertEqual - h = Header('wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"', - header_name='X-Foobar-Spoink-Defrobnit') - eq(h.encode(), '''\ -wasnipoop; giraffes="very-long-necked-animals"; - spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"''') - - def test_long_header_encode_with_tab_continuation(self): - eq = self.ndiffAssertEqual - h = Header('wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"', - header_name='X-Foobar-Spoink-Defrobnit', - continuation_ws='\t') - eq(h.encode(), '''\ -wasnipoop; giraffes="very-long-necked-animals"; -\tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey"''') - - def test_header_splitter(self): - eq = self.ndiffAssertEqual - msg = MIMEText('') - # It'd be great if we could use add_header() here, but that doesn't - # guarantee an order of the parameters. - msg['X-Foobar-Spoink-Defrobnit'] = ( - 'wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"') - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), '''\ -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; -\tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey" - -''') - - def test_no_semis_header_splitter(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['From'] = 'test@dom.ain' - msg['References'] = SPACE.join(['<%d@dom.ain>' % i for i in range(10)]) - msg.set_payload('Test') - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -From: test@dom.ain -References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain> -\t<5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain> - -Test""") - - def test_no_split_long_header(self): - eq = self.ndiffAssertEqual - hstr = 'References: ' + 'x' * 80 - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""") - - def test_splitting_multiple_long_lines(self): - eq = self.ndiffAssertEqual - hstr = """\ -from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -""" - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -from babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST)""") - - def test_splitting_first_line_only_is_long(self): - eq = self.ndiffAssertEqual - hstr = """\ -from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca) -\tby kronos.mems-exchange.org with esmtp (Exim 4.05) -\tid 17k4h5-00034i-00 -\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""" - h = Header(hstr, maxlinelen=78, header_name='Received', - continuation_ws='\t') - eq(h.encode(), """\ -from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] -\thelo=cthulhu.gerg.ca) -\tby kronos.mems-exchange.org with esmtp (Exim 4.05) -\tid 17k4h5-00034i-00 -\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""") - - def test_long_8bit_header(self): - eq = self.ndiffAssertEqual - msg = Message() - h = Header('Britische Regierung gibt', 'iso-8859-1', - header_name='Subject') - h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') - msg['Subject'] = h - eq(msg.as_string(), """\ -Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= =?iso-8859-1?q?gr=FCnes?= - =?iso-8859-1?q?_Licht_f=FCr_Offshore-Windkraftprojekte?= - -""") - - def test_long_8bit_header_no_charset(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['Reply-To'] = 'Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>' - eq(msg.as_string(), """\ -Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com> - -""") - - def test_long_to_header(self): - eq = self.ndiffAssertEqual - to = '"Someone Test #A" <someone@eecs.umich.edu>,<someone@eecs.umich.edu>,"Someone Test #B" <someone@umich.edu>, "Someone Test #C" <someone@eecs.umich.edu>, "Someone Test #D" <someone@eecs.umich.edu>' - msg = Message() - msg['To'] = to - eq(msg.as_string(0), '''\ -To: "Someone Test #A" <someone@eecs.umich.edu>, <someone@eecs.umich.edu>, -\t"Someone Test #B" <someone@umich.edu>, -\t"Someone Test #C" <someone@eecs.umich.edu>, -\t"Someone Test #D" <someone@eecs.umich.edu> - -''') - - def test_long_line_after_append(self): - eq = self.ndiffAssertEqual - s = 'This is an example of string which has almost the limit of header length.' - h = Header(s) - h.append('Add another line.') - eq(h.encode(), """\ -This is an example of string which has almost the limit of header length. - Add another line.""") - - def test_shorter_line_with_append(self): - eq = self.ndiffAssertEqual - s = 'This is a shorter line.' - h = Header(s) - h.append('Add another sentence. (Surprise?)') - eq(h.encode(), - 'This is a shorter line. Add another sentence. (Surprise?)') - - def test_long_field_name(self): - eq = self.ndiffAssertEqual - fn = 'X-Very-Very-Very-Long-Header-Name' - gs = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - h = Header(gs, 'iso-8859-1', header_name=fn) - # BAW: this seems broken because the first line is too long - eq(h.encode(), """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_?= - =?iso-8859-1?q?ein_werden_mit_einem_Foerderband_komfortabel_den_Korridor_?= - =?iso-8859-1?q?entlang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei=2C_g?= - =?iso-8859-1?q?egen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") - - def test_long_received_header(self): - h = 'from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; Wed, 05 Mar 2003 18:10:18 -0700' - msg = Message() - msg['Received-1'] = Header(h, continuation_ws='\t') - msg['Received-2'] = h - self.assertEqual(msg.as_string(), """\ -Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by -\throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; -\tWed, 05 Mar 2003 18:10:18 -0700 -Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by -\throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; -\tWed, 05 Mar 2003 18:10:18 -0700 - -""") - - def test_string_headerinst_eq(self): - h = '<15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David Bremner\'s message of "Thu, 6 Mar 2003 13:58:21 +0100")' - msg = Message() - msg['Received-1'] = Header(h, header_name='Received-1', - continuation_ws='\t') - msg['Received-2'] = h - self.assertEqual(msg.as_string(), """\ -Received-1: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> -\t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") -Received-2: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> -\t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") - -""") - - def test_long_unbreakable_lines_with_continuation(self): - eq = self.ndiffAssertEqual - msg = Message() - t = """\ - iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 - locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp""" - msg['Face-1'] = t - msg['Face-2'] = Header(t, header_name='Face-2') - eq(msg.as_string(), """\ -Face-1: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 -\tlocQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp -Face-2: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 - locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp - -""") - - def test_another_long_multiline_header(self): - eq = self.ndiffAssertEqual - m = '''\ -Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); -\tWed, 16 Oct 2002 07:41:11 -0700''' - msg = email.message_from_string(m) - eq(msg.as_string(), '''\ -Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with -\tMicrosoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 - -''') - - def test_long_lines_with_different_header(self): - eq = self.ndiffAssertEqual - h = """\ -List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, - <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>""" - msg = Message() - msg['List'] = h - msg['List'] = Header(h, header_name='List') - eq(msg.as_string(), """\ -List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, -\t<mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe> -List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, - <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe> - -""") - - - -# Test mangling of "From " lines in the body of a message -class TestFromMangling(unittest.TestCase): - def setUp(self): - self.msg = Message() - self.msg['From'] = 'aaa@bbb.org' - self.msg.set_payload("""\ -From the desk of A.A.A.: -Blah blah blah -""") - - def test_mangled_from(self): - s = StringIO() - g = Generator(s, mangle_from_=True) - g.flatten(self.msg) - self.assertEqual(s.getvalue(), """\ -From: aaa@bbb.org - ->From the desk of A.A.A.: -Blah blah blah -""") - - def test_dont_mangle_from(self): - s = StringIO() - g = Generator(s, mangle_from_=False) - g.flatten(self.msg) - self.assertEqual(s.getvalue(), """\ -From: aaa@bbb.org - -From the desk of A.A.A.: -Blah blah blah -""") - - - -# Test the basic MIMEAudio class -class TestMIMEAudio(unittest.TestCase): - def setUp(self): - # Make sure we pick up the audiotest.au that lives in email/test/data. - # In Python, there's an audiotest.au living in Lib/test but that isn't - # included in some binary distros that don't include the test - # package. The trailing empty string on the .join() is significant - # since findfile() will do a dirname(). - datadir = os.path.join(os.path.dirname(landmark), 'data', '') - fp = open(findfile('audiotest.au', datadir), 'rb') - try: - self._audiodata = fp.read() - finally: - fp.close() - self._au = MIMEAudio(self._audiodata) - - def test_guess_minor_type(self): - self.assertEqual(self._au.get_content_type(), 'audio/basic') - - def test_encoding(self): - payload = self._au.get_payload() - self.assertEqual(base64.decodestring(payload), self._audiodata) - - def test_checkSetMinor(self): - au = MIMEAudio(self._audiodata, 'fish') - self.assertEqual(au.get_content_type(), 'audio/fish') - - def test_add_header(self): - eq = self.assertEqual - unless = self.failUnless - self._au.add_header('Content-Disposition', 'attachment', - filename='audiotest.au') - eq(self._au['content-disposition'], - 'attachment; filename="audiotest.au"') - eq(self._au.get_params(header='content-disposition'), - [('attachment', ''), ('filename', 'audiotest.au')]) - eq(self._au.get_param('filename', header='content-disposition'), - 'audiotest.au') - missing = [] - eq(self._au.get_param('attachment', header='content-disposition'), '') - unless(self._au.get_param('foo', failobj=missing, - header='content-disposition') is missing) - # Try some missing stuff - unless(self._au.get_param('foobar', missing) is missing) - unless(self._au.get_param('attachment', missing, - header='foobar') is missing) - - - -# Test the basic MIMEImage class -class TestMIMEImage(unittest.TestCase): - def setUp(self): - fp = openfile('PyBanner048.gif') - try: - self._imgdata = fp.read() - finally: - fp.close() - self._im = MIMEImage(self._imgdata) - - def test_guess_minor_type(self): - self.assertEqual(self._im.get_content_type(), 'image/gif') - - def test_encoding(self): - payload = self._im.get_payload() - self.assertEqual(base64.decodestring(payload), self._imgdata) - - def test_checkSetMinor(self): - im = MIMEImage(self._imgdata, 'fish') - self.assertEqual(im.get_content_type(), 'image/fish') - - def test_add_header(self): - eq = self.assertEqual - unless = self.failUnless - self._im.add_header('Content-Disposition', 'attachment', - filename='dingusfish.gif') - eq(self._im['content-disposition'], - 'attachment; filename="dingusfish.gif"') - eq(self._im.get_params(header='content-disposition'), - [('attachment', ''), ('filename', 'dingusfish.gif')]) - eq(self._im.get_param('filename', header='content-disposition'), - 'dingusfish.gif') - missing = [] - eq(self._im.get_param('attachment', header='content-disposition'), '') - unless(self._im.get_param('foo', failobj=missing, - header='content-disposition') is missing) - # Try some missing stuff - unless(self._im.get_param('foobar', missing) is missing) - unless(self._im.get_param('attachment', missing, - header='foobar') is missing) - - - -# Test the basic MIMEText class -class TestMIMEText(unittest.TestCase): - def setUp(self): - self._msg = MIMEText('hello there') - - def test_types(self): - eq = self.assertEqual - unless = self.failUnless - eq(self._msg.get_content_type(), 'text/plain') - eq(self._msg.get_param('charset'), 'us-ascii') - missing = [] - unless(self._msg.get_param('foobar', missing) is missing) - unless(self._msg.get_param('charset', missing, header='foobar') - is missing) - - def test_payload(self): - self.assertEqual(self._msg.get_payload(), 'hello there') - self.failUnless(not self._msg.is_multipart()) - - def test_charset(self): - eq = self.assertEqual - msg = MIMEText('hello there', _charset='us-ascii') - eq(msg.get_charset().input_charset, 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - - - -# Test complicated multipart/* messages -class TestMultipart(TestEmailBase): - def setUp(self): - fp = openfile('PyBanner048.gif') - try: - data = fp.read() - finally: - fp.close() - - container = MIMEBase('multipart', 'mixed', boundary='BOUNDARY') - image = MIMEImage(data, name='dingusfish.gif') - image.add_header('content-disposition', 'attachment', - filename='dingusfish.gif') - intro = MIMEText('''\ -Hi there, - -This is the dingus fish. -''') - container.attach(intro) - container.attach(image) - container['From'] = 'Barry <barry@digicool.com>' - container['To'] = 'Dingus Lovers <cravindogs@cravindogs.com>' - container['Subject'] = 'Here is your dingus fish' - - now = 987809702.54848599 - timetuple = time.localtime(now) - if timetuple[-1] == 0: - tzsecs = time.timezone - else: - tzsecs = time.altzone - if tzsecs > 0: - sign = '-' - else: - sign = '+' - tzoffset = ' %s%04d' % (sign, tzsecs / 36) - container['Date'] = time.strftime( - '%a, %d %b %Y %H:%M:%S', - time.localtime(now)) + tzoffset - self._msg = container - self._im = image - self._txt = intro - - def test_hierarchy(self): - # convenience - eq = self.assertEqual - unless = self.failUnless - raises = self.assertRaises - # tests - m = self._msg - unless(m.is_multipart()) - eq(m.get_content_type(), 'multipart/mixed') - eq(len(m.get_payload()), 2) - raises(IndexError, m.get_payload, 2) - m0 = m.get_payload(0) - m1 = m.get_payload(1) - unless(m0 is self._txt) - unless(m1 is self._im) - eq(m.get_payload(), [m0, m1]) - unless(not m0.is_multipart()) - unless(not m1.is_multipart()) - - def test_empty_multipart_idempotent(self): - text = """\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY - - ---BOUNDARY-- -""" - msg = Parser().parsestr(text) - self.ndiffAssertEqual(text, msg.as_string()) - - def test_no_parts_in_a_multipart_with_none_epilogue(self): - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.set_boundary('BOUNDARY') - self.ndiffAssertEqual(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY - ---BOUNDARY--''') - - def test_no_parts_in_a_multipart_with_empty_epilogue(self): - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = '' - outer.epilogue = '' - outer.set_boundary('BOUNDARY') - self.ndiffAssertEqual(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY - ---BOUNDARY-- -''') - - def test_one_part_in_a_multipart(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.set_boundary('BOUNDARY') - msg = MIMEText('hello world') - outer.attach(msg) - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - def test_seq_parts_in_a_multipart_with_empty_preamble(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = '' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_none_preamble(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = None - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_none_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = None - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_empty_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = '' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY-- -''') - - - def test_seq_parts_in_a_multipart_with_nl_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = '\n' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY-- - -''') - - def test_message_external_body(self): - eq = self.assertEqual - msg = self._msgobj('msg_36.txt') - eq(len(msg.get_payload()), 2) - msg1 = msg.get_payload(1) - eq(msg1.get_content_type(), 'multipart/alternative') - eq(len(msg1.get_payload()), 2) - for subpart in msg1.get_payload(): - eq(subpart.get_content_type(), 'message/external-body') - eq(len(subpart.get_payload()), 1) - subsubpart = subpart.get_payload(0) - eq(subsubpart.get_content_type(), 'text/plain') - - def test_double_boundary(self): - # msg_37.txt is a multipart that contains two dash-boundary's in a - # row. Our interpretation of RFC 2046 calls for ignoring the second - # and subsequent boundaries. - msg = self._msgobj('msg_37.txt') - self.assertEqual(len(msg.get_payload()), 3) - - def test_nested_inner_contains_outer_boundary(self): - eq = self.ndiffAssertEqual - # msg_38.txt has an inner part that contains outer boundaries. My - # interpretation of RFC 2046 (based on sections 5.1 and 5.1.2) say - # these are illegal and should be interpreted as unterminated inner - # parts. - msg = self._msgobj('msg_38.txt') - sfp = StringIO() - Iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/mixed - multipart/mixed - multipart/alternative - text/plain - text/plain - text/plain - text/plain -""") - - def test_nested_with_same_boundary(self): - eq = self.ndiffAssertEqual - # msg 39.txt is similarly evil in that it's got inner parts that use - # the same boundary as outer parts. Again, I believe the way this is - # parsed is closest to the spirit of RFC 2046 - msg = self._msgobj('msg_39.txt') - sfp = StringIO() - Iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/mixed - multipart/mixed - multipart/alternative - application/octet-stream - application/octet-stream - text/plain -""") - - def test_boundary_in_non_multipart(self): - msg = self._msgobj('msg_40.txt') - self.assertEqual(msg.as_string(), '''\ -MIME-Version: 1.0 -Content-Type: text/html; boundary="--961284236552522269" - -----961284236552522269 -Content-Type: text/html; -Content-Transfer-Encoding: 7Bit - -<html></html> - -----961284236552522269-- -''') - - def test_boundary_with_leading_space(self): - eq = self.assertEqual - msg = email.message_from_string('''\ -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary=" XXXX" - --- XXXX -Content-Type: text/plain - - --- XXXX -Content-Type: text/plain - --- XXXX-- -''') - self.failUnless(msg.is_multipart()) - eq(msg.get_boundary(), ' XXXX') - eq(len(msg.get_payload()), 2) - - def test_boundary_without_trailing_newline(self): - m = Parser().parsestr("""\ -Content-Type: multipart/mixed; boundary="===============0012394164==" -MIME-Version: 1.0 - ---===============0012394164== -Content-Type: image/file1.jpg -MIME-Version: 1.0 -Content-Transfer-Encoding: base64 - -YXNkZg== ---===============0012394164==--""") - self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==') - - - -# Test some badly formatted messages -class TestNonConformant(TestEmailBase): - def test_parse_missing_minor_type(self): - eq = self.assertEqual - msg = self._msgobj('msg_14.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - - def test_same_boundary_inner_outer(self): - unless = self.failUnless - msg = self._msgobj('msg_15.txt') - # XXX We can probably eventually do better - inner = msg.get_payload(0) - unless(hasattr(inner, 'defects')) - self.assertEqual(len(inner.defects), 1) - unless(isinstance(inner.defects[0], - Errors.StartBoundaryNotFoundDefect)) - - def test_multipart_no_boundary(self): - unless = self.failUnless - msg = self._msgobj('msg_25.txt') - unless(isinstance(msg.get_payload(), str)) - self.assertEqual(len(msg.defects), 2) - unless(isinstance(msg.defects[0], Errors.NoBoundaryInMultipartDefect)) - unless(isinstance(msg.defects[1], - Errors.MultipartInvariantViolationDefect)) - - def test_invalid_content_type(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - msg = Message() - # RFC 2045, $5.2 says invalid yields text/plain - msg['Content-Type'] = 'text' - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_content_type(), 'text/plain') - # Clear the old value and try something /really/ invalid - del msg['content-type'] - msg['Content-Type'] = 'foo' - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_content_type(), 'text/plain') - # Still, make sure that the message is idempotently generated - s = StringIO() - g = Generator(s) - g.flatten(msg) - neq(s.getvalue(), 'Content-Type: foo\n\n') - - def test_no_start_boundary(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_31.txt') - eq(msg.get_payload(), """\ ---BOUNDARY -Content-Type: text/plain - -message 1 - ---BOUNDARY -Content-Type: text/plain - -message 2 - ---BOUNDARY-- -""") - - def test_no_separating_blank_line(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_35.txt') - eq(msg.as_string(), """\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: here's something interesting - -counter to RFC 2822, there's no separating newline here -""") - - def test_lying_multipart(self): - unless = self.failUnless - msg = self._msgobj('msg_41.txt') - unless(hasattr(msg, 'defects')) - self.assertEqual(len(msg.defects), 2) - unless(isinstance(msg.defects[0], Errors.NoBoundaryInMultipartDefect)) - unless(isinstance(msg.defects[1], - Errors.MultipartInvariantViolationDefect)) - - def test_missing_start_boundary(self): - outer = self._msgobj('msg_42.txt') - # The message structure is: - # - # multipart/mixed - # text/plain - # message/rfc822 - # multipart/mixed [*] - # - # [*] This message is missing its start boundary - bad = outer.get_payload(1).get_payload(0) - self.assertEqual(len(bad.defects), 1) - self.failUnless(isinstance(bad.defects[0], - Errors.StartBoundaryNotFoundDefect)) - - - -# Test RFC 2047 header encoding and decoding -class TestRFC2047(unittest.TestCase): - def test_rfc2047_multiline(self): - eq = self.assertEqual - s = """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz - foo bar =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""" - dh = decode_header(s) - eq(dh, [ - ('Re:', None), - ('r\x8aksm\x9arg\x8cs', 'mac-iceland'), - ('baz foo bar', None), - ('r\x8aksm\x9arg\x8cs', 'mac-iceland')]) - eq(str(make_header(dh)), - """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar - =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""") - - def test_whitespace_eater_unicode(self): - eq = self.assertEqual - s = '=?ISO-8859-1?Q?Andr=E9?= Pirard <pirard@dom.ain>' - dh = decode_header(s) - eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard <pirard@dom.ain>', None)]) - hu = unicode(make_header(dh)).encode('latin-1') - eq(hu, 'Andr\xe9 Pirard <pirard@dom.ain>') - - def test_whitespace_eater_unicode_2(self): - eq = self.assertEqual - s = 'The =?iso-8859-1?b?cXVpY2sgYnJvd24gZm94?= jumped over the =?iso-8859-1?b?bGF6eSBkb2c=?=' - dh = decode_header(s) - eq(dh, [('The', None), ('quick brown fox', 'iso-8859-1'), - ('jumped over the', None), ('lazy dog', 'iso-8859-1')]) - hu = make_header(dh).__unicode__() - eq(hu, u'The quick brown fox jumped over the lazy dog') - - def test_rfc2047_without_whitespace(self): - s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' - dh = decode_header(s) - self.assertEqual(dh, [(s, None)]) - - def test_rfc2047_with_whitespace(self): - s = 'Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord' - dh = decode_header(s) - self.assertEqual(dh, [('Sm', None), ('\xf6', 'iso-8859-1'), - ('rg', None), ('\xe5', 'iso-8859-1'), - ('sbord', None)]) - - - -# Test the MIMEMessage class -class TestMIMEMessage(TestEmailBase): - def setUp(self): - fp = openfile('msg_11.txt') - try: - self._text = fp.read() - finally: - fp.close() - - def test_type_error(self): - self.assertRaises(TypeError, MIMEMessage, 'a plain string') - - def test_valid_argument(self): - eq = self.assertEqual - unless = self.failUnless - subject = 'A sub-message' - m = Message() - m['Subject'] = subject - r = MIMEMessage(m) - eq(r.get_content_type(), 'message/rfc822') - payload = r.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - subpart = payload[0] - unless(subpart is m) - eq(subpart['subject'], subject) - - def test_bad_multipart(self): - eq = self.assertEqual - msg1 = Message() - msg1['Subject'] = 'subpart 1' - msg2 = Message() - msg2['Subject'] = 'subpart 2' - r = MIMEMessage(msg1) - self.assertRaises(Errors.MultipartConversionError, r.attach, msg2) - - def test_generate(self): - # First craft the message to be encapsulated - m = Message() - m['Subject'] = 'An enclosed message' - m.set_payload('Here is the body of the message.\n') - r = MIMEMessage(m) - r['Subject'] = 'The enclosing message' - s = StringIO() - g = Generator(s) - g.flatten(r) - self.assertEqual(s.getvalue(), """\ -Content-Type: message/rfc822 -MIME-Version: 1.0 -Subject: The enclosing message - -Subject: An enclosed message - -Here is the body of the message. -""") - - def test_parse_message_rfc822(self): - eq = self.assertEqual - unless = self.failUnless - msg = self._msgobj('msg_11.txt') - eq(msg.get_content_type(), 'message/rfc822') - payload = msg.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - submsg = payload[0] - self.failUnless(isinstance(submsg, Message)) - eq(submsg['subject'], 'An enclosed message') - eq(submsg.get_payload(), 'Here is the body of the message.\n') - - def test_dsn(self): - eq = self.assertEqual - unless = self.failUnless - # msg 16 is a Delivery Status Notification, see RFC 1894 - msg = self._msgobj('msg_16.txt') - eq(msg.get_content_type(), 'multipart/report') - unless(msg.is_multipart()) - eq(len(msg.get_payload()), 3) - # Subpart 1 is a text/plain, human readable section - subpart = msg.get_payload(0) - eq(subpart.get_content_type(), 'text/plain') - eq(subpart.get_payload(), """\ -This report relates to a message you sent with the following header fields: - - Message-id: <002001c144a6$8752e060$56104586@oxy.edu> - Date: Sun, 23 Sep 2001 20:10:55 -0700 - From: "Ian T. Henry" <henryi@oxy.edu> - To: SoCal Raves <scr@socal-raves.org> - Subject: [scr] yeah for Ians!! - -Your message cannot be delivered to the following recipients: - - Recipient address: jangel1@cougar.noc.ucla.edu - Reason: recipient reached disk quota - -""") - # Subpart 2 contains the machine parsable DSN information. It - # consists of two blocks of headers, represented by two nested Message - # objects. - subpart = msg.get_payload(1) - eq(subpart.get_content_type(), 'message/delivery-status') - eq(len(subpart.get_payload()), 2) - # message/delivery-status should treat each block as a bunch of - # headers, i.e. a bunch of Message objects. - dsn1 = subpart.get_payload(0) - unless(isinstance(dsn1, Message)) - eq(dsn1['original-envelope-id'], '0GK500B4HD0888@cougar.noc.ucla.edu') - eq(dsn1.get_param('dns', header='reporting-mta'), '') - # Try a missing one <wink> - eq(dsn1.get_param('nsd', header='reporting-mta'), None) - dsn2 = subpart.get_payload(1) - unless(isinstance(dsn2, Message)) - eq(dsn2['action'], 'failed') - eq(dsn2.get_params(header='original-recipient'), - [('rfc822', ''), ('jangel1@cougar.noc.ucla.edu', '')]) - eq(dsn2.get_param('rfc822', header='final-recipient'), '') - # Subpart 3 is the original message - subpart = msg.get_payload(2) - eq(subpart.get_content_type(), 'message/rfc822') - payload = subpart.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - subsubpart = payload[0] - unless(isinstance(subsubpart, Message)) - eq(subsubpart.get_content_type(), 'text/plain') - eq(subsubpart['message-id'], - '<002001c144a6$8752e060$56104586@oxy.edu>') - - def test_epilogue(self): - eq = self.ndiffAssertEqual - fp = openfile('msg_21.txt') - try: - text = fp.read() - finally: - fp.close() - msg = Message() - msg['From'] = 'aperson@dom.ain' - msg['To'] = 'bperson@dom.ain' - msg['Subject'] = 'Test' - msg.preamble = 'MIME message' - msg.epilogue = 'End of MIME message\n' - msg1 = MIMEText('One') - msg2 = MIMEText('Two') - msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') - msg.attach(msg1) - msg.attach(msg2) - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), text) - - def test_no_nl_preamble(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['From'] = 'aperson@dom.ain' - msg['To'] = 'bperson@dom.ain' - msg['Subject'] = 'Test' - msg.preamble = 'MIME message' - msg.epilogue = '' - msg1 = MIMEText('One') - msg2 = MIMEText('Two') - msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') - msg.attach(msg1) - msg.attach(msg2) - eq(msg.as_string(), """\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: Test -Content-Type: multipart/mixed; boundary="BOUNDARY" - -MIME message ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -One ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -Two ---BOUNDARY-- -""") - - def test_default_type(self): - eq = self.assertEqual - fp = openfile('msg_30.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - container1 = msg.get_payload(0) - eq(container1.get_default_type(), 'message/rfc822') - eq(container1.get_content_type(), 'message/rfc822') - container2 = msg.get_payload(1) - eq(container2.get_default_type(), 'message/rfc822') - eq(container2.get_content_type(), 'message/rfc822') - container1a = container1.get_payload(0) - eq(container1a.get_default_type(), 'text/plain') - eq(container1a.get_content_type(), 'text/plain') - container2a = container2.get_payload(0) - eq(container2a.get_default_type(), 'text/plain') - eq(container2a.get_content_type(), 'text/plain') - - def test_default_type_with_explicit_container_type(self): - eq = self.assertEqual - fp = openfile('msg_28.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - container1 = msg.get_payload(0) - eq(container1.get_default_type(), 'message/rfc822') - eq(container1.get_content_type(), 'message/rfc822') - container2 = msg.get_payload(1) - eq(container2.get_default_type(), 'message/rfc822') - eq(container2.get_content_type(), 'message/rfc822') - container1a = container1.get_payload(0) - eq(container1a.get_default_type(), 'text/plain') - eq(container1a.get_content_type(), 'text/plain') - container2a = container2.get_payload(0) - eq(container2a.get_default_type(), 'text/plain') - eq(container2a.get_content_type(), 'text/plain') - - def test_default_type_non_parsed(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - # Set up container - container = MIMEMultipart('digest', 'BOUNDARY') - container.epilogue = '' - # Set up subparts - subpart1a = MIMEText('message 1\n') - subpart2a = MIMEText('message 2\n') - subpart1 = MIMEMessage(subpart1a) - subpart2 = MIMEMessage(subpart2a) - container.attach(subpart1) - container.attach(subpart2) - eq(subpart1.get_content_type(), 'message/rfc822') - eq(subpart1.get_default_type(), 'message/rfc822') - eq(subpart2.get_content_type(), 'message/rfc822') - eq(subpart2.get_default_type(), 'message/rfc822') - neq(container.as_string(0), '''\ -Content-Type: multipart/digest; boundary="BOUNDARY" -MIME-Version: 1.0 - ---BOUNDARY -Content-Type: message/rfc822 -MIME-Version: 1.0 - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 1 - ---BOUNDARY -Content-Type: message/rfc822 -MIME-Version: 1.0 - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 2 - ---BOUNDARY-- -''') - del subpart1['content-type'] - del subpart1['mime-version'] - del subpart2['content-type'] - del subpart2['mime-version'] - eq(subpart1.get_content_type(), 'message/rfc822') - eq(subpart1.get_default_type(), 'message/rfc822') - eq(subpart2.get_content_type(), 'message/rfc822') - eq(subpart2.get_default_type(), 'message/rfc822') - neq(container.as_string(0), '''\ -Content-Type: multipart/digest; boundary="BOUNDARY" -MIME-Version: 1.0 - ---BOUNDARY - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 1 - ---BOUNDARY - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 2 - ---BOUNDARY-- -''') - - def test_mime_attachments_in_constructor(self): - eq = self.assertEqual - text1 = MIMEText('') - text2 = MIMEText('') - msg = MIMEMultipart(_subparts=(text1, text2)) - eq(len(msg.get_payload()), 2) - eq(msg.get_payload(0), text1) - eq(msg.get_payload(1), text2) - - - -# A general test of parser->model->generator idempotency. IOW, read a message -# in, parse it into a message object tree, then without touching the tree, -# regenerate the plain text. The original text and the transformed text -# should be identical. Note: that we ignore the Unix-From since that may -# contain a changed date. -class TestIdempotent(TestEmailBase): - def _msgobj(self, filename): - fp = openfile(filename) - try: - data = fp.read() - finally: - fp.close() - msg = email.message_from_string(data) - return msg, data - - def _idempotent(self, msg, text): - eq = self.ndiffAssertEqual - s = StringIO() - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - eq(text, s.getvalue()) - - def test_parse_text_message(self): - eq = self.assertEquals - msg, text = self._msgobj('msg_01.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_params()[1], ('charset', 'us-ascii')) - eq(msg.get_param('charset'), 'us-ascii') - eq(msg.preamble, None) - eq(msg.epilogue, None) - self._idempotent(msg, text) - - def test_parse_untyped_message(self): - eq = self.assertEquals - msg, text = self._msgobj('msg_03.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_params(), None) - eq(msg.get_param('charset'), None) - self._idempotent(msg, text) - - def test_simple_multipart(self): - msg, text = self._msgobj('msg_04.txt') - self._idempotent(msg, text) - - def test_MIME_digest(self): - msg, text = self._msgobj('msg_02.txt') - self._idempotent(msg, text) - - def test_long_header(self): - msg, text = self._msgobj('msg_27.txt') - self._idempotent(msg, text) - - def test_MIME_digest_with_part_headers(self): - msg, text = self._msgobj('msg_28.txt') - self._idempotent(msg, text) - - def test_mixed_with_image(self): - msg, text = self._msgobj('msg_06.txt') - self._idempotent(msg, text) - - def test_multipart_report(self): - msg, text = self._msgobj('msg_05.txt') - self._idempotent(msg, text) - - def test_dsn(self): - msg, text = self._msgobj('msg_16.txt') - self._idempotent(msg, text) - - def test_preamble_epilogue(self): - msg, text = self._msgobj('msg_21.txt') - self._idempotent(msg, text) - - def test_multipart_one_part(self): - msg, text = self._msgobj('msg_23.txt') - self._idempotent(msg, text) - - def test_multipart_no_parts(self): - msg, text = self._msgobj('msg_24.txt') - self._idempotent(msg, text) - - def test_no_start_boundary(self): - msg, text = self._msgobj('msg_31.txt') - self._idempotent(msg, text) - - def test_rfc2231_charset(self): - msg, text = self._msgobj('msg_32.txt') - self._idempotent(msg, text) - - def test_more_rfc2231_parameters(self): - msg, text = self._msgobj('msg_33.txt') - self._idempotent(msg, text) - - def test_text_plain_in_a_multipart_digest(self): - msg, text = self._msgobj('msg_34.txt') - self._idempotent(msg, text) - - def test_nested_multipart_mixeds(self): - msg, text = self._msgobj('msg_12a.txt') - self._idempotent(msg, text) - - def test_message_external_body_idempotent(self): - msg, text = self._msgobj('msg_36.txt') - self._idempotent(msg, text) - - def test_content_type(self): - eq = self.assertEquals - unless = self.failUnless - # Get a message object and reset the seek pointer for other tests - msg, text = self._msgobj('msg_05.txt') - eq(msg.get_content_type(), 'multipart/report') - # Test the Content-Type: parameters - params = {} - for pk, pv in msg.get_params(): - params[pk] = pv - eq(params['report-type'], 'delivery-status') - eq(params['boundary'], 'D1690A7AC1.996856090/mail.example.com') - eq(msg.preamble, 'This is a MIME-encapsulated message.\n') - eq(msg.epilogue, '\n') - eq(len(msg.get_payload()), 3) - # Make sure the subparts are what we expect - msg1 = msg.get_payload(0) - eq(msg1.get_content_type(), 'text/plain') - eq(msg1.get_payload(), 'Yadda yadda yadda\n') - msg2 = msg.get_payload(1) - eq(msg2.get_content_type(), 'text/plain') - eq(msg2.get_payload(), 'Yadda yadda yadda\n') - msg3 = msg.get_payload(2) - eq(msg3.get_content_type(), 'message/rfc822') - self.failUnless(isinstance(msg3, Message)) - payload = msg3.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - msg4 = payload[0] - unless(isinstance(msg4, Message)) - eq(msg4.get_payload(), 'Yadda yadda yadda\n') - - def test_parser(self): - eq = self.assertEquals - unless = self.failUnless - msg, text = self._msgobj('msg_06.txt') - # Check some of the outer headers - eq(msg.get_content_type(), 'message/rfc822') - # Make sure the payload is a list of exactly one sub-Message, and that - # that submessage has a type of text/plain - payload = msg.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - msg1 = payload[0] - self.failUnless(isinstance(msg1, Message)) - eq(msg1.get_content_type(), 'text/plain') - self.failUnless(isinstance(msg1.get_payload(), str)) - eq(msg1.get_payload(), '\n') - - - -# Test various other bits of the package's functionality -class TestMiscellaneous(TestEmailBase): - def test_message_from_string(self): - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - msg = email.message_from_string(text) - s = StringIO() - # Don't wrap/continue long headers since we're trying to test - # idempotency. - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - self.assertEqual(text, s.getvalue()) - - def test_message_from_file(self): - fp = openfile('msg_01.txt') - try: - text = fp.read() - fp.seek(0) - msg = email.message_from_file(fp) - s = StringIO() - # Don't wrap/continue long headers since we're trying to test - # idempotency. - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - self.assertEqual(text, s.getvalue()) - finally: - fp.close() - - def test_message_from_string_with_class(self): - unless = self.failUnless - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - # Create a subclass - class MyMessage(Message): - pass - - msg = email.message_from_string(text, MyMessage) - unless(isinstance(msg, MyMessage)) - # Try something more complicated - fp = openfile('msg_02.txt') - try: - text = fp.read() - finally: - fp.close() - msg = email.message_from_string(text, MyMessage) - for subpart in msg.walk(): - unless(isinstance(subpart, MyMessage)) - - def test_message_from_file_with_class(self): - unless = self.failUnless - # Create a subclass - class MyMessage(Message): - pass - - fp = openfile('msg_01.txt') - try: - msg = email.message_from_file(fp, MyMessage) - finally: - fp.close() - unless(isinstance(msg, MyMessage)) - # Try something more complicated - fp = openfile('msg_02.txt') - try: - msg = email.message_from_file(fp, MyMessage) - finally: - fp.close() - for subpart in msg.walk(): - unless(isinstance(subpart, MyMessage)) - - def test__all__(self): - module = __import__('email') - all = module.__all__ - all.sort() - self.assertEqual(all, [ - # Old names - 'Charset', 'Encoders', 'Errors', 'Generator', - 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', - 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', - 'MIMENonMultipart', 'MIMEText', 'Message', - 'Parser', 'Utils', 'base64MIME', - # new names - 'base64mime', 'charset', 'encoders', 'errors', 'generator', - 'header', 'iterators', 'message', 'message_from_file', - 'message_from_string', 'mime', 'parser', - 'quopriMIME', 'quoprimime', 'utils', - ]) - - def test_formatdate(self): - now = time.time() - self.assertEqual(Utils.parsedate(Utils.formatdate(now))[:6], - time.gmtime(now)[:6]) - - def test_formatdate_localtime(self): - now = time.time() - self.assertEqual( - Utils.parsedate(Utils.formatdate(now, localtime=True))[:6], - time.localtime(now)[:6]) - - def test_formatdate_usegmt(self): - now = time.time() - self.assertEqual( - Utils.formatdate(now, localtime=False), - time.strftime('%a, %d %b %Y %H:%M:%S -0000', time.gmtime(now))) - self.assertEqual( - Utils.formatdate(now, localtime=False, usegmt=True), - time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(now))) - - def test_parsedate_none(self): - self.assertEqual(Utils.parsedate(''), None) - - def test_parsedate_compact(self): - # The FWS after the comma is optional - self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'), - Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) - - def test_parsedate_no_dayofweek(self): - eq = self.assertEqual - eq(Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'), - (2003, 2, 25, 13, 47, 26, 0, 1, -1, -28800)) - - def test_parsedate_compact_no_dayofweek(self): - eq = self.assertEqual - eq(Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'), - (2003, 2, 5, 13, 47, 26, 0, 1, -1, -28800)) - - def test_parsedate_acceptable_to_time_functions(self): - eq = self.assertEqual - timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') - t = int(time.mktime(timetup)) - eq(time.localtime(t)[:6], timetup[:6]) - eq(int(time.strftime('%Y', timetup)), 2003) - timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') - t = int(time.mktime(timetup[:9])) - eq(time.localtime(t)[:6], timetup[:6]) - eq(int(time.strftime('%Y', timetup[:9])), 2003) - - def test_parseaddr_empty(self): - self.assertEqual(Utils.parseaddr('<>'), ('', '')) - self.assertEqual(Utils.formataddr(Utils.parseaddr('<>')), '') - - def test_noquote_dump(self): - self.assertEqual( - Utils.formataddr(('A Silly Person', 'person@dom.ain')), - 'A Silly Person <person@dom.ain>') - - def test_escape_dump(self): - self.assertEqual( - Utils.formataddr(('A (Very) Silly Person', 'person@dom.ain')), - r'"A \(Very\) Silly Person" <person@dom.ain>') - a = r'A \(Special\) Person' - b = 'person@dom.ain' - self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b)) - - def test_escape_backslashes(self): - self.assertEqual( - Utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')), - r'"Arthur \\Backslash\\ Foobar" <person@dom.ain>') - a = r'Arthur \Backslash\ Foobar' - b = 'person@dom.ain' - self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b)) - - def test_name_with_dot(self): - x = 'John X. Doe <jxd@example.com>' - y = '"John X. Doe" <jxd@example.com>' - a, b = ('John X. Doe', 'jxd@example.com') - self.assertEqual(Utils.parseaddr(x), (a, b)) - self.assertEqual(Utils.parseaddr(y), (a, b)) - # formataddr() quotes the name if there's a dot in it - self.assertEqual(Utils.formataddr((a, b)), y) - - def test_multiline_from_comment(self): - x = """\ -Foo -\tBar <foo@example.com>""" - self.assertEqual(Utils.parseaddr(x), ('Foo Bar', 'foo@example.com')) - - def test_quote_dump(self): - self.assertEqual( - Utils.formataddr(('A Silly; Person', 'person@dom.ain')), - r'"A Silly; Person" <person@dom.ain>') - - def test_fix_eols(self): - eq = self.assertEqual - eq(Utils.fix_eols('hello'), 'hello') - eq(Utils.fix_eols('hello\n'), 'hello\r\n') - eq(Utils.fix_eols('hello\r'), 'hello\r\n') - eq(Utils.fix_eols('hello\r\n'), 'hello\r\n') - eq(Utils.fix_eols('hello\n\r'), 'hello\r\n\r\n') - - def test_charset_richcomparisons(self): - eq = self.assertEqual - ne = self.failIfEqual - cset1 = Charset() - cset2 = Charset() - eq(cset1, 'us-ascii') - eq(cset1, 'US-ASCII') - eq(cset1, 'Us-AsCiI') - eq('us-ascii', cset1) - eq('US-ASCII', cset1) - eq('Us-AsCiI', cset1) - ne(cset1, 'usascii') - ne(cset1, 'USASCII') - ne(cset1, 'UsAsCiI') - ne('usascii', cset1) - ne('USASCII', cset1) - ne('UsAsCiI', cset1) - eq(cset1, cset2) - eq(cset2, cset1) - - def test_getaddresses(self): - eq = self.assertEqual - eq(Utils.getaddresses(['aperson@dom.ain (Al Person)', - 'Bud Person <bperson@dom.ain>']), - [('Al Person', 'aperson@dom.ain'), - ('Bud Person', 'bperson@dom.ain')]) - - def test_getaddresses_nasty(self): - eq = self.assertEqual - eq(Utils.getaddresses(['foo: ;']), [('', '')]) - eq(Utils.getaddresses( - ['[]*-- =~$']), - [('', ''), ('', ''), ('', '*--')]) - eq(Utils.getaddresses( - ['foo: ;', '"Jason R. Mastaler" <jason@dom.ain>']), - [('', ''), ('Jason R. Mastaler', 'jason@dom.ain')]) - - def test_getaddresses_embedded_comment(self): - """Test proper handling of a nested comment""" - eq = self.assertEqual - addrs = Utils.getaddresses(['User ((nested comment)) <foo@bar.com>']) - eq(addrs[0][1], 'foo@bar.com') - - def test_utils_quote_unquote(self): - eq = self.assertEqual - msg = Message() - msg.add_header('content-disposition', 'attachment', - filename='foo\\wacky"name') - eq(msg.get_filename(), 'foo\\wacky"name') - - def test_get_body_encoding_with_bogus_charset(self): - charset = Charset('not a charset') - self.assertEqual(charset.get_body_encoding(), 'base64') - - def test_get_body_encoding_with_uppercase_charset(self): - eq = self.assertEqual - msg = Message() - msg['Content-Type'] = 'text/plain; charset=UTF-8' - eq(msg['content-type'], 'text/plain; charset=UTF-8') - charsets = msg.get_charsets() - eq(len(charsets), 1) - eq(charsets[0], 'utf-8') - charset = Charset(charsets[0]) - eq(charset.get_body_encoding(), 'base64') - msg.set_payload('hello world', charset=charset) - eq(msg.get_payload(), 'aGVsbG8gd29ybGQ=\n') - eq(msg.get_payload(decode=True), 'hello world') - eq(msg['content-transfer-encoding'], 'base64') - # Try another one - msg = Message() - msg['Content-Type'] = 'text/plain; charset="US-ASCII"' - charsets = msg.get_charsets() - eq(len(charsets), 1) - eq(charsets[0], 'us-ascii') - charset = Charset(charsets[0]) - eq(charset.get_body_encoding(), Encoders.encode_7or8bit) - msg.set_payload('hello world', charset=charset) - eq(msg.get_payload(), 'hello world') - eq(msg['content-transfer-encoding'], '7bit') - - def test_charsets_case_insensitive(self): - lc = Charset('us-ascii') - uc = Charset('US-ASCII') - self.assertEqual(lc.get_body_encoding(), uc.get_body_encoding()) - - def test_partial_falls_inside_message_delivery_status(self): - eq = self.ndiffAssertEqual - # The Parser interface provides chunks of data to FeedParser in 8192 - # byte gulps. SF bug #1076485 found one of those chunks inside - # message/delivery-status header block, which triggered an - # unreadline() of NeedMoreData. - msg = self._msgobj('msg_43.txt') - sfp = StringIO() - Iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/report - text/plain - message/delivery-status - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/rfc822-headers -""") - - - -# Test the iterator/generators -class TestIterators(TestEmailBase): - def test_body_line_iterator(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - # First a simple non-multipart message - msg = self._msgobj('msg_01.txt') - it = Iterators.body_line_iterator(msg) - lines = list(it) - eq(len(lines), 6) - neq(EMPTYSTRING.join(lines), msg.get_payload()) - # Now a more complicated multipart - msg = self._msgobj('msg_02.txt') - it = Iterators.body_line_iterator(msg) - lines = list(it) - eq(len(lines), 43) - fp = openfile('msg_19.txt') - try: - neq(EMPTYSTRING.join(lines), fp.read()) - finally: - fp.close() - - def test_typed_subpart_iterator(self): - eq = self.assertEqual - msg = self._msgobj('msg_04.txt') - it = Iterators.typed_subpart_iterator(msg, 'text') - lines = [] - subparts = 0 - for subpart in it: - subparts += 1 - lines.append(subpart.get_payload()) - eq(subparts, 2) - eq(EMPTYSTRING.join(lines), """\ -a simple kind of mirror -to reflect upon our own -a simple kind of mirror -to reflect upon our own -""") - - def test_typed_subpart_iterator_default_type(self): - eq = self.assertEqual - msg = self._msgobj('msg_03.txt') - it = Iterators.typed_subpart_iterator(msg, 'text', 'plain') - lines = [] - subparts = 0 - for subpart in it: - subparts += 1 - lines.append(subpart.get_payload()) - eq(subparts, 1) - eq(EMPTYSTRING.join(lines), """\ - -Hi, - -Do you like this message? - --Me -""") - - - -class TestParsers(TestEmailBase): - def test_header_parser(self): - eq = self.assertEqual - # Parse only the headers of a complex multipart MIME document - fp = openfile('msg_02.txt') - try: - msg = HeaderParser().parse(fp) - finally: - fp.close() - eq(msg['from'], 'ppp-request@zzz.org') - eq(msg['to'], 'ppp@zzz.org') - eq(msg.get_content_type(), 'multipart/mixed') - self.failIf(msg.is_multipart()) - self.failUnless(isinstance(msg.get_payload(), str)) - - def test_whitespace_continuation(self): - eq = self.assertEqual - # This message contains a line after the Subject: header that has only - # whitespace, but it is not empty! - msg = email.message_from_string("""\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: the next line has a space on it -\x20 -Date: Mon, 8 Apr 2002 15:09:19 -0400 -Message-ID: spam - -Here's the message body -""") - eq(msg['subject'], 'the next line has a space on it\n ') - eq(msg['message-id'], 'spam') - eq(msg.get_payload(), "Here's the message body\n") - - def test_whitespace_continuation_last_header(self): - eq = self.assertEqual - # Like the previous test, but the subject line is the last - # header. - msg = email.message_from_string("""\ -From: aperson@dom.ain -To: bperson@dom.ain -Date: Mon, 8 Apr 2002 15:09:19 -0400 -Message-ID: spam -Subject: the next line has a space on it -\x20 - -Here's the message body -""") - eq(msg['subject'], 'the next line has a space on it\n ') - eq(msg['message-id'], 'spam') - eq(msg.get_payload(), "Here's the message body\n") - - def test_crlf_separation(self): - eq = self.assertEqual - fp = openfile('msg_26.txt', mode='rb') - try: - msg = Parser().parse(fp) - finally: - fp.close() - eq(len(msg.get_payload()), 2) - part1 = msg.get_payload(0) - eq(part1.get_content_type(), 'text/plain') - eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') - part2 = msg.get_payload(1) - eq(part2.get_content_type(), 'application/riscos') - - def test_multipart_digest_with_extra_mime_headers(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - fp = openfile('msg_28.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - # Structure is: - # multipart/digest - # message/rfc822 - # text/plain - # message/rfc822 - # text/plain - eq(msg.is_multipart(), 1) - eq(len(msg.get_payload()), 2) - part1 = msg.get_payload(0) - eq(part1.get_content_type(), 'message/rfc822') - eq(part1.is_multipart(), 1) - eq(len(part1.get_payload()), 1) - part1a = part1.get_payload(0) - eq(part1a.is_multipart(), 0) - eq(part1a.get_content_type(), 'text/plain') - neq(part1a.get_payload(), 'message 1\n') - # next message/rfc822 - part2 = msg.get_payload(1) - eq(part2.get_content_type(), 'message/rfc822') - eq(part2.is_multipart(), 1) - eq(len(part2.get_payload()), 1) - part2a = part2.get_payload(0) - eq(part2a.is_multipart(), 0) - eq(part2a.get_content_type(), 'text/plain') - neq(part2a.get_payload(), 'message 2\n') - - def test_three_lines(self): - # A bug report by Andrew McNamara - lines = ['From: Andrew Person <aperson@dom.ain', - 'Subject: Test', - 'Date: Tue, 20 Aug 2002 16:43:45 +1000'] - msg = email.message_from_string(NL.join(lines)) - self.assertEqual(msg['date'], 'Tue, 20 Aug 2002 16:43:45 +1000') - - def test_strip_line_feed_and_carriage_return_in_headers(self): - eq = self.assertEqual - # For [ 1002475 ] email message parser doesn't handle \r\n correctly - value1 = 'text' - value2 = 'more text' - m = 'Header: %s\r\nNext-Header: %s\r\n\r\nBody\r\n\r\n' % ( - value1, value2) - msg = email.message_from_string(m) - eq(msg.get('Header'), value1) - eq(msg.get('Next-Header'), value2) - - def test_rfc2822_header_syntax(self): - eq = self.assertEqual - m = '>From: foo\nFrom: bar\n!"#QUX;~: zoo\n\nbody' - msg = email.message_from_string(m) - eq(len(msg.keys()), 3) - keys = msg.keys() - keys.sort() - eq(keys, ['!"#QUX;~', '>From', 'From']) - eq(msg.get_payload(), 'body') - - def test_rfc2822_space_not_allowed_in_header(self): - eq = self.assertEqual - m = '>From foo@example.com 11:25:53\nFrom: bar\n!"#QUX;~: zoo\n\nbody' - msg = email.message_from_string(m) - eq(len(msg.keys()), 0) - - def test_rfc2822_one_character_header(self): - eq = self.assertEqual - m = 'A: first header\nB: second header\nCC: third header\n\nbody' - msg = email.message_from_string(m) - headers = msg.keys() - headers.sort() - eq(headers, ['A', 'B', 'CC']) - eq(msg.get_payload(), 'body') - - - -class TestBase64(unittest.TestCase): - def test_len(self): - eq = self.assertEqual - eq(base64MIME.base64_len('hello'), - len(base64MIME.encode('hello', eol=''))) - for size in range(15): - if size == 0 : bsize = 0 - elif size <= 3 : bsize = 4 - elif size <= 6 : bsize = 8 - elif size <= 9 : bsize = 12 - elif size <= 12: bsize = 16 - else : bsize = 20 - eq(base64MIME.base64_len('x'*size), bsize) - - def test_decode(self): - eq = self.assertEqual - eq(base64MIME.decode(''), '') - eq(base64MIME.decode('aGVsbG8='), 'hello') - eq(base64MIME.decode('aGVsbG8=', 'X'), 'hello') - eq(base64MIME.decode('aGVsbG8NCndvcmxk\n', 'X'), 'helloXworld') - - def test_encode(self): - eq = self.assertEqual - eq(base64MIME.encode(''), '') - eq(base64MIME.encode('hello'), 'aGVsbG8=\n') - # Test the binary flag - eq(base64MIME.encode('hello\n'), 'aGVsbG8K\n') - eq(base64MIME.encode('hello\n', 0), 'aGVsbG8NCg==\n') - # Test the maxlinelen arg - eq(base64MIME.encode('xxxx ' * 20, maxlinelen=40), """\ -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IA== -""") - # Test the eol argument - eq(base64MIME.encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IA==\r -""") - - def test_header_encode(self): - eq = self.assertEqual - he = base64MIME.header_encode - eq(he('hello'), '=?iso-8859-1?b?aGVsbG8=?=') - eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8NCndvcmxk?=') - # Test the charset option - eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=') - # Test the keep_eols flag - eq(he('hello\nworld', keep_eols=True), - '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=') - # Test the maxlinelen argument - eq(he('xxxx ' * 20, maxlinelen=40), """\ -=?iso-8859-1?b?eHh4eCB4eHh4IHh4eHggeHg=?= - =?iso-8859-1?b?eHggeHh4eCB4eHh4IHh4eHg=?= - =?iso-8859-1?b?IHh4eHggeHh4eCB4eHh4IHg=?= - =?iso-8859-1?b?eHh4IHh4eHggeHh4eCB4eHg=?= - =?iso-8859-1?b?eCB4eHh4IHh4eHggeHh4eCA=?= - =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - # Test the eol argument - eq(he('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -=?iso-8859-1?b?eHh4eCB4eHh4IHh4eHggeHg=?=\r - =?iso-8859-1?b?eHggeHh4eCB4eHh4IHh4eHg=?=\r - =?iso-8859-1?b?IHh4eHggeHh4eCB4eHh4IHg=?=\r - =?iso-8859-1?b?eHh4IHh4eHggeHh4eCB4eHg=?=\r - =?iso-8859-1?b?eCB4eHh4IHh4eHggeHh4eCA=?=\r - =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - - - -class TestQuopri(unittest.TestCase): - def setUp(self): - self.hlit = [chr(x) for x in range(ord('a'), ord('z')+1)] + \ - [chr(x) for x in range(ord('A'), ord('Z')+1)] + \ - [chr(x) for x in range(ord('0'), ord('9')+1)] + \ - ['!', '*', '+', '-', '/', ' '] - self.hnon = [chr(x) for x in range(256) if chr(x) not in self.hlit] - assert len(self.hlit) + len(self.hnon) == 256 - self.blit = [chr(x) for x in range(ord(' '), ord('~')+1)] + ['\t'] - self.blit.remove('=') - self.bnon = [chr(x) for x in range(256) if chr(x) not in self.blit] - assert len(self.blit) + len(self.bnon) == 256 - - def test_header_quopri_check(self): - for c in self.hlit: - self.failIf(quopriMIME.header_quopri_check(c)) - for c in self.hnon: - self.failUnless(quopriMIME.header_quopri_check(c)) - - def test_body_quopri_check(self): - for c in self.blit: - self.failIf(quopriMIME.body_quopri_check(c)) - for c in self.bnon: - self.failUnless(quopriMIME.body_quopri_check(c)) - - def test_header_quopri_len(self): - eq = self.assertEqual - hql = quopriMIME.header_quopri_len - enc = quopriMIME.header_encode - for s in ('hello', 'h@e@l@l@o@'): - # Empty charset and no line-endings. 7 == RFC chrome - eq(hql(s), len(enc(s, charset='', eol=''))-7) - for c in self.hlit: - eq(hql(c), 1) - for c in self.hnon: - eq(hql(c), 3) - - def test_body_quopri_len(self): - eq = self.assertEqual - bql = quopriMIME.body_quopri_len - for c in self.blit: - eq(bql(c), 1) - for c in self.bnon: - eq(bql(c), 3) - - def test_quote_unquote_idempotent(self): - for x in range(256): - c = chr(x) - self.assertEqual(quopriMIME.unquote(quopriMIME.quote(c)), c) - - def test_header_encode(self): - eq = self.assertEqual - he = quopriMIME.header_encode - eq(he('hello'), '=?iso-8859-1?q?hello?=') - eq(he('hello\nworld'), '=?iso-8859-1?q?hello=0D=0Aworld?=') - # Test the charset option - eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?q?hello?=') - # Test the keep_eols flag - eq(he('hello\nworld', keep_eols=True), '=?iso-8859-1?q?hello=0Aworld?=') - # Test a non-ASCII character - eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') - # Test the maxlinelen argument - eq(he('xxxx ' * 20, maxlinelen=40), """\ -=?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xx?= - =?iso-8859-1?q?xx_xxxx_xxxx_xxxx_xxxx?= - =?iso-8859-1?q?_xxxx_xxxx_xxxx_xxxx_x?= - =?iso-8859-1?q?xxx_xxxx_xxxx_xxxx_xxx?= - =?iso-8859-1?q?x_xxxx_xxxx_?=""") - # Test the eol argument - eq(he('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -=?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xx?=\r - =?iso-8859-1?q?xx_xxxx_xxxx_xxxx_xxxx?=\r - =?iso-8859-1?q?_xxxx_xxxx_xxxx_xxxx_x?=\r - =?iso-8859-1?q?xxx_xxxx_xxxx_xxxx_xxx?=\r - =?iso-8859-1?q?x_xxxx_xxxx_?=""") - - def test_decode(self): - eq = self.assertEqual - eq(quopriMIME.decode(''), '') - eq(quopriMIME.decode('hello'), 'hello') - eq(quopriMIME.decode('hello', 'X'), 'hello') - eq(quopriMIME.decode('hello\nworld', 'X'), 'helloXworld') - - def test_encode(self): - eq = self.assertEqual - eq(quopriMIME.encode(''), '') - eq(quopriMIME.encode('hello'), 'hello') - # Test the binary flag - eq(quopriMIME.encode('hello\r\nworld'), 'hello\nworld') - eq(quopriMIME.encode('hello\r\nworld', 0), 'hello\nworld') - # Test the maxlinelen arg - eq(quopriMIME.encode('xxxx ' * 20, maxlinelen=40), """\ -xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx= - xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx= -x xxxx xxxx xxxx xxxx=20""") - # Test the eol argument - eq(quopriMIME.encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=\r - xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=\r -x xxxx xxxx xxxx xxxx=20""") - eq(quopriMIME.encode("""\ -one line - -two line"""), """\ -one line - -two line""") - - - -# Test the Charset class -class TestCharset(unittest.TestCase): - def tearDown(self): - from email import Charset as CharsetModule - try: - del CharsetModule.CHARSETS['fake'] - except KeyError: - pass - - def test_idempotent(self): - eq = self.assertEqual - # Make sure us-ascii = no Unicode conversion - c = Charset('us-ascii') - s = 'Hello World!' - sp = c.to_splittable(s) - eq(s, c.from_splittable(sp)) - # test 8-bit idempotency with us-ascii - s = '\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa' - sp = c.to_splittable(s) - eq(s, c.from_splittable(sp)) - - def test_body_encode(self): - eq = self.assertEqual - # Try a charset with QP body encoding - c = Charset('iso-8859-1') - eq('hello w=F6rld', c.body_encode('hello w\xf6rld')) - # Try a charset with Base64 body encoding - c = Charset('utf-8') - eq('aGVsbG8gd29ybGQ=\n', c.body_encode('hello world')) - # Try a charset with None body encoding - c = Charset('us-ascii') - eq('hello world', c.body_encode('hello world')) - # Try the convert argument, where input codec <> output codec - c = Charset('euc-jp') - # With apologies to Tokio Kikuchi ;) - try: - eq('\x1b$B5FCO;~IW\x1b(B', - c.body_encode('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7')) - eq('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7', - c.body_encode('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7', False)) - except LookupError: - # We probably don't have the Japanese codecs installed - pass - # Testing SF bug #625509, which we have to fake, since there are no - # built-in encodings where the header encoding is QP but the body - # encoding is not. - from email import Charset as CharsetModule - CharsetModule.add_charset('fake', CharsetModule.QP, None) - c = Charset('fake') - eq('hello w\xf6rld', c.body_encode('hello w\xf6rld')) - - def test_unicode_charset_name(self): - charset = Charset(u'us-ascii') - self.assertEqual(str(charset), 'us-ascii') - self.assertRaises(Errors.CharsetError, Charset, 'asc\xffii') - - - -# Test multilingual MIME headers. -class TestHeader(TestEmailBase): - def test_simple(self): - eq = self.ndiffAssertEqual - h = Header('Hello World!') - eq(h.encode(), 'Hello World!') - h.append(' Goodbye World!') - eq(h.encode(), 'Hello World! Goodbye World!') - - def test_simple_surprise(self): - eq = self.ndiffAssertEqual - h = Header('Hello World!') - eq(h.encode(), 'Hello World!') - h.append('Goodbye World!') - eq(h.encode(), 'Hello World! Goodbye World!') - - def test_header_needs_no_decoding(self): - h = 'no decoding needed' - self.assertEqual(decode_header(h), [(h, None)]) - - def test_long(self): - h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", - maxlinelen=76) - for l in h.encode(splitchars=' ').split('\n '): - self.failUnless(len(l) <= 76) - - def test_multilingual(self): - eq = self.ndiffAssertEqual - g = Charset("iso-8859-1") - cz = Charset("iso-8859-2") - utf8 = Charset("utf-8") - g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") - h = Header(g_head, g) - h.append(cz_head, cz) - h.append(utf8_head, utf8) - enc = h.encode() - eq(enc, """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= - =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wan?= - =?iso-8859-1?q?dgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef=F6?= - =?iso-8859-1?q?rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutily?= - =?iso-8859-2?q?_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?= - =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC?= - =?utf-8?b?5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn?= - =?utf-8?b?44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFz?= - =?utf-8?q?_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_die_Fl?= - =?utf-8?b?aXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBo+OBpuOBhOOBvuOBmQ==?= - =?utf-8?b?44CC?=""") - eq(decode_header(enc), - [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), - (utf8_head, "utf-8")]) - ustr = unicode(h) - eq(ustr.encode('utf-8'), - 'Die Mieter treten hier ein werden mit einem Foerderband ' - 'komfortabel den Korridor entlang, an s\xc3\xbcdl\xc3\xbcndischen ' - 'Wandgem\xc3\xa4lden vorbei, gegen die rotierenden Klingen ' - 'bef\xc3\xb6rdert. Finan\xc4\x8dni metropole se hroutily pod ' - 'tlakem jejich d\xc5\xafvtipu.. \xe6\xad\xa3\xe7\xa2\xba\xe3\x81' - '\xab\xe8\xa8\x80\xe3\x81\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3' - '\xe3\x81\xaf\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3' - '\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' - '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8\xaa\x9e' - '\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81\xe3\x81\x82\xe3' - '\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81\x9f\xe3\x82\x89\xe3\x82' - '\x81\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\xe5\xae\x9f\xe9\x9a\x9b' - '\xe3\x81\xab\xe3\x81\xaf\xe3\x80\x8cWenn ist das Nunstuck git ' - 'und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt ' - 'gersput.\xe3\x80\x8d\xe3\x81\xa8\xe8\xa8\x80\xe3\x81\xa3\xe3\x81' - '\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82') - # Test make_header() - newh = make_header(decode_header(enc)) - eq(newh, enc) - - def test_header_ctor_default_args(self): - eq = self.ndiffAssertEqual - h = Header() - eq(h, '') - h.append('foo', Charset('iso-8859-1')) - eq(h, '=?iso-8859-1?q?foo?=') - - def test_explicit_maxlinelen(self): - eq = self.ndiffAssertEqual - hstr = 'A very long line that must get split to something other than at the 76th character boundary to test the non-default behavior' - h = Header(hstr) - eq(h.encode(), '''\ -A very long line that must get split to something other than at the 76th - character boundary to test the non-default behavior''') - h = Header(hstr, header_name='Subject') - eq(h.encode(), '''\ -A very long line that must get split to something other than at the - 76th character boundary to test the non-default behavior''') - h = Header(hstr, maxlinelen=1024, header_name='Subject') - eq(h.encode(), hstr) - - def test_us_ascii_header(self): - eq = self.assertEqual - s = 'hello' - x = decode_header(s) - eq(x, [('hello', None)]) - h = make_header(x) - eq(s, h.encode()) - - def test_string_charset(self): - eq = self.assertEqual - h = Header() - h.append('hello', 'iso-8859-1') - eq(h, '=?iso-8859-1?q?hello?=') - -## def test_unicode_error(self): -## raises = self.assertRaises -## raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii') -## h = Header() -## raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1') - - def test_utf8_shortest(self): - eq = self.assertEqual - h = Header(u'p\xf6stal', 'utf-8') - eq(h.encode(), '=?utf-8?q?p=C3=B6stal?=') - h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8') - eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=') - - def test_bad_8bit_header(self): - raises = self.assertRaises - eq = self.assertEqual - x = 'Ynwp4dUEbay Auction Semiar- No Charge \x96 Earn Big' - raises(UnicodeError, Header, x) - h = Header() - raises(UnicodeError, h.append, x) - eq(str(Header(x, errors='replace')), x) - h.append(x, errors='replace') - eq(str(h), x) - - def test_encoded_adjacent_nonencoded(self): - eq = self.assertEqual - h = Header() - h.append('hello', 'iso-8859-1') - h.append('world') - s = h.encode() - eq(s, '=?iso-8859-1?q?hello?= world') - h = make_header(decode_header(s)) - eq(h.encode(), s) - - def test_whitespace_eater(self): - eq = self.assertEqual - s = 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.' - parts = decode_header(s) - eq(parts, [('Subject:', None), ('\xf0\xd2\xcf\xd7\xc5\xd2\xcb\xc1 \xce\xc1 \xc6\xc9\xce\xc1\xcc\xd8\xce\xd9\xca', 'koi8-r'), ('zz.', None)]) - hdr = make_header(parts) - eq(hdr.encode(), - 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.') - - def test_broken_base64_header(self): - raises = self.assertRaises - s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?=' - raises(Errors.HeaderParseError, decode_header, s) - - - -# Test RFC 2231 header parameters (en/de)coding -class TestRFC2231(TestEmailBase): - def test_get_param(self): - eq = self.assertEqual - msg = self._msgobj('msg_29.txt') - eq(msg.get_param('title'), - ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) - eq(msg.get_param('title', unquote=False), - ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) - - def test_set_param(self): - eq = self.assertEqual - msg = Message() - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii') - eq(msg.get_param('title'), - ('us-ascii', '', 'This is even more ***fun*** isn\'t it!')) - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - eq(msg.get_param('title'), - ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) - msg = self._msgobj('msg_01.txt') - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - eq(msg.as_string(), """\ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) -\tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 -Content-Type: text/plain; charset=us-ascii; -\ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" - - -Hi, - -Do you like this message? - --Me -""") - - def test_del_param(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_01.txt') - msg.set_param('foo', 'bar', charset='us-ascii', language='en') - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - msg.del_param('foo', header='Content-Type') - eq(msg.as_string(), """\ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) -\tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 -Content-Type: text/plain; charset="us-ascii"; -\ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" - - -Hi, - -Do you like this message? - --Me -""") - - def test_rfc2231_get_content_charset(self): - eq = self.assertEqual - msg = self._msgobj('msg_32.txt') - eq(msg.get_content_charset(), 'us-ascii') - - def test_rfc2231_no_language_or_charset(self): - m = '''\ -Content-Transfer-Encoding: 8bit -Content-Disposition: inline; filename="file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm" -Content-Type: text/html; NAME*0=file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEM; NAME*1=P_nsmail.htm - -''' - msg = email.message_from_string(m) - param = msg.get_param('NAME') - self.failIf(isinstance(param, tuple)) - self.assertEqual( - param, - 'file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm') - - def test_rfc2231_no_language_or_charset_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_filename_encoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_partly_encoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual( - msg.get_filename(), - 'This%20is%20even%20more%20***fun*** is it not.pdf') - - def test_rfc2231_partly_nonencoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0="This%20is%20even%20more%20"; -\tfilename*1="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual( - msg.get_filename(), - 'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_boundary(self): - m = '''\ -Content-Type: multipart/alternative; -\tboundary*0*="''This%20is%20even%20more%20"; -\tboundary*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tboundary*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_boundary(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_charset(self): - # This is a nonsensical charset value, but tests the code anyway - m = '''\ -Content-Type: text/plain; -\tcharset*0*="This%20is%20even%20more%20"; -\tcharset*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tcharset*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_content_charset(), - 'this is even more ***fun*** is it not.pdf') - - def test_rfc2231_bad_encoding_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="bogus'xx'This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_bad_encoding_in_charset(self): - m = """\ -Content-Type: text/plain; charset*=bogus''utf-8%E2%80%9D - -""" - msg = email.message_from_string(m) - # This should return None because non-ascii characters in the charset - # are not allowed. - self.assertEqual(msg.get_content_charset(), None) - - def test_rfc2231_bad_character_in_charset(self): - m = """\ -Content-Type: text/plain; charset*=ascii''utf-8%E2%80%9D - -""" - msg = email.message_from_string(m) - # This should return None because non-ascii characters in the charset - # are not allowed. - self.assertEqual(msg.get_content_charset(), None) - - def test_rfc2231_bad_character_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="ascii'xx'This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2*="is it not.pdf%E2" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - u'This is even more ***fun*** is it not.pdf\ufffd') - - def test_rfc2231_unknown_encoding(self): - m = """\ -Content-Transfer-Encoding: 8bit -Content-Disposition: inline; filename*=X-UNKNOWN''myfile.txt - -""" - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), 'myfile.txt') - - def test_rfc2231_single_tick_in_filename_extended(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"Frank's\"; name*1*=\" Document\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, None) - eq(language, None) - eq(s, "Frank's Document") - - def test_rfc2231_single_tick_in_filename(self): - m = """\ -Content-Type: application/x-foo; name*0=\"Frank's\"; name*1=\" Document\" - -""" - msg = email.message_from_string(m) - param = msg.get_param('name') - self.failIf(isinstance(param, tuple)) - self.assertEqual(param, "Frank's Document") - - def test_rfc2231_tick_attack_extended(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"us-ascii'en-us'Frank's\"; name*1*=\" Document\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, "Frank's Document") - - def test_rfc2231_tick_attack(self): - m = """\ -Content-Type: application/x-foo; -\tname*0=\"us-ascii'en-us'Frank's\"; name*1=\" Document\" - -""" - msg = email.message_from_string(m) - param = msg.get_param('name') - self.failIf(isinstance(param, tuple)) - self.assertEqual(param, "us-ascii'en-us'Frank's Document") - - def test_rfc2231_no_extended_values(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; name=\"Frank's Document\" - -""" - msg = email.message_from_string(m) - eq(msg.get_param('name'), "Frank's Document") - - def test_rfc2231_encoded_then_unencoded_segments(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"us-ascii'en-us'My\"; -\tname*1=\" Document\"; -\tname*2*=\" For You\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, 'My Document For You') - - def test_rfc2231_unencoded_then_encoded_segments(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0=\"us-ascii'en-us'My\"; -\tname*1*=\" Document\"; -\tname*2*=\" For You\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, 'My Document For You') - - - -def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - - -def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - - -def test_main(): - for testclass in _testclasses(): - run_unittest(testclass) - - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/email/test/test_email_codecs.py b/sys/lib/python/email/test/test_email_codecs.py deleted file mode 100644 index 38b7d9539..000000000 --- a/sys/lib/python/email/test/test_email_codecs.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2002-2006 Python Software Foundation -# Contact: email-sig@python.org -# email package unit tests for (optional) Asian codecs - -import unittest -from test.test_support import TestSkipped, run_unittest - -from email.test.test_email import TestEmailBase -from email.Charset import Charset -from email.Header import Header, decode_header -from email.Message import Message - -# We're compatible with Python 2.3, but it doesn't have the built-in Asian -# codecs, so we have to skip all these tests. -try: - unicode('foo', 'euc-jp') -except LookupError: - raise TestSkipped - - - -class TestEmailAsianCodecs(TestEmailBase): - def test_japanese_codecs(self): - eq = self.ndiffAssertEqual - j = Charset("euc-jp") - g = Charset("iso-8859-1") - h = Header("Hello World!") - jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' - ghello = 'Gr\xfc\xdf Gott!' - h.append(jhello, j) - h.append(ghello, g) - # BAW: This used to -- and maybe should -- fold the two iso-8859-1 - # chunks into a single encoded word. However it doesn't violate the - # standard to have them as two encoded chunks and maybe it's - # reasonable <wink> for each .append() call to result in a separate - # encoded word. - eq(h.encode(), """\ -Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?= - =?iso-8859-1?q?Gr=FC=DF?= =?iso-8859-1?q?_Gott!?=""") - eq(decode_header(h.encode()), - [('Hello World!', None), - ('\x1b$B%O%m!<%o!<%k%I!*\x1b(B', 'iso-2022-jp'), - ('Gr\xfc\xdf Gott!', 'iso-8859-1')]) - long = 'test-ja \xa4\xd8\xc5\xea\xb9\xc6\xa4\xb5\xa4\xec\xa4\xbf\xa5\xe1\xa1\xbc\xa5\xeb\xa4\xcf\xbb\xca\xb2\xf1\xbc\xd4\xa4\xce\xbe\xb5\xc7\xa7\xa4\xf2\xc2\xd4\xa4\xc3\xa4\xc6\xa4\xa4\xa4\xde\xa4\xb9' - h = Header(long, j, header_name="Subject") - # test a very long header - enc = h.encode() - # TK: splitting point may differ by codec design and/or Header encoding - eq(enc , """\ -=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKGyhC?= - =?iso-2022-jp?b?GyRCMnE8VCROPjVHJyRyQlQkQyRGJCQkXiQ5GyhC?=""") - # TK: full decode comparison - eq(h.__unicode__().encode('euc-jp'), long) - - def test_payload_encoding(self): - jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' - jcode = 'euc-jp' - msg = Message() - msg.set_payload(jhello, jcode) - ustr = unicode(msg.get_payload(), msg.get_content_charset()) - self.assertEqual(jhello, ustr.encode(jcode)) - - - -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestEmailAsianCodecs)) - return suite - - -def test_main(): - run_unittest(TestEmailAsianCodecs) - - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/email/test/test_email_codecs_renamed.py b/sys/lib/python/email/test/test_email_codecs_renamed.py deleted file mode 100644 index 56baccdca..000000000 --- a/sys/lib/python/email/test/test_email_codecs_renamed.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2002-2006 Python Software Foundation -# Contact: email-sig@python.org -# email package unit tests for (optional) Asian codecs - -import unittest -from test.test_support import TestSkipped, run_unittest - -from email.test.test_email import TestEmailBase -from email.charset import Charset -from email.header import Header, decode_header -from email.message import Message - -# We're compatible with Python 2.3, but it doesn't have the built-in Asian -# codecs, so we have to skip all these tests. -try: - unicode('foo', 'euc-jp') -except LookupError: - raise TestSkipped - - - -class TestEmailAsianCodecs(TestEmailBase): - def test_japanese_codecs(self): - eq = self.ndiffAssertEqual - j = Charset("euc-jp") - g = Charset("iso-8859-1") - h = Header("Hello World!") - jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' - ghello = 'Gr\xfc\xdf Gott!' - h.append(jhello, j) - h.append(ghello, g) - # BAW: This used to -- and maybe should -- fold the two iso-8859-1 - # chunks into a single encoded word. However it doesn't violate the - # standard to have them as two encoded chunks and maybe it's - # reasonable <wink> for each .append() call to result in a separate - # encoded word. - eq(h.encode(), """\ -Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?= - =?iso-8859-1?q?Gr=FC=DF?= =?iso-8859-1?q?_Gott!?=""") - eq(decode_header(h.encode()), - [('Hello World!', None), - ('\x1b$B%O%m!<%o!<%k%I!*\x1b(B', 'iso-2022-jp'), - ('Gr\xfc\xdf Gott!', 'iso-8859-1')]) - long = 'test-ja \xa4\xd8\xc5\xea\xb9\xc6\xa4\xb5\xa4\xec\xa4\xbf\xa5\xe1\xa1\xbc\xa5\xeb\xa4\xcf\xbb\xca\xb2\xf1\xbc\xd4\xa4\xce\xbe\xb5\xc7\xa7\xa4\xf2\xc2\xd4\xa4\xc3\xa4\xc6\xa4\xa4\xa4\xde\xa4\xb9' - h = Header(long, j, header_name="Subject") - # test a very long header - enc = h.encode() - # TK: splitting point may differ by codec design and/or Header encoding - eq(enc , """\ -=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKGyhC?= - =?iso-2022-jp?b?GyRCMnE8VCROPjVHJyRyQlQkQyRGJCQkXiQ5GyhC?=""") - # TK: full decode comparison - eq(h.__unicode__().encode('euc-jp'), long) - - def test_payload_encoding(self): - jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' - jcode = 'euc-jp' - msg = Message() - msg.set_payload(jhello, jcode) - ustr = unicode(msg.get_payload(), msg.get_content_charset()) - self.assertEqual(jhello, ustr.encode(jcode)) - - - -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestEmailAsianCodecs)) - return suite - - -def test_main(): - run_unittest(TestEmailAsianCodecs) - - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/email/test/test_email_renamed.py b/sys/lib/python/email/test/test_email_renamed.py deleted file mode 100644 index 44238c78f..000000000 --- a/sys/lib/python/email/test/test_email_renamed.py +++ /dev/null @@ -1,3273 +0,0 @@ -# Copyright (C) 2001-2007 Python Software Foundation -# Contact: email-sig@python.org -# email package unit tests - -import os -import sys -import time -import base64 -import difflib -import unittest -import warnings -from cStringIO import StringIO - -import email - -from email.charset import Charset -from email.header import Header, decode_header, make_header -from email.parser import Parser, HeaderParser -from email.generator import Generator, DecodedGenerator -from email.message import Message -from email.mime.application import MIMEApplication -from email.mime.audio import MIMEAudio -from email.mime.text import MIMEText -from email.mime.image import MIMEImage -from email.mime.base import MIMEBase -from email.mime.message import MIMEMessage -from email.mime.multipart import MIMEMultipart -from email import utils -from email import errors -from email import encoders -from email import iterators -from email import base64mime -from email import quoprimime - -from test.test_support import findfile, run_unittest -from email.test import __file__ as landmark - - -NL = '\n' -EMPTYSTRING = '' -SPACE = ' ' - - - -def openfile(filename, mode='r'): - path = os.path.join(os.path.dirname(landmark), 'data', filename) - return open(path, mode) - - - -# Base test class -class TestEmailBase(unittest.TestCase): - def ndiffAssertEqual(self, first, second): - """Like failUnlessEqual except use ndiff for readable output.""" - if first <> second: - sfirst = str(first) - ssecond = str(second) - diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines()) - fp = StringIO() - print >> fp, NL, NL.join(diff) - raise self.failureException, fp.getvalue() - - def _msgobj(self, filename): - fp = openfile(findfile(filename)) - try: - msg = email.message_from_file(fp) - finally: - fp.close() - return msg - - - -# Test various aspects of the Message class's API -class TestMessageAPI(TestEmailBase): - def test_get_all(self): - eq = self.assertEqual - msg = self._msgobj('msg_20.txt') - eq(msg.get_all('cc'), ['ccc@zzz.org', 'ddd@zzz.org', 'eee@zzz.org']) - eq(msg.get_all('xx', 'n/a'), 'n/a') - - def test_getset_charset(self): - eq = self.assertEqual - msg = Message() - eq(msg.get_charset(), None) - charset = Charset('iso-8859-1') - msg.set_charset(charset) - eq(msg['mime-version'], '1.0') - eq(msg.get_content_type(), 'text/plain') - eq(msg['content-type'], 'text/plain; charset="iso-8859-1"') - eq(msg.get_param('charset'), 'iso-8859-1') - eq(msg['content-transfer-encoding'], 'quoted-printable') - eq(msg.get_charset().input_charset, 'iso-8859-1') - # Remove the charset - msg.set_charset(None) - eq(msg.get_charset(), None) - eq(msg['content-type'], 'text/plain') - # Try adding a charset when there's already MIME headers present - msg = Message() - msg['MIME-Version'] = '2.0' - msg['Content-Type'] = 'text/x-weird' - msg['Content-Transfer-Encoding'] = 'quinted-puntable' - msg.set_charset(charset) - eq(msg['mime-version'], '2.0') - eq(msg['content-type'], 'text/x-weird; charset="iso-8859-1"') - eq(msg['content-transfer-encoding'], 'quinted-puntable') - - def test_set_charset_from_string(self): - eq = self.assertEqual - msg = Message() - msg.set_charset('us-ascii') - eq(msg.get_charset().input_charset, 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - - def test_set_payload_with_charset(self): - msg = Message() - charset = Charset('iso-8859-1') - msg.set_payload('This is a string payload', charset) - self.assertEqual(msg.get_charset().input_charset, 'iso-8859-1') - - def test_get_charsets(self): - eq = self.assertEqual - - msg = self._msgobj('msg_08.txt') - charsets = msg.get_charsets() - eq(charsets, [None, 'us-ascii', 'iso-8859-1', 'iso-8859-2', 'koi8-r']) - - msg = self._msgobj('msg_09.txt') - charsets = msg.get_charsets('dingbat') - eq(charsets, ['dingbat', 'us-ascii', 'iso-8859-1', 'dingbat', - 'koi8-r']) - - msg = self._msgobj('msg_12.txt') - charsets = msg.get_charsets() - eq(charsets, [None, 'us-ascii', 'iso-8859-1', None, 'iso-8859-2', - 'iso-8859-3', 'us-ascii', 'koi8-r']) - - def test_get_filename(self): - eq = self.assertEqual - - msg = self._msgobj('msg_04.txt') - filenames = [p.get_filename() for p in msg.get_payload()] - eq(filenames, ['msg.txt', 'msg.txt']) - - msg = self._msgobj('msg_07.txt') - subpart = msg.get_payload(1) - eq(subpart.get_filename(), 'dingusfish.gif') - - def test_get_filename_with_name_parameter(self): - eq = self.assertEqual - - msg = self._msgobj('msg_44.txt') - filenames = [p.get_filename() for p in msg.get_payload()] - eq(filenames, ['msg.txt', 'msg.txt']) - - def test_get_boundary(self): - eq = self.assertEqual - msg = self._msgobj('msg_07.txt') - # No quotes! - eq(msg.get_boundary(), 'BOUNDARY') - - def test_set_boundary(self): - eq = self.assertEqual - # This one has no existing boundary parameter, but the Content-Type: - # header appears fifth. - msg = self._msgobj('msg_01.txt') - msg.set_boundary('BOUNDARY') - header, value = msg.items()[4] - eq(header.lower(), 'content-type') - eq(value, 'text/plain; charset="us-ascii"; boundary="BOUNDARY"') - # This one has a Content-Type: header, with a boundary, stuck in the - # middle of its headers. Make sure the order is preserved; it should - # be fifth. - msg = self._msgobj('msg_04.txt') - msg.set_boundary('BOUNDARY') - header, value = msg.items()[4] - eq(header.lower(), 'content-type') - eq(value, 'multipart/mixed; boundary="BOUNDARY"') - # And this one has no Content-Type: header at all. - msg = self._msgobj('msg_03.txt') - self.assertRaises(errors.HeaderParseError, - msg.set_boundary, 'BOUNDARY') - - def test_get_decoded_payload(self): - eq = self.assertEqual - msg = self._msgobj('msg_10.txt') - # The outer message is a multipart - eq(msg.get_payload(decode=True), None) - # Subpart 1 is 7bit encoded - eq(msg.get_payload(0).get_payload(decode=True), - 'This is a 7bit encoded message.\n') - # Subpart 2 is quopri - eq(msg.get_payload(1).get_payload(decode=True), - '\xa1This is a Quoted Printable encoded message!\n') - # Subpart 3 is base64 - eq(msg.get_payload(2).get_payload(decode=True), - 'This is a Base64 encoded message.') - # Subpart 4 has no Content-Transfer-Encoding: header. - eq(msg.get_payload(3).get_payload(decode=True), - 'This has no Content-Transfer-Encoding: header.\n') - - def test_get_decoded_uu_payload(self): - eq = self.assertEqual - msg = Message() - msg.set_payload('begin 666 -\n+:&5L;&\\@=V]R;&0 \n \nend\n') - for cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): - msg['content-transfer-encoding'] = cte - eq(msg.get_payload(decode=True), 'hello world') - # Now try some bogus data - msg.set_payload('foo') - eq(msg.get_payload(decode=True), 'foo') - - def test_decoded_generator(self): - eq = self.assertEqual - msg = self._msgobj('msg_07.txt') - fp = openfile('msg_17.txt') - try: - text = fp.read() - finally: - fp.close() - s = StringIO() - g = DecodedGenerator(s) - g.flatten(msg) - eq(s.getvalue(), text) - - def test__contains__(self): - msg = Message() - msg['From'] = 'Me' - msg['to'] = 'You' - # Check for case insensitivity - self.failUnless('from' in msg) - self.failUnless('From' in msg) - self.failUnless('FROM' in msg) - self.failUnless('to' in msg) - self.failUnless('To' in msg) - self.failUnless('TO' in msg) - - def test_as_string(self): - eq = self.assertEqual - msg = self._msgobj('msg_01.txt') - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - eq(text, msg.as_string()) - fullrepr = str(msg) - lines = fullrepr.split('\n') - self.failUnless(lines[0].startswith('From ')) - eq(text, NL.join(lines[1:])) - - def test_bad_param(self): - msg = email.message_from_string("Content-Type: blarg; baz; boo\n") - self.assertEqual(msg.get_param('baz'), '') - - def test_missing_filename(self): - msg = email.message_from_string("From: foo\n") - self.assertEqual(msg.get_filename(), None) - - def test_bogus_filename(self): - msg = email.message_from_string( - "Content-Disposition: blarg; filename\n") - self.assertEqual(msg.get_filename(), '') - - def test_missing_boundary(self): - msg = email.message_from_string("From: foo\n") - self.assertEqual(msg.get_boundary(), None) - - def test_get_params(self): - eq = self.assertEqual - msg = email.message_from_string( - 'X-Header: foo=one; bar=two; baz=three\n') - eq(msg.get_params(header='x-header'), - [('foo', 'one'), ('bar', 'two'), ('baz', 'three')]) - msg = email.message_from_string( - 'X-Header: foo; bar=one; baz=two\n') - eq(msg.get_params(header='x-header'), - [('foo', ''), ('bar', 'one'), ('baz', 'two')]) - eq(msg.get_params(), None) - msg = email.message_from_string( - 'X-Header: foo; bar="one"; baz=two\n') - eq(msg.get_params(header='x-header'), - [('foo', ''), ('bar', 'one'), ('baz', 'two')]) - - def test_get_param_liberal(self): - msg = Message() - msg['Content-Type'] = 'Content-Type: Multipart/mixed; boundary = "CPIMSSMTPC06p5f3tG"' - self.assertEqual(msg.get_param('boundary'), 'CPIMSSMTPC06p5f3tG') - - def test_get_param(self): - eq = self.assertEqual - msg = email.message_from_string( - "X-Header: foo=one; bar=two; baz=three\n") - eq(msg.get_param('bar', header='x-header'), 'two') - eq(msg.get_param('quuz', header='x-header'), None) - eq(msg.get_param('quuz'), None) - msg = email.message_from_string( - 'X-Header: foo; bar="one"; baz=two\n') - eq(msg.get_param('foo', header='x-header'), '') - eq(msg.get_param('bar', header='x-header'), 'one') - eq(msg.get_param('baz', header='x-header'), 'two') - # XXX: We are not RFC-2045 compliant! We cannot parse: - # msg["Content-Type"] = 'text/plain; weird="hey; dolly? [you] @ <\\"home\\">?"' - # msg.get_param("weird") - # yet. - - def test_get_param_funky_continuation_lines(self): - msg = self._msgobj('msg_22.txt') - self.assertEqual(msg.get_payload(1).get_param('name'), 'wibble.JPG') - - def test_get_param_with_semis_in_quotes(self): - msg = email.message_from_string( - 'Content-Type: image/pjpeg; name="Jim&&Jill"\n') - self.assertEqual(msg.get_param('name'), 'Jim&&Jill') - self.assertEqual(msg.get_param('name', unquote=False), - '"Jim&&Jill"') - - def test_has_key(self): - msg = email.message_from_string('Header: exists') - self.failUnless(msg.has_key('header')) - self.failUnless(msg.has_key('Header')) - self.failUnless(msg.has_key('HEADER')) - self.failIf(msg.has_key('headeri')) - - def test_set_param(self): - eq = self.assertEqual - msg = Message() - msg.set_param('charset', 'iso-2022-jp') - eq(msg.get_param('charset'), 'iso-2022-jp') - msg.set_param('importance', 'high value') - eq(msg.get_param('importance'), 'high value') - eq(msg.get_param('importance', unquote=False), '"high value"') - eq(msg.get_params(), [('text/plain', ''), - ('charset', 'iso-2022-jp'), - ('importance', 'high value')]) - eq(msg.get_params(unquote=False), [('text/plain', ''), - ('charset', '"iso-2022-jp"'), - ('importance', '"high value"')]) - msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy') - eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx') - - def test_del_param(self): - eq = self.assertEqual - msg = self._msgobj('msg_05.txt') - eq(msg.get_params(), - [('multipart/report', ''), ('report-type', 'delivery-status'), - ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) - old_val = msg.get_param("report-type") - msg.del_param("report-type") - eq(msg.get_params(), - [('multipart/report', ''), - ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) - msg.set_param("report-type", old_val) - eq(msg.get_params(), - [('multipart/report', ''), - ('boundary', 'D1690A7AC1.996856090/mail.example.com'), - ('report-type', old_val)]) - - def test_del_param_on_other_header(self): - msg = Message() - msg.add_header('Content-Disposition', 'attachment', filename='bud.gif') - msg.del_param('filename', 'content-disposition') - self.assertEqual(msg['content-disposition'], 'attachment') - - def test_set_type(self): - eq = self.assertEqual - msg = Message() - self.assertRaises(ValueError, msg.set_type, 'text') - msg.set_type('text/plain') - eq(msg['content-type'], 'text/plain') - msg.set_param('charset', 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - msg.set_type('text/html') - eq(msg['content-type'], 'text/html; charset="us-ascii"') - - def test_set_type_on_other_header(self): - msg = Message() - msg['X-Content-Type'] = 'text/plain' - msg.set_type('application/octet-stream', 'X-Content-Type') - self.assertEqual(msg['x-content-type'], 'application/octet-stream') - - def test_get_content_type_missing(self): - msg = Message() - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_type_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_type(), 'message/rfc822') - - def test_get_content_type_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_type(), - 'message/rfc822') - - def test_get_content_type_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_type(), - 'message/rfc822') - - def test_get_content_type_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_type_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_type(), 'text/plain') - - def test_get_content_maintype_missing(self): - msg = Message() - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_maintype_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_maintype(), 'message') - - def test_get_content_maintype_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_maintype_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_subtype_missing(self): - msg = Message() - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_subtype_missing_with_default_type(self): - msg = Message() - msg.set_default_type('message/rfc822') - self.assertEqual(msg.get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_implicit(self): - msg = self._msgobj('msg_30.txt') - self.assertEqual(msg.get_payload(0).get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_explicit(self): - msg = self._msgobj('msg_28.txt') - self.assertEqual(msg.get_payload(0).get_content_subtype(), 'rfc822') - - def test_get_content_subtype_from_message_text_plain_implicit(self): - msg = self._msgobj('msg_03.txt') - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_subtype_from_message_text_plain_explicit(self): - msg = self._msgobj('msg_01.txt') - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_get_content_maintype_error(self): - msg = Message() - msg['Content-Type'] = 'no-slash-in-this-string' - self.assertEqual(msg.get_content_maintype(), 'text') - - def test_get_content_subtype_error(self): - msg = Message() - msg['Content-Type'] = 'no-slash-in-this-string' - self.assertEqual(msg.get_content_subtype(), 'plain') - - def test_replace_header(self): - eq = self.assertEqual - msg = Message() - msg.add_header('First', 'One') - msg.add_header('Second', 'Two') - msg.add_header('Third', 'Three') - eq(msg.keys(), ['First', 'Second', 'Third']) - eq(msg.values(), ['One', 'Two', 'Three']) - msg.replace_header('Second', 'Twenty') - eq(msg.keys(), ['First', 'Second', 'Third']) - eq(msg.values(), ['One', 'Twenty', 'Three']) - msg.add_header('First', 'Eleven') - msg.replace_header('First', 'One Hundred') - eq(msg.keys(), ['First', 'Second', 'Third', 'First']) - eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven']) - self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing') - - def test_broken_base64_payload(self): - x = 'AwDp0P7//y6LwKEAcPa/6Q=9' - msg = Message() - msg['content-type'] = 'audio/x-midi' - msg['content-transfer-encoding'] = 'base64' - msg.set_payload(x) - self.assertEqual(msg.get_payload(decode=True), x) - - - -# Test the email.encoders module -class TestEncoders(unittest.TestCase): - def test_encode_empty_payload(self): - eq = self.assertEqual - msg = Message() - msg.set_charset('us-ascii') - eq(msg['content-transfer-encoding'], '7bit') - - def test_default_cte(self): - eq = self.assertEqual - msg = MIMEText('hello world') - eq(msg['content-transfer-encoding'], '7bit') - - def test_default_cte(self): - eq = self.assertEqual - # With no explicit _charset its us-ascii, and all are 7-bit - msg = MIMEText('hello world') - eq(msg['content-transfer-encoding'], '7bit') - # Similar, but with 8-bit data - msg = MIMEText('hello \xf8 world') - eq(msg['content-transfer-encoding'], '8bit') - # And now with a different charset - msg = MIMEText('hello \xf8 world', _charset='iso-8859-1') - eq(msg['content-transfer-encoding'], 'quoted-printable') - - - -# Test long header wrapping -class TestLongHeaders(TestEmailBase): - def test_split_long_continuation(self): - eq = self.ndiffAssertEqual - msg = email.message_from_string("""\ -Subject: bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text - -test -""") - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -Subject: bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text - -test -""") - - def test_another_long_almost_unsplittable_header(self): - eq = self.ndiffAssertEqual - hstr = """\ -bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text""" - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -bug demonstration -\t12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 -\tmore text""") - h = Header(hstr) - eq(h.encode(), """\ -bug demonstration - 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 - more text""") - - def test_long_nonstring(self): - eq = self.ndiffAssertEqual - g = Charset("iso-8859-1") - cz = Charset("iso-8859-2") - utf8 = Charset("utf-8") - g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") - h = Header(g_head, g, header_name='Subject') - h.append(cz_head, cz) - h.append(utf8_head, utf8) - msg = Message() - msg['Subject'] = h - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= - =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= - =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= - =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= - =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= - =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= - =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= - =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= - =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= - =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= - =?utf-8?b?44Gm44GE44G+44GZ44CC?= - -""") - eq(h.encode(), """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= - =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= - =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= - =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= - =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= - =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= - =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= - =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= - =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= - =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= - =?utf-8?b?44Gm44GE44G+44GZ44CC?=""") - - def test_long_header_encode(self): - eq = self.ndiffAssertEqual - h = Header('wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"', - header_name='X-Foobar-Spoink-Defrobnit') - eq(h.encode(), '''\ -wasnipoop; giraffes="very-long-necked-animals"; - spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"''') - - def test_long_header_encode_with_tab_continuation(self): - eq = self.ndiffAssertEqual - h = Header('wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"', - header_name='X-Foobar-Spoink-Defrobnit', - continuation_ws='\t') - eq(h.encode(), '''\ -wasnipoop; giraffes="very-long-necked-animals"; -\tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey"''') - - def test_header_splitter(self): - eq = self.ndiffAssertEqual - msg = MIMEText('') - # It'd be great if we could use add_header() here, but that doesn't - # guarantee an order of the parameters. - msg['X-Foobar-Spoink-Defrobnit'] = ( - 'wasnipoop; giraffes="very-long-necked-animals"; ' - 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"') - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), '''\ -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; -\tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey" - -''') - - def test_no_semis_header_splitter(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['From'] = 'test@dom.ain' - msg['References'] = SPACE.join(['<%d@dom.ain>' % i for i in range(10)]) - msg.set_payload('Test') - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), """\ -From: test@dom.ain -References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain> -\t<5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain> - -Test""") - - def test_no_split_long_header(self): - eq = self.ndiffAssertEqual - hstr = 'References: ' + 'x' * 80 - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""") - - def test_splitting_multiple_long_lines(self): - eq = self.ndiffAssertEqual - hstr = """\ -from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST) -""" - h = Header(hstr, continuation_ws='\t') - eq(h.encode(), """\ -from babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST) -\tfrom babylon.socal-raves.org (localhost [127.0.0.1]); -\tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; -\tfor <mailman-admin@babylon.socal-raves.org>; -\tSat, 2 Feb 2002 17:00:06 -0800 (PST)""") - - def test_splitting_first_line_only_is_long(self): - eq = self.ndiffAssertEqual - hstr = """\ -from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca) -\tby kronos.mems-exchange.org with esmtp (Exim 4.05) -\tid 17k4h5-00034i-00 -\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""" - h = Header(hstr, maxlinelen=78, header_name='Received', - continuation_ws='\t') - eq(h.encode(), """\ -from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] -\thelo=cthulhu.gerg.ca) -\tby kronos.mems-exchange.org with esmtp (Exim 4.05) -\tid 17k4h5-00034i-00 -\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""") - - def test_long_8bit_header(self): - eq = self.ndiffAssertEqual - msg = Message() - h = Header('Britische Regierung gibt', 'iso-8859-1', - header_name='Subject') - h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') - msg['Subject'] = h - eq(msg.as_string(), """\ -Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= =?iso-8859-1?q?gr=FCnes?= - =?iso-8859-1?q?_Licht_f=FCr_Offshore-Windkraftprojekte?= - -""") - - def test_long_8bit_header_no_charset(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['Reply-To'] = 'Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>' - eq(msg.as_string(), """\ -Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com> - -""") - - def test_long_to_header(self): - eq = self.ndiffAssertEqual - to = '"Someone Test #A" <someone@eecs.umich.edu>,<someone@eecs.umich.edu>,"Someone Test #B" <someone@umich.edu>, "Someone Test #C" <someone@eecs.umich.edu>, "Someone Test #D" <someone@eecs.umich.edu>' - msg = Message() - msg['To'] = to - eq(msg.as_string(0), '''\ -To: "Someone Test #A" <someone@eecs.umich.edu>, <someone@eecs.umich.edu>, -\t"Someone Test #B" <someone@umich.edu>, -\t"Someone Test #C" <someone@eecs.umich.edu>, -\t"Someone Test #D" <someone@eecs.umich.edu> - -''') - - def test_long_line_after_append(self): - eq = self.ndiffAssertEqual - s = 'This is an example of string which has almost the limit of header length.' - h = Header(s) - h.append('Add another line.') - eq(h.encode(), """\ -This is an example of string which has almost the limit of header length. - Add another line.""") - - def test_shorter_line_with_append(self): - eq = self.ndiffAssertEqual - s = 'This is a shorter line.' - h = Header(s) - h.append('Add another sentence. (Surprise?)') - eq(h.encode(), - 'This is a shorter line. Add another sentence. (Surprise?)') - - def test_long_field_name(self): - eq = self.ndiffAssertEqual - fn = 'X-Very-Very-Very-Long-Header-Name' - gs = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - h = Header(gs, 'iso-8859-1', header_name=fn) - # BAW: this seems broken because the first line is too long - eq(h.encode(), """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_?= - =?iso-8859-1?q?ein_werden_mit_einem_Foerderband_komfortabel_den_Korridor_?= - =?iso-8859-1?q?entlang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei=2C_g?= - =?iso-8859-1?q?egen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") - - def test_long_received_header(self): - h = 'from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; Wed, 05 Mar 2003 18:10:18 -0700' - msg = Message() - msg['Received-1'] = Header(h, continuation_ws='\t') - msg['Received-2'] = h - self.assertEqual(msg.as_string(), """\ -Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by -\throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; -\tWed, 05 Mar 2003 18:10:18 -0700 -Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by -\throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; -\tWed, 05 Mar 2003 18:10:18 -0700 - -""") - - def test_string_headerinst_eq(self): - h = '<15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David Bremner\'s message of "Thu, 6 Mar 2003 13:58:21 +0100")' - msg = Message() - msg['Received-1'] = Header(h, header_name='Received-1', - continuation_ws='\t') - msg['Received-2'] = h - self.assertEqual(msg.as_string(), """\ -Received-1: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> -\t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") -Received-2: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> -\t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") - -""") - - def test_long_unbreakable_lines_with_continuation(self): - eq = self.ndiffAssertEqual - msg = Message() - t = """\ - iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 - locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp""" - msg['Face-1'] = t - msg['Face-2'] = Header(t, header_name='Face-2') - eq(msg.as_string(), """\ -Face-1: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 -\tlocQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp -Face-2: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 - locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp - -""") - - def test_another_long_multiline_header(self): - eq = self.ndiffAssertEqual - m = '''\ -Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); -\tWed, 16 Oct 2002 07:41:11 -0700''' - msg = email.message_from_string(m) - eq(msg.as_string(), '''\ -Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with -\tMicrosoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 - -''') - - def test_long_lines_with_different_header(self): - eq = self.ndiffAssertEqual - h = """\ -List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, - <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>""" - msg = Message() - msg['List'] = h - msg['List'] = Header(h, header_name='List') - eq(msg.as_string(), """\ -List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, -\t<mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe> -List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-talk>, - <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe> - -""") - - - -# Test mangling of "From " lines in the body of a message -class TestFromMangling(unittest.TestCase): - def setUp(self): - self.msg = Message() - self.msg['From'] = 'aaa@bbb.org' - self.msg.set_payload("""\ -From the desk of A.A.A.: -Blah blah blah -""") - - def test_mangled_from(self): - s = StringIO() - g = Generator(s, mangle_from_=True) - g.flatten(self.msg) - self.assertEqual(s.getvalue(), """\ -From: aaa@bbb.org - ->From the desk of A.A.A.: -Blah blah blah -""") - - def test_dont_mangle_from(self): - s = StringIO() - g = Generator(s, mangle_from_=False) - g.flatten(self.msg) - self.assertEqual(s.getvalue(), """\ -From: aaa@bbb.org - -From the desk of A.A.A.: -Blah blah blah -""") - - - -# Test the basic MIMEAudio class -class TestMIMEAudio(unittest.TestCase): - def setUp(self): - # Make sure we pick up the audiotest.au that lives in email/test/data. - # In Python, there's an audiotest.au living in Lib/test but that isn't - # included in some binary distros that don't include the test - # package. The trailing empty string on the .join() is significant - # since findfile() will do a dirname(). - datadir = os.path.join(os.path.dirname(landmark), 'data', '') - fp = open(findfile('audiotest.au', datadir), 'rb') - try: - self._audiodata = fp.read() - finally: - fp.close() - self._au = MIMEAudio(self._audiodata) - - def test_guess_minor_type(self): - self.assertEqual(self._au.get_content_type(), 'audio/basic') - - def test_encoding(self): - payload = self._au.get_payload() - self.assertEqual(base64.decodestring(payload), self._audiodata) - - def test_checkSetMinor(self): - au = MIMEAudio(self._audiodata, 'fish') - self.assertEqual(au.get_content_type(), 'audio/fish') - - def test_add_header(self): - eq = self.assertEqual - unless = self.failUnless - self._au.add_header('Content-Disposition', 'attachment', - filename='audiotest.au') - eq(self._au['content-disposition'], - 'attachment; filename="audiotest.au"') - eq(self._au.get_params(header='content-disposition'), - [('attachment', ''), ('filename', 'audiotest.au')]) - eq(self._au.get_param('filename', header='content-disposition'), - 'audiotest.au') - missing = [] - eq(self._au.get_param('attachment', header='content-disposition'), '') - unless(self._au.get_param('foo', failobj=missing, - header='content-disposition') is missing) - # Try some missing stuff - unless(self._au.get_param('foobar', missing) is missing) - unless(self._au.get_param('attachment', missing, - header='foobar') is missing) - - - -# Test the basic MIMEImage class -class TestMIMEImage(unittest.TestCase): - def setUp(self): - fp = openfile('PyBanner048.gif') - try: - self._imgdata = fp.read() - finally: - fp.close() - self._im = MIMEImage(self._imgdata) - - def test_guess_minor_type(self): - self.assertEqual(self._im.get_content_type(), 'image/gif') - - def test_encoding(self): - payload = self._im.get_payload() - self.assertEqual(base64.decodestring(payload), self._imgdata) - - def test_checkSetMinor(self): - im = MIMEImage(self._imgdata, 'fish') - self.assertEqual(im.get_content_type(), 'image/fish') - - def test_add_header(self): - eq = self.assertEqual - unless = self.failUnless - self._im.add_header('Content-Disposition', 'attachment', - filename='dingusfish.gif') - eq(self._im['content-disposition'], - 'attachment; filename="dingusfish.gif"') - eq(self._im.get_params(header='content-disposition'), - [('attachment', ''), ('filename', 'dingusfish.gif')]) - eq(self._im.get_param('filename', header='content-disposition'), - 'dingusfish.gif') - missing = [] - eq(self._im.get_param('attachment', header='content-disposition'), '') - unless(self._im.get_param('foo', failobj=missing, - header='content-disposition') is missing) - # Try some missing stuff - unless(self._im.get_param('foobar', missing) is missing) - unless(self._im.get_param('attachment', missing, - header='foobar') is missing) - - - -# Test the basic MIMEApplication class -class TestMIMEApplication(unittest.TestCase): - def test_headers(self): - eq = self.assertEqual - msg = MIMEApplication('\xfa\xfb\xfc\xfd\xfe\xff') - eq(msg.get_content_type(), 'application/octet-stream') - eq(msg['content-transfer-encoding'], 'base64') - - def test_body(self): - eq = self.assertEqual - bytes = '\xfa\xfb\xfc\xfd\xfe\xff' - msg = MIMEApplication(bytes) - eq(msg.get_payload(), '+vv8/f7/') - eq(msg.get_payload(decode=True), bytes) - - - -# Test the basic MIMEText class -class TestMIMEText(unittest.TestCase): - def setUp(self): - self._msg = MIMEText('hello there') - - def test_types(self): - eq = self.assertEqual - unless = self.failUnless - eq(self._msg.get_content_type(), 'text/plain') - eq(self._msg.get_param('charset'), 'us-ascii') - missing = [] - unless(self._msg.get_param('foobar', missing) is missing) - unless(self._msg.get_param('charset', missing, header='foobar') - is missing) - - def test_payload(self): - self.assertEqual(self._msg.get_payload(), 'hello there') - self.failUnless(not self._msg.is_multipart()) - - def test_charset(self): - eq = self.assertEqual - msg = MIMEText('hello there', _charset='us-ascii') - eq(msg.get_charset().input_charset, 'us-ascii') - eq(msg['content-type'], 'text/plain; charset="us-ascii"') - - - -# Test complicated multipart/* messages -class TestMultipart(TestEmailBase): - def setUp(self): - fp = openfile('PyBanner048.gif') - try: - data = fp.read() - finally: - fp.close() - - container = MIMEBase('multipart', 'mixed', boundary='BOUNDARY') - image = MIMEImage(data, name='dingusfish.gif') - image.add_header('content-disposition', 'attachment', - filename='dingusfish.gif') - intro = MIMEText('''\ -Hi there, - -This is the dingus fish. -''') - container.attach(intro) - container.attach(image) - container['From'] = 'Barry <barry@digicool.com>' - container['To'] = 'Dingus Lovers <cravindogs@cravindogs.com>' - container['Subject'] = 'Here is your dingus fish' - - now = 987809702.54848599 - timetuple = time.localtime(now) - if timetuple[-1] == 0: - tzsecs = time.timezone - else: - tzsecs = time.altzone - if tzsecs > 0: - sign = '-' - else: - sign = '+' - tzoffset = ' %s%04d' % (sign, tzsecs / 36) - container['Date'] = time.strftime( - '%a, %d %b %Y %H:%M:%S', - time.localtime(now)) + tzoffset - self._msg = container - self._im = image - self._txt = intro - - def test_hierarchy(self): - # convenience - eq = self.assertEqual - unless = self.failUnless - raises = self.assertRaises - # tests - m = self._msg - unless(m.is_multipart()) - eq(m.get_content_type(), 'multipart/mixed') - eq(len(m.get_payload()), 2) - raises(IndexError, m.get_payload, 2) - m0 = m.get_payload(0) - m1 = m.get_payload(1) - unless(m0 is self._txt) - unless(m1 is self._im) - eq(m.get_payload(), [m0, m1]) - unless(not m0.is_multipart()) - unless(not m1.is_multipart()) - - def test_empty_multipart_idempotent(self): - text = """\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY - - ---BOUNDARY-- -""" - msg = Parser().parsestr(text) - self.ndiffAssertEqual(text, msg.as_string()) - - def test_no_parts_in_a_multipart_with_none_epilogue(self): - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.set_boundary('BOUNDARY') - self.ndiffAssertEqual(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY - ---BOUNDARY--''') - - def test_no_parts_in_a_multipart_with_empty_epilogue(self): - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = '' - outer.epilogue = '' - outer.set_boundary('BOUNDARY') - self.ndiffAssertEqual(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY - ---BOUNDARY-- -''') - - def test_one_part_in_a_multipart(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.set_boundary('BOUNDARY') - msg = MIMEText('hello world') - outer.attach(msg) - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - def test_seq_parts_in_a_multipart_with_empty_preamble(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = '' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_none_preamble(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.preamble = None - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_none_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = None - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY--''') - - - def test_seq_parts_in_a_multipart_with_empty_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = '' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY-- -''') - - - def test_seq_parts_in_a_multipart_with_nl_epilogue(self): - eq = self.ndiffAssertEqual - outer = MIMEBase('multipart', 'mixed') - outer['Subject'] = 'A subject' - outer['To'] = 'aperson@dom.ain' - outer['From'] = 'bperson@dom.ain' - outer.epilogue = '\n' - msg = MIMEText('hello world') - outer.attach(msg) - outer.set_boundary('BOUNDARY') - eq(outer.as_string(), '''\ -Content-Type: multipart/mixed; boundary="BOUNDARY" -MIME-Version: 1.0 -Subject: A subject -To: aperson@dom.ain -From: bperson@dom.ain - ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -hello world ---BOUNDARY-- - -''') - - def test_message_external_body(self): - eq = self.assertEqual - msg = self._msgobj('msg_36.txt') - eq(len(msg.get_payload()), 2) - msg1 = msg.get_payload(1) - eq(msg1.get_content_type(), 'multipart/alternative') - eq(len(msg1.get_payload()), 2) - for subpart in msg1.get_payload(): - eq(subpart.get_content_type(), 'message/external-body') - eq(len(subpart.get_payload()), 1) - subsubpart = subpart.get_payload(0) - eq(subsubpart.get_content_type(), 'text/plain') - - def test_double_boundary(self): - # msg_37.txt is a multipart that contains two dash-boundary's in a - # row. Our interpretation of RFC 2046 calls for ignoring the second - # and subsequent boundaries. - msg = self._msgobj('msg_37.txt') - self.assertEqual(len(msg.get_payload()), 3) - - def test_nested_inner_contains_outer_boundary(self): - eq = self.ndiffAssertEqual - # msg_38.txt has an inner part that contains outer boundaries. My - # interpretation of RFC 2046 (based on sections 5.1 and 5.1.2) say - # these are illegal and should be interpreted as unterminated inner - # parts. - msg = self._msgobj('msg_38.txt') - sfp = StringIO() - iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/mixed - multipart/mixed - multipart/alternative - text/plain - text/plain - text/plain - text/plain -""") - - def test_nested_with_same_boundary(self): - eq = self.ndiffAssertEqual - # msg 39.txt is similarly evil in that it's got inner parts that use - # the same boundary as outer parts. Again, I believe the way this is - # parsed is closest to the spirit of RFC 2046 - msg = self._msgobj('msg_39.txt') - sfp = StringIO() - iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/mixed - multipart/mixed - multipart/alternative - application/octet-stream - application/octet-stream - text/plain -""") - - def test_boundary_in_non_multipart(self): - msg = self._msgobj('msg_40.txt') - self.assertEqual(msg.as_string(), '''\ -MIME-Version: 1.0 -Content-Type: text/html; boundary="--961284236552522269" - -----961284236552522269 -Content-Type: text/html; -Content-Transfer-Encoding: 7Bit - -<html></html> - -----961284236552522269-- -''') - - def test_boundary_with_leading_space(self): - eq = self.assertEqual - msg = email.message_from_string('''\ -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary=" XXXX" - --- XXXX -Content-Type: text/plain - - --- XXXX -Content-Type: text/plain - --- XXXX-- -''') - self.failUnless(msg.is_multipart()) - eq(msg.get_boundary(), ' XXXX') - eq(len(msg.get_payload()), 2) - - def test_boundary_without_trailing_newline(self): - m = Parser().parsestr("""\ -Content-Type: multipart/mixed; boundary="===============0012394164==" -MIME-Version: 1.0 - ---===============0012394164== -Content-Type: image/file1.jpg -MIME-Version: 1.0 -Content-Transfer-Encoding: base64 - -YXNkZg== ---===============0012394164==--""") - self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==') - - - -# Test some badly formatted messages -class TestNonConformant(TestEmailBase): - def test_parse_missing_minor_type(self): - eq = self.assertEqual - msg = self._msgobj('msg_14.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - - def test_same_boundary_inner_outer(self): - unless = self.failUnless - msg = self._msgobj('msg_15.txt') - # XXX We can probably eventually do better - inner = msg.get_payload(0) - unless(hasattr(inner, 'defects')) - self.assertEqual(len(inner.defects), 1) - unless(isinstance(inner.defects[0], - errors.StartBoundaryNotFoundDefect)) - - def test_multipart_no_boundary(self): - unless = self.failUnless - msg = self._msgobj('msg_25.txt') - unless(isinstance(msg.get_payload(), str)) - self.assertEqual(len(msg.defects), 2) - unless(isinstance(msg.defects[0], errors.NoBoundaryInMultipartDefect)) - unless(isinstance(msg.defects[1], - errors.MultipartInvariantViolationDefect)) - - def test_invalid_content_type(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - msg = Message() - # RFC 2045, $5.2 says invalid yields text/plain - msg['Content-Type'] = 'text' - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_content_type(), 'text/plain') - # Clear the old value and try something /really/ invalid - del msg['content-type'] - msg['Content-Type'] = 'foo' - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_content_type(), 'text/plain') - # Still, make sure that the message is idempotently generated - s = StringIO() - g = Generator(s) - g.flatten(msg) - neq(s.getvalue(), 'Content-Type: foo\n\n') - - def test_no_start_boundary(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_31.txt') - eq(msg.get_payload(), """\ ---BOUNDARY -Content-Type: text/plain - -message 1 - ---BOUNDARY -Content-Type: text/plain - -message 2 - ---BOUNDARY-- -""") - - def test_no_separating_blank_line(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_35.txt') - eq(msg.as_string(), """\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: here's something interesting - -counter to RFC 2822, there's no separating newline here -""") - - def test_lying_multipart(self): - unless = self.failUnless - msg = self._msgobj('msg_41.txt') - unless(hasattr(msg, 'defects')) - self.assertEqual(len(msg.defects), 2) - unless(isinstance(msg.defects[0], errors.NoBoundaryInMultipartDefect)) - unless(isinstance(msg.defects[1], - errors.MultipartInvariantViolationDefect)) - - def test_missing_start_boundary(self): - outer = self._msgobj('msg_42.txt') - # The message structure is: - # - # multipart/mixed - # text/plain - # message/rfc822 - # multipart/mixed [*] - # - # [*] This message is missing its start boundary - bad = outer.get_payload(1).get_payload(0) - self.assertEqual(len(bad.defects), 1) - self.failUnless(isinstance(bad.defects[0], - errors.StartBoundaryNotFoundDefect)) - - - -# Test RFC 2047 header encoding and decoding -class TestRFC2047(unittest.TestCase): - def test_rfc2047_multiline(self): - eq = self.assertEqual - s = """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz - foo bar =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""" - dh = decode_header(s) - eq(dh, [ - ('Re:', None), - ('r\x8aksm\x9arg\x8cs', 'mac-iceland'), - ('baz foo bar', None), - ('r\x8aksm\x9arg\x8cs', 'mac-iceland')]) - eq(str(make_header(dh)), - """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar - =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""") - - def test_whitespace_eater_unicode(self): - eq = self.assertEqual - s = '=?ISO-8859-1?Q?Andr=E9?= Pirard <pirard@dom.ain>' - dh = decode_header(s) - eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard <pirard@dom.ain>', None)]) - hu = unicode(make_header(dh)).encode('latin-1') - eq(hu, 'Andr\xe9 Pirard <pirard@dom.ain>') - - def test_whitespace_eater_unicode_2(self): - eq = self.assertEqual - s = 'The =?iso-8859-1?b?cXVpY2sgYnJvd24gZm94?= jumped over the =?iso-8859-1?b?bGF6eSBkb2c=?=' - dh = decode_header(s) - eq(dh, [('The', None), ('quick brown fox', 'iso-8859-1'), - ('jumped over the', None), ('lazy dog', 'iso-8859-1')]) - hu = make_header(dh).__unicode__() - eq(hu, u'The quick brown fox jumped over the lazy dog') - - def test_rfc2047_missing_whitespace(self): - s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' - dh = decode_header(s) - self.assertEqual(dh, [(s, None)]) - - def test_rfc2047_with_whitespace(self): - s = 'Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord' - dh = decode_header(s) - self.assertEqual(dh, [('Sm', None), ('\xf6', 'iso-8859-1'), - ('rg', None), ('\xe5', 'iso-8859-1'), - ('sbord', None)]) - - - -# Test the MIMEMessage class -class TestMIMEMessage(TestEmailBase): - def setUp(self): - fp = openfile('msg_11.txt') - try: - self._text = fp.read() - finally: - fp.close() - - def test_type_error(self): - self.assertRaises(TypeError, MIMEMessage, 'a plain string') - - def test_valid_argument(self): - eq = self.assertEqual - unless = self.failUnless - subject = 'A sub-message' - m = Message() - m['Subject'] = subject - r = MIMEMessage(m) - eq(r.get_content_type(), 'message/rfc822') - payload = r.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - subpart = payload[0] - unless(subpart is m) - eq(subpart['subject'], subject) - - def test_bad_multipart(self): - eq = self.assertEqual - msg1 = Message() - msg1['Subject'] = 'subpart 1' - msg2 = Message() - msg2['Subject'] = 'subpart 2' - r = MIMEMessage(msg1) - self.assertRaises(errors.MultipartConversionError, r.attach, msg2) - - def test_generate(self): - # First craft the message to be encapsulated - m = Message() - m['Subject'] = 'An enclosed message' - m.set_payload('Here is the body of the message.\n') - r = MIMEMessage(m) - r['Subject'] = 'The enclosing message' - s = StringIO() - g = Generator(s) - g.flatten(r) - self.assertEqual(s.getvalue(), """\ -Content-Type: message/rfc822 -MIME-Version: 1.0 -Subject: The enclosing message - -Subject: An enclosed message - -Here is the body of the message. -""") - - def test_parse_message_rfc822(self): - eq = self.assertEqual - unless = self.failUnless - msg = self._msgobj('msg_11.txt') - eq(msg.get_content_type(), 'message/rfc822') - payload = msg.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - submsg = payload[0] - self.failUnless(isinstance(submsg, Message)) - eq(submsg['subject'], 'An enclosed message') - eq(submsg.get_payload(), 'Here is the body of the message.\n') - - def test_dsn(self): - eq = self.assertEqual - unless = self.failUnless - # msg 16 is a Delivery Status Notification, see RFC 1894 - msg = self._msgobj('msg_16.txt') - eq(msg.get_content_type(), 'multipart/report') - unless(msg.is_multipart()) - eq(len(msg.get_payload()), 3) - # Subpart 1 is a text/plain, human readable section - subpart = msg.get_payload(0) - eq(subpart.get_content_type(), 'text/plain') - eq(subpart.get_payload(), """\ -This report relates to a message you sent with the following header fields: - - Message-id: <002001c144a6$8752e060$56104586@oxy.edu> - Date: Sun, 23 Sep 2001 20:10:55 -0700 - From: "Ian T. Henry" <henryi@oxy.edu> - To: SoCal Raves <scr@socal-raves.org> - Subject: [scr] yeah for Ians!! - -Your message cannot be delivered to the following recipients: - - Recipient address: jangel1@cougar.noc.ucla.edu - Reason: recipient reached disk quota - -""") - # Subpart 2 contains the machine parsable DSN information. It - # consists of two blocks of headers, represented by two nested Message - # objects. - subpart = msg.get_payload(1) - eq(subpart.get_content_type(), 'message/delivery-status') - eq(len(subpart.get_payload()), 2) - # message/delivery-status should treat each block as a bunch of - # headers, i.e. a bunch of Message objects. - dsn1 = subpart.get_payload(0) - unless(isinstance(dsn1, Message)) - eq(dsn1['original-envelope-id'], '0GK500B4HD0888@cougar.noc.ucla.edu') - eq(dsn1.get_param('dns', header='reporting-mta'), '') - # Try a missing one <wink> - eq(dsn1.get_param('nsd', header='reporting-mta'), None) - dsn2 = subpart.get_payload(1) - unless(isinstance(dsn2, Message)) - eq(dsn2['action'], 'failed') - eq(dsn2.get_params(header='original-recipient'), - [('rfc822', ''), ('jangel1@cougar.noc.ucla.edu', '')]) - eq(dsn2.get_param('rfc822', header='final-recipient'), '') - # Subpart 3 is the original message - subpart = msg.get_payload(2) - eq(subpart.get_content_type(), 'message/rfc822') - payload = subpart.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - subsubpart = payload[0] - unless(isinstance(subsubpart, Message)) - eq(subsubpart.get_content_type(), 'text/plain') - eq(subsubpart['message-id'], - '<002001c144a6$8752e060$56104586@oxy.edu>') - - def test_epilogue(self): - eq = self.ndiffAssertEqual - fp = openfile('msg_21.txt') - try: - text = fp.read() - finally: - fp.close() - msg = Message() - msg['From'] = 'aperson@dom.ain' - msg['To'] = 'bperson@dom.ain' - msg['Subject'] = 'Test' - msg.preamble = 'MIME message' - msg.epilogue = 'End of MIME message\n' - msg1 = MIMEText('One') - msg2 = MIMEText('Two') - msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') - msg.attach(msg1) - msg.attach(msg2) - sfp = StringIO() - g = Generator(sfp) - g.flatten(msg) - eq(sfp.getvalue(), text) - - def test_no_nl_preamble(self): - eq = self.ndiffAssertEqual - msg = Message() - msg['From'] = 'aperson@dom.ain' - msg['To'] = 'bperson@dom.ain' - msg['Subject'] = 'Test' - msg.preamble = 'MIME message' - msg.epilogue = '' - msg1 = MIMEText('One') - msg2 = MIMEText('Two') - msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') - msg.attach(msg1) - msg.attach(msg2) - eq(msg.as_string(), """\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: Test -Content-Type: multipart/mixed; boundary="BOUNDARY" - -MIME message ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -One ---BOUNDARY -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -Two ---BOUNDARY-- -""") - - def test_default_type(self): - eq = self.assertEqual - fp = openfile('msg_30.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - container1 = msg.get_payload(0) - eq(container1.get_default_type(), 'message/rfc822') - eq(container1.get_content_type(), 'message/rfc822') - container2 = msg.get_payload(1) - eq(container2.get_default_type(), 'message/rfc822') - eq(container2.get_content_type(), 'message/rfc822') - container1a = container1.get_payload(0) - eq(container1a.get_default_type(), 'text/plain') - eq(container1a.get_content_type(), 'text/plain') - container2a = container2.get_payload(0) - eq(container2a.get_default_type(), 'text/plain') - eq(container2a.get_content_type(), 'text/plain') - - def test_default_type_with_explicit_container_type(self): - eq = self.assertEqual - fp = openfile('msg_28.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - container1 = msg.get_payload(0) - eq(container1.get_default_type(), 'message/rfc822') - eq(container1.get_content_type(), 'message/rfc822') - container2 = msg.get_payload(1) - eq(container2.get_default_type(), 'message/rfc822') - eq(container2.get_content_type(), 'message/rfc822') - container1a = container1.get_payload(0) - eq(container1a.get_default_type(), 'text/plain') - eq(container1a.get_content_type(), 'text/plain') - container2a = container2.get_payload(0) - eq(container2a.get_default_type(), 'text/plain') - eq(container2a.get_content_type(), 'text/plain') - - def test_default_type_non_parsed(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - # Set up container - container = MIMEMultipart('digest', 'BOUNDARY') - container.epilogue = '' - # Set up subparts - subpart1a = MIMEText('message 1\n') - subpart2a = MIMEText('message 2\n') - subpart1 = MIMEMessage(subpart1a) - subpart2 = MIMEMessage(subpart2a) - container.attach(subpart1) - container.attach(subpart2) - eq(subpart1.get_content_type(), 'message/rfc822') - eq(subpart1.get_default_type(), 'message/rfc822') - eq(subpart2.get_content_type(), 'message/rfc822') - eq(subpart2.get_default_type(), 'message/rfc822') - neq(container.as_string(0), '''\ -Content-Type: multipart/digest; boundary="BOUNDARY" -MIME-Version: 1.0 - ---BOUNDARY -Content-Type: message/rfc822 -MIME-Version: 1.0 - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 1 - ---BOUNDARY -Content-Type: message/rfc822 -MIME-Version: 1.0 - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 2 - ---BOUNDARY-- -''') - del subpart1['content-type'] - del subpart1['mime-version'] - del subpart2['content-type'] - del subpart2['mime-version'] - eq(subpart1.get_content_type(), 'message/rfc822') - eq(subpart1.get_default_type(), 'message/rfc822') - eq(subpart2.get_content_type(), 'message/rfc822') - eq(subpart2.get_default_type(), 'message/rfc822') - neq(container.as_string(0), '''\ -Content-Type: multipart/digest; boundary="BOUNDARY" -MIME-Version: 1.0 - ---BOUNDARY - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 1 - ---BOUNDARY - -Content-Type: text/plain; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit - -message 2 - ---BOUNDARY-- -''') - - def test_mime_attachments_in_constructor(self): - eq = self.assertEqual - text1 = MIMEText('') - text2 = MIMEText('') - msg = MIMEMultipart(_subparts=(text1, text2)) - eq(len(msg.get_payload()), 2) - eq(msg.get_payload(0), text1) - eq(msg.get_payload(1), text2) - - - -# A general test of parser->model->generator idempotency. IOW, read a message -# in, parse it into a message object tree, then without touching the tree, -# regenerate the plain text. The original text and the transformed text -# should be identical. Note: that we ignore the Unix-From since that may -# contain a changed date. -class TestIdempotent(TestEmailBase): - def _msgobj(self, filename): - fp = openfile(filename) - try: - data = fp.read() - finally: - fp.close() - msg = email.message_from_string(data) - return msg, data - - def _idempotent(self, msg, text): - eq = self.ndiffAssertEqual - s = StringIO() - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - eq(text, s.getvalue()) - - def test_parse_text_message(self): - eq = self.assertEquals - msg, text = self._msgobj('msg_01.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_content_maintype(), 'text') - eq(msg.get_content_subtype(), 'plain') - eq(msg.get_params()[1], ('charset', 'us-ascii')) - eq(msg.get_param('charset'), 'us-ascii') - eq(msg.preamble, None) - eq(msg.epilogue, None) - self._idempotent(msg, text) - - def test_parse_untyped_message(self): - eq = self.assertEquals - msg, text = self._msgobj('msg_03.txt') - eq(msg.get_content_type(), 'text/plain') - eq(msg.get_params(), None) - eq(msg.get_param('charset'), None) - self._idempotent(msg, text) - - def test_simple_multipart(self): - msg, text = self._msgobj('msg_04.txt') - self._idempotent(msg, text) - - def test_MIME_digest(self): - msg, text = self._msgobj('msg_02.txt') - self._idempotent(msg, text) - - def test_long_header(self): - msg, text = self._msgobj('msg_27.txt') - self._idempotent(msg, text) - - def test_MIME_digest_with_part_headers(self): - msg, text = self._msgobj('msg_28.txt') - self._idempotent(msg, text) - - def test_mixed_with_image(self): - msg, text = self._msgobj('msg_06.txt') - self._idempotent(msg, text) - - def test_multipart_report(self): - msg, text = self._msgobj('msg_05.txt') - self._idempotent(msg, text) - - def test_dsn(self): - msg, text = self._msgobj('msg_16.txt') - self._idempotent(msg, text) - - def test_preamble_epilogue(self): - msg, text = self._msgobj('msg_21.txt') - self._idempotent(msg, text) - - def test_multipart_one_part(self): - msg, text = self._msgobj('msg_23.txt') - self._idempotent(msg, text) - - def test_multipart_no_parts(self): - msg, text = self._msgobj('msg_24.txt') - self._idempotent(msg, text) - - def test_no_start_boundary(self): - msg, text = self._msgobj('msg_31.txt') - self._idempotent(msg, text) - - def test_rfc2231_charset(self): - msg, text = self._msgobj('msg_32.txt') - self._idempotent(msg, text) - - def test_more_rfc2231_parameters(self): - msg, text = self._msgobj('msg_33.txt') - self._idempotent(msg, text) - - def test_text_plain_in_a_multipart_digest(self): - msg, text = self._msgobj('msg_34.txt') - self._idempotent(msg, text) - - def test_nested_multipart_mixeds(self): - msg, text = self._msgobj('msg_12a.txt') - self._idempotent(msg, text) - - def test_message_external_body_idempotent(self): - msg, text = self._msgobj('msg_36.txt') - self._idempotent(msg, text) - - def test_content_type(self): - eq = self.assertEquals - unless = self.failUnless - # Get a message object and reset the seek pointer for other tests - msg, text = self._msgobj('msg_05.txt') - eq(msg.get_content_type(), 'multipart/report') - # Test the Content-Type: parameters - params = {} - for pk, pv in msg.get_params(): - params[pk] = pv - eq(params['report-type'], 'delivery-status') - eq(params['boundary'], 'D1690A7AC1.996856090/mail.example.com') - eq(msg.preamble, 'This is a MIME-encapsulated message.\n') - eq(msg.epilogue, '\n') - eq(len(msg.get_payload()), 3) - # Make sure the subparts are what we expect - msg1 = msg.get_payload(0) - eq(msg1.get_content_type(), 'text/plain') - eq(msg1.get_payload(), 'Yadda yadda yadda\n') - msg2 = msg.get_payload(1) - eq(msg2.get_content_type(), 'text/plain') - eq(msg2.get_payload(), 'Yadda yadda yadda\n') - msg3 = msg.get_payload(2) - eq(msg3.get_content_type(), 'message/rfc822') - self.failUnless(isinstance(msg3, Message)) - payload = msg3.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - msg4 = payload[0] - unless(isinstance(msg4, Message)) - eq(msg4.get_payload(), 'Yadda yadda yadda\n') - - def test_parser(self): - eq = self.assertEquals - unless = self.failUnless - msg, text = self._msgobj('msg_06.txt') - # Check some of the outer headers - eq(msg.get_content_type(), 'message/rfc822') - # Make sure the payload is a list of exactly one sub-Message, and that - # that submessage has a type of text/plain - payload = msg.get_payload() - unless(isinstance(payload, list)) - eq(len(payload), 1) - msg1 = payload[0] - self.failUnless(isinstance(msg1, Message)) - eq(msg1.get_content_type(), 'text/plain') - self.failUnless(isinstance(msg1.get_payload(), str)) - eq(msg1.get_payload(), '\n') - - - -# Test various other bits of the package's functionality -class TestMiscellaneous(TestEmailBase): - def test_message_from_string(self): - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - msg = email.message_from_string(text) - s = StringIO() - # Don't wrap/continue long headers since we're trying to test - # idempotency. - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - self.assertEqual(text, s.getvalue()) - - def test_message_from_file(self): - fp = openfile('msg_01.txt') - try: - text = fp.read() - fp.seek(0) - msg = email.message_from_file(fp) - s = StringIO() - # Don't wrap/continue long headers since we're trying to test - # idempotency. - g = Generator(s, maxheaderlen=0) - g.flatten(msg) - self.assertEqual(text, s.getvalue()) - finally: - fp.close() - - def test_message_from_string_with_class(self): - unless = self.failUnless - fp = openfile('msg_01.txt') - try: - text = fp.read() - finally: - fp.close() - # Create a subclass - class MyMessage(Message): - pass - - msg = email.message_from_string(text, MyMessage) - unless(isinstance(msg, MyMessage)) - # Try something more complicated - fp = openfile('msg_02.txt') - try: - text = fp.read() - finally: - fp.close() - msg = email.message_from_string(text, MyMessage) - for subpart in msg.walk(): - unless(isinstance(subpart, MyMessage)) - - def test_message_from_file_with_class(self): - unless = self.failUnless - # Create a subclass - class MyMessage(Message): - pass - - fp = openfile('msg_01.txt') - try: - msg = email.message_from_file(fp, MyMessage) - finally: - fp.close() - unless(isinstance(msg, MyMessage)) - # Try something more complicated - fp = openfile('msg_02.txt') - try: - msg = email.message_from_file(fp, MyMessage) - finally: - fp.close() - for subpart in msg.walk(): - unless(isinstance(subpart, MyMessage)) - - def test__all__(self): - module = __import__('email') - # Can't use sorted() here due to Python 2.3 compatibility - all = module.__all__[:] - all.sort() - self.assertEqual(all, [ - # Old names - 'Charset', 'Encoders', 'Errors', 'Generator', - 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', - 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', - 'MIMENonMultipart', 'MIMEText', 'Message', - 'Parser', 'Utils', 'base64MIME', - # new names - 'base64mime', 'charset', 'encoders', 'errors', 'generator', - 'header', 'iterators', 'message', 'message_from_file', - 'message_from_string', 'mime', 'parser', - 'quopriMIME', 'quoprimime', 'utils', - ]) - - def test_formatdate(self): - now = time.time() - self.assertEqual(utils.parsedate(utils.formatdate(now))[:6], - time.gmtime(now)[:6]) - - def test_formatdate_localtime(self): - now = time.time() - self.assertEqual( - utils.parsedate(utils.formatdate(now, localtime=True))[:6], - time.localtime(now)[:6]) - - def test_formatdate_usegmt(self): - now = time.time() - self.assertEqual( - utils.formatdate(now, localtime=False), - time.strftime('%a, %d %b %Y %H:%M:%S -0000', time.gmtime(now))) - self.assertEqual( - utils.formatdate(now, localtime=False, usegmt=True), - time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(now))) - - def test_parsedate_none(self): - self.assertEqual(utils.parsedate(''), None) - - def test_parsedate_compact(self): - # The FWS after the comma is optional - self.assertEqual(utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'), - utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) - - def test_parsedate_no_dayofweek(self): - eq = self.assertEqual - eq(utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'), - (2003, 2, 25, 13, 47, 26, 0, 1, -1, -28800)) - - def test_parsedate_compact_no_dayofweek(self): - eq = self.assertEqual - eq(utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'), - (2003, 2, 5, 13, 47, 26, 0, 1, -1, -28800)) - - def test_parsedate_acceptable_to_time_functions(self): - eq = self.assertEqual - timetup = utils.parsedate('5 Feb 2003 13:47:26 -0800') - t = int(time.mktime(timetup)) - eq(time.localtime(t)[:6], timetup[:6]) - eq(int(time.strftime('%Y', timetup)), 2003) - timetup = utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') - t = int(time.mktime(timetup[:9])) - eq(time.localtime(t)[:6], timetup[:6]) - eq(int(time.strftime('%Y', timetup[:9])), 2003) - - def test_parseaddr_empty(self): - self.assertEqual(utils.parseaddr('<>'), ('', '')) - self.assertEqual(utils.formataddr(utils.parseaddr('<>')), '') - - def test_noquote_dump(self): - self.assertEqual( - utils.formataddr(('A Silly Person', 'person@dom.ain')), - 'A Silly Person <person@dom.ain>') - - def test_escape_dump(self): - self.assertEqual( - utils.formataddr(('A (Very) Silly Person', 'person@dom.ain')), - r'"A \(Very\) Silly Person" <person@dom.ain>') - a = r'A \(Special\) Person' - b = 'person@dom.ain' - self.assertEqual(utils.parseaddr(utils.formataddr((a, b))), (a, b)) - - def test_escape_backslashes(self): - self.assertEqual( - utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')), - r'"Arthur \\Backslash\\ Foobar" <person@dom.ain>') - a = r'Arthur \Backslash\ Foobar' - b = 'person@dom.ain' - self.assertEqual(utils.parseaddr(utils.formataddr((a, b))), (a, b)) - - def test_name_with_dot(self): - x = 'John X. Doe <jxd@example.com>' - y = '"John X. Doe" <jxd@example.com>' - a, b = ('John X. Doe', 'jxd@example.com') - self.assertEqual(utils.parseaddr(x), (a, b)) - self.assertEqual(utils.parseaddr(y), (a, b)) - # formataddr() quotes the name if there's a dot in it - self.assertEqual(utils.formataddr((a, b)), y) - - def test_multiline_from_comment(self): - x = """\ -Foo -\tBar <foo@example.com>""" - self.assertEqual(utils.parseaddr(x), ('Foo Bar', 'foo@example.com')) - - def test_quote_dump(self): - self.assertEqual( - utils.formataddr(('A Silly; Person', 'person@dom.ain')), - r'"A Silly; Person" <person@dom.ain>') - - def test_fix_eols(self): - eq = self.assertEqual - eq(utils.fix_eols('hello'), 'hello') - eq(utils.fix_eols('hello\n'), 'hello\r\n') - eq(utils.fix_eols('hello\r'), 'hello\r\n') - eq(utils.fix_eols('hello\r\n'), 'hello\r\n') - eq(utils.fix_eols('hello\n\r'), 'hello\r\n\r\n') - - def test_charset_richcomparisons(self): - eq = self.assertEqual - ne = self.failIfEqual - cset1 = Charset() - cset2 = Charset() - eq(cset1, 'us-ascii') - eq(cset1, 'US-ASCII') - eq(cset1, 'Us-AsCiI') - eq('us-ascii', cset1) - eq('US-ASCII', cset1) - eq('Us-AsCiI', cset1) - ne(cset1, 'usascii') - ne(cset1, 'USASCII') - ne(cset1, 'UsAsCiI') - ne('usascii', cset1) - ne('USASCII', cset1) - ne('UsAsCiI', cset1) - eq(cset1, cset2) - eq(cset2, cset1) - - def test_getaddresses(self): - eq = self.assertEqual - eq(utils.getaddresses(['aperson@dom.ain (Al Person)', - 'Bud Person <bperson@dom.ain>']), - [('Al Person', 'aperson@dom.ain'), - ('Bud Person', 'bperson@dom.ain')]) - - def test_getaddresses_nasty(self): - eq = self.assertEqual - eq(utils.getaddresses(['foo: ;']), [('', '')]) - eq(utils.getaddresses( - ['[]*-- =~$']), - [('', ''), ('', ''), ('', '*--')]) - eq(utils.getaddresses( - ['foo: ;', '"Jason R. Mastaler" <jason@dom.ain>']), - [('', ''), ('Jason R. Mastaler', 'jason@dom.ain')]) - - def test_getaddresses_embedded_comment(self): - """Test proper handling of a nested comment""" - eq = self.assertEqual - addrs = utils.getaddresses(['User ((nested comment)) <foo@bar.com>']) - eq(addrs[0][1], 'foo@bar.com') - - def test_utils_quote_unquote(self): - eq = self.assertEqual - msg = Message() - msg.add_header('content-disposition', 'attachment', - filename='foo\\wacky"name') - eq(msg.get_filename(), 'foo\\wacky"name') - - def test_get_body_encoding_with_bogus_charset(self): - charset = Charset('not a charset') - self.assertEqual(charset.get_body_encoding(), 'base64') - - def test_get_body_encoding_with_uppercase_charset(self): - eq = self.assertEqual - msg = Message() - msg['Content-Type'] = 'text/plain; charset=UTF-8' - eq(msg['content-type'], 'text/plain; charset=UTF-8') - charsets = msg.get_charsets() - eq(len(charsets), 1) - eq(charsets[0], 'utf-8') - charset = Charset(charsets[0]) - eq(charset.get_body_encoding(), 'base64') - msg.set_payload('hello world', charset=charset) - eq(msg.get_payload(), 'aGVsbG8gd29ybGQ=\n') - eq(msg.get_payload(decode=True), 'hello world') - eq(msg['content-transfer-encoding'], 'base64') - # Try another one - msg = Message() - msg['Content-Type'] = 'text/plain; charset="US-ASCII"' - charsets = msg.get_charsets() - eq(len(charsets), 1) - eq(charsets[0], 'us-ascii') - charset = Charset(charsets[0]) - eq(charset.get_body_encoding(), encoders.encode_7or8bit) - msg.set_payload('hello world', charset=charset) - eq(msg.get_payload(), 'hello world') - eq(msg['content-transfer-encoding'], '7bit') - - def test_charsets_case_insensitive(self): - lc = Charset('us-ascii') - uc = Charset('US-ASCII') - self.assertEqual(lc.get_body_encoding(), uc.get_body_encoding()) - - def test_partial_falls_inside_message_delivery_status(self): - eq = self.ndiffAssertEqual - # The Parser interface provides chunks of data to FeedParser in 8192 - # byte gulps. SF bug #1076485 found one of those chunks inside - # message/delivery-status header block, which triggered an - # unreadline() of NeedMoreData. - msg = self._msgobj('msg_43.txt') - sfp = StringIO() - iterators._structure(msg, sfp) - eq(sfp.getvalue(), """\ -multipart/report - text/plain - message/delivery-status - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/plain - text/rfc822-headers -""") - - - -# Test the iterator/generators -class TestIterators(TestEmailBase): - def test_body_line_iterator(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - # First a simple non-multipart message - msg = self._msgobj('msg_01.txt') - it = iterators.body_line_iterator(msg) - lines = list(it) - eq(len(lines), 6) - neq(EMPTYSTRING.join(lines), msg.get_payload()) - # Now a more complicated multipart - msg = self._msgobj('msg_02.txt') - it = iterators.body_line_iterator(msg) - lines = list(it) - eq(len(lines), 43) - fp = openfile('msg_19.txt') - try: - neq(EMPTYSTRING.join(lines), fp.read()) - finally: - fp.close() - - def test_typed_subpart_iterator(self): - eq = self.assertEqual - msg = self._msgobj('msg_04.txt') - it = iterators.typed_subpart_iterator(msg, 'text') - lines = [] - subparts = 0 - for subpart in it: - subparts += 1 - lines.append(subpart.get_payload()) - eq(subparts, 2) - eq(EMPTYSTRING.join(lines), """\ -a simple kind of mirror -to reflect upon our own -a simple kind of mirror -to reflect upon our own -""") - - def test_typed_subpart_iterator_default_type(self): - eq = self.assertEqual - msg = self._msgobj('msg_03.txt') - it = iterators.typed_subpart_iterator(msg, 'text', 'plain') - lines = [] - subparts = 0 - for subpart in it: - subparts += 1 - lines.append(subpart.get_payload()) - eq(subparts, 1) - eq(EMPTYSTRING.join(lines), """\ - -Hi, - -Do you like this message? - --Me -""") - - - -class TestParsers(TestEmailBase): - def test_header_parser(self): - eq = self.assertEqual - # Parse only the headers of a complex multipart MIME document - fp = openfile('msg_02.txt') - try: - msg = HeaderParser().parse(fp) - finally: - fp.close() - eq(msg['from'], 'ppp-request@zzz.org') - eq(msg['to'], 'ppp@zzz.org') - eq(msg.get_content_type(), 'multipart/mixed') - self.failIf(msg.is_multipart()) - self.failUnless(isinstance(msg.get_payload(), str)) - - def test_whitespace_continuation(self): - eq = self.assertEqual - # This message contains a line after the Subject: header that has only - # whitespace, but it is not empty! - msg = email.message_from_string("""\ -From: aperson@dom.ain -To: bperson@dom.ain -Subject: the next line has a space on it -\x20 -Date: Mon, 8 Apr 2002 15:09:19 -0400 -Message-ID: spam - -Here's the message body -""") - eq(msg['subject'], 'the next line has a space on it\n ') - eq(msg['message-id'], 'spam') - eq(msg.get_payload(), "Here's the message body\n") - - def test_whitespace_continuation_last_header(self): - eq = self.assertEqual - # Like the previous test, but the subject line is the last - # header. - msg = email.message_from_string("""\ -From: aperson@dom.ain -To: bperson@dom.ain -Date: Mon, 8 Apr 2002 15:09:19 -0400 -Message-ID: spam -Subject: the next line has a space on it -\x20 - -Here's the message body -""") - eq(msg['subject'], 'the next line has a space on it\n ') - eq(msg['message-id'], 'spam') - eq(msg.get_payload(), "Here's the message body\n") - - def test_crlf_separation(self): - eq = self.assertEqual - fp = openfile('msg_26.txt', mode='rb') - try: - msg = Parser().parse(fp) - finally: - fp.close() - eq(len(msg.get_payload()), 2) - part1 = msg.get_payload(0) - eq(part1.get_content_type(), 'text/plain') - eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') - part2 = msg.get_payload(1) - eq(part2.get_content_type(), 'application/riscos') - - def test_multipart_digest_with_extra_mime_headers(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - fp = openfile('msg_28.txt') - try: - msg = email.message_from_file(fp) - finally: - fp.close() - # Structure is: - # multipart/digest - # message/rfc822 - # text/plain - # message/rfc822 - # text/plain - eq(msg.is_multipart(), 1) - eq(len(msg.get_payload()), 2) - part1 = msg.get_payload(0) - eq(part1.get_content_type(), 'message/rfc822') - eq(part1.is_multipart(), 1) - eq(len(part1.get_payload()), 1) - part1a = part1.get_payload(0) - eq(part1a.is_multipart(), 0) - eq(part1a.get_content_type(), 'text/plain') - neq(part1a.get_payload(), 'message 1\n') - # next message/rfc822 - part2 = msg.get_payload(1) - eq(part2.get_content_type(), 'message/rfc822') - eq(part2.is_multipart(), 1) - eq(len(part2.get_payload()), 1) - part2a = part2.get_payload(0) - eq(part2a.is_multipart(), 0) - eq(part2a.get_content_type(), 'text/plain') - neq(part2a.get_payload(), 'message 2\n') - - def test_three_lines(self): - # A bug report by Andrew McNamara - lines = ['From: Andrew Person <aperson@dom.ain', - 'Subject: Test', - 'Date: Tue, 20 Aug 2002 16:43:45 +1000'] - msg = email.message_from_string(NL.join(lines)) - self.assertEqual(msg['date'], 'Tue, 20 Aug 2002 16:43:45 +1000') - - def test_strip_line_feed_and_carriage_return_in_headers(self): - eq = self.assertEqual - # For [ 1002475 ] email message parser doesn't handle \r\n correctly - value1 = 'text' - value2 = 'more text' - m = 'Header: %s\r\nNext-Header: %s\r\n\r\nBody\r\n\r\n' % ( - value1, value2) - msg = email.message_from_string(m) - eq(msg.get('Header'), value1) - eq(msg.get('Next-Header'), value2) - - def test_rfc2822_header_syntax(self): - eq = self.assertEqual - m = '>From: foo\nFrom: bar\n!"#QUX;~: zoo\n\nbody' - msg = email.message_from_string(m) - eq(len(msg.keys()), 3) - keys = msg.keys() - keys.sort() - eq(keys, ['!"#QUX;~', '>From', 'From']) - eq(msg.get_payload(), 'body') - - def test_rfc2822_space_not_allowed_in_header(self): - eq = self.assertEqual - m = '>From foo@example.com 11:25:53\nFrom: bar\n!"#QUX;~: zoo\n\nbody' - msg = email.message_from_string(m) - eq(len(msg.keys()), 0) - - def test_rfc2822_one_character_header(self): - eq = self.assertEqual - m = 'A: first header\nB: second header\nCC: third header\n\nbody' - msg = email.message_from_string(m) - headers = msg.keys() - headers.sort() - eq(headers, ['A', 'B', 'CC']) - eq(msg.get_payload(), 'body') - - - -class TestBase64(unittest.TestCase): - def test_len(self): - eq = self.assertEqual - eq(base64mime.base64_len('hello'), - len(base64mime.encode('hello', eol=''))) - for size in range(15): - if size == 0 : bsize = 0 - elif size <= 3 : bsize = 4 - elif size <= 6 : bsize = 8 - elif size <= 9 : bsize = 12 - elif size <= 12: bsize = 16 - else : bsize = 20 - eq(base64mime.base64_len('x'*size), bsize) - - def test_decode(self): - eq = self.assertEqual - eq(base64mime.decode(''), '') - eq(base64mime.decode('aGVsbG8='), 'hello') - eq(base64mime.decode('aGVsbG8=', 'X'), 'hello') - eq(base64mime.decode('aGVsbG8NCndvcmxk\n', 'X'), 'helloXworld') - - def test_encode(self): - eq = self.assertEqual - eq(base64mime.encode(''), '') - eq(base64mime.encode('hello'), 'aGVsbG8=\n') - # Test the binary flag - eq(base64mime.encode('hello\n'), 'aGVsbG8K\n') - eq(base64mime.encode('hello\n', 0), 'aGVsbG8NCg==\n') - # Test the maxlinelen arg - eq(base64mime.encode('xxxx ' * 20, maxlinelen=40), """\ -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg -eHh4eCB4eHh4IA== -""") - # Test the eol argument - eq(base64mime.encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r -eHh4eCB4eHh4IA==\r -""") - - def test_header_encode(self): - eq = self.assertEqual - he = base64mime.header_encode - eq(he('hello'), '=?iso-8859-1?b?aGVsbG8=?=') - eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8NCndvcmxk?=') - # Test the charset option - eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=') - # Test the keep_eols flag - eq(he('hello\nworld', keep_eols=True), - '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=') - # Test the maxlinelen argument - eq(he('xxxx ' * 20, maxlinelen=40), """\ -=?iso-8859-1?b?eHh4eCB4eHh4IHh4eHggeHg=?= - =?iso-8859-1?b?eHggeHh4eCB4eHh4IHh4eHg=?= - =?iso-8859-1?b?IHh4eHggeHh4eCB4eHh4IHg=?= - =?iso-8859-1?b?eHh4IHh4eHggeHh4eCB4eHg=?= - =?iso-8859-1?b?eCB4eHh4IHh4eHggeHh4eCA=?= - =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - # Test the eol argument - eq(he('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -=?iso-8859-1?b?eHh4eCB4eHh4IHh4eHggeHg=?=\r - =?iso-8859-1?b?eHggeHh4eCB4eHh4IHh4eHg=?=\r - =?iso-8859-1?b?IHh4eHggeHh4eCB4eHh4IHg=?=\r - =?iso-8859-1?b?eHh4IHh4eHggeHh4eCB4eHg=?=\r - =?iso-8859-1?b?eCB4eHh4IHh4eHggeHh4eCA=?=\r - =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - - - -class TestQuopri(unittest.TestCase): - def setUp(self): - self.hlit = [chr(x) for x in range(ord('a'), ord('z')+1)] + \ - [chr(x) for x in range(ord('A'), ord('Z')+1)] + \ - [chr(x) for x in range(ord('0'), ord('9')+1)] + \ - ['!', '*', '+', '-', '/', ' '] - self.hnon = [chr(x) for x in range(256) if chr(x) not in self.hlit] - assert len(self.hlit) + len(self.hnon) == 256 - self.blit = [chr(x) for x in range(ord(' '), ord('~')+1)] + ['\t'] - self.blit.remove('=') - self.bnon = [chr(x) for x in range(256) if chr(x) not in self.blit] - assert len(self.blit) + len(self.bnon) == 256 - - def test_header_quopri_check(self): - for c in self.hlit: - self.failIf(quoprimime.header_quopri_check(c)) - for c in self.hnon: - self.failUnless(quoprimime.header_quopri_check(c)) - - def test_body_quopri_check(self): - for c in self.blit: - self.failIf(quoprimime.body_quopri_check(c)) - for c in self.bnon: - self.failUnless(quoprimime.body_quopri_check(c)) - - def test_header_quopri_len(self): - eq = self.assertEqual - hql = quoprimime.header_quopri_len - enc = quoprimime.header_encode - for s in ('hello', 'h@e@l@l@o@'): - # Empty charset and no line-endings. 7 == RFC chrome - eq(hql(s), len(enc(s, charset='', eol=''))-7) - for c in self.hlit: - eq(hql(c), 1) - for c in self.hnon: - eq(hql(c), 3) - - def test_body_quopri_len(self): - eq = self.assertEqual - bql = quoprimime.body_quopri_len - for c in self.blit: - eq(bql(c), 1) - for c in self.bnon: - eq(bql(c), 3) - - def test_quote_unquote_idempotent(self): - for x in range(256): - c = chr(x) - self.assertEqual(quoprimime.unquote(quoprimime.quote(c)), c) - - def test_header_encode(self): - eq = self.assertEqual - he = quoprimime.header_encode - eq(he('hello'), '=?iso-8859-1?q?hello?=') - eq(he('hello\nworld'), '=?iso-8859-1?q?hello=0D=0Aworld?=') - # Test the charset option - eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?q?hello?=') - # Test the keep_eols flag - eq(he('hello\nworld', keep_eols=True), '=?iso-8859-1?q?hello=0Aworld?=') - # Test a non-ASCII character - eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') - # Test the maxlinelen argument - eq(he('xxxx ' * 20, maxlinelen=40), """\ -=?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xx?= - =?iso-8859-1?q?xx_xxxx_xxxx_xxxx_xxxx?= - =?iso-8859-1?q?_xxxx_xxxx_xxxx_xxxx_x?= - =?iso-8859-1?q?xxx_xxxx_xxxx_xxxx_xxx?= - =?iso-8859-1?q?x_xxxx_xxxx_?=""") - # Test the eol argument - eq(he('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -=?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xx?=\r - =?iso-8859-1?q?xx_xxxx_xxxx_xxxx_xxxx?=\r - =?iso-8859-1?q?_xxxx_xxxx_xxxx_xxxx_x?=\r - =?iso-8859-1?q?xxx_xxxx_xxxx_xxxx_xxx?=\r - =?iso-8859-1?q?x_xxxx_xxxx_?=""") - - def test_decode(self): - eq = self.assertEqual - eq(quoprimime.decode(''), '') - eq(quoprimime.decode('hello'), 'hello') - eq(quoprimime.decode('hello', 'X'), 'hello') - eq(quoprimime.decode('hello\nworld', 'X'), 'helloXworld') - - def test_encode(self): - eq = self.assertEqual - eq(quoprimime.encode(''), '') - eq(quoprimime.encode('hello'), 'hello') - # Test the binary flag - eq(quoprimime.encode('hello\r\nworld'), 'hello\nworld') - eq(quoprimime.encode('hello\r\nworld', 0), 'hello\nworld') - # Test the maxlinelen arg - eq(quoprimime.encode('xxxx ' * 20, maxlinelen=40), """\ -xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx= - xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx= -x xxxx xxxx xxxx xxxx=20""") - # Test the eol argument - eq(quoprimime.encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ -xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=\r - xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=\r -x xxxx xxxx xxxx xxxx=20""") - eq(quoprimime.encode("""\ -one line - -two line"""), """\ -one line - -two line""") - - - -# Test the Charset class -class TestCharset(unittest.TestCase): - def tearDown(self): - from email import charset as CharsetModule - try: - del CharsetModule.CHARSETS['fake'] - except KeyError: - pass - - def test_idempotent(self): - eq = self.assertEqual - # Make sure us-ascii = no Unicode conversion - c = Charset('us-ascii') - s = 'Hello World!' - sp = c.to_splittable(s) - eq(s, c.from_splittable(sp)) - # test 8-bit idempotency with us-ascii - s = '\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa' - sp = c.to_splittable(s) - eq(s, c.from_splittable(sp)) - - def test_body_encode(self): - eq = self.assertEqual - # Try a charset with QP body encoding - c = Charset('iso-8859-1') - eq('hello w=F6rld', c.body_encode('hello w\xf6rld')) - # Try a charset with Base64 body encoding - c = Charset('utf-8') - eq('aGVsbG8gd29ybGQ=\n', c.body_encode('hello world')) - # Try a charset with None body encoding - c = Charset('us-ascii') - eq('hello world', c.body_encode('hello world')) - # Try the convert argument, where input codec <> output codec - c = Charset('euc-jp') - # With apologies to Tokio Kikuchi ;) - try: - eq('\x1b$B5FCO;~IW\x1b(B', - c.body_encode('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7')) - eq('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7', - c.body_encode('\xb5\xc6\xc3\xcf\xbb\xfe\xc9\xd7', False)) - except LookupError: - # We probably don't have the Japanese codecs installed - pass - # Testing SF bug #625509, which we have to fake, since there are no - # built-in encodings where the header encoding is QP but the body - # encoding is not. - from email import charset as CharsetModule - CharsetModule.add_charset('fake', CharsetModule.QP, None) - c = Charset('fake') - eq('hello w\xf6rld', c.body_encode('hello w\xf6rld')) - - def test_unicode_charset_name(self): - charset = Charset(u'us-ascii') - self.assertEqual(str(charset), 'us-ascii') - self.assertRaises(errors.CharsetError, Charset, 'asc\xffii') - - - -# Test multilingual MIME headers. -class TestHeader(TestEmailBase): - def test_simple(self): - eq = self.ndiffAssertEqual - h = Header('Hello World!') - eq(h.encode(), 'Hello World!') - h.append(' Goodbye World!') - eq(h.encode(), 'Hello World! Goodbye World!') - - def test_simple_surprise(self): - eq = self.ndiffAssertEqual - h = Header('Hello World!') - eq(h.encode(), 'Hello World!') - h.append('Goodbye World!') - eq(h.encode(), 'Hello World! Goodbye World!') - - def test_header_needs_no_decoding(self): - h = 'no decoding needed' - self.assertEqual(decode_header(h), [(h, None)]) - - def test_long(self): - h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", - maxlinelen=76) - for l in h.encode(splitchars=' ').split('\n '): - self.failUnless(len(l) <= 76) - - def test_multilingual(self): - eq = self.ndiffAssertEqual - g = Charset("iso-8859-1") - cz = Charset("iso-8859-2") - utf8 = Charset("utf-8") - g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " - cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") - h = Header(g_head, g) - h.append(cz_head, cz) - h.append(utf8_head, utf8) - enc = h.encode() - eq(enc, """\ -=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= - =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wan?= - =?iso-8859-1?q?dgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef=F6?= - =?iso-8859-1?q?rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutily?= - =?iso-8859-2?q?_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?= - =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC?= - =?utf-8?b?5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn?= - =?utf-8?b?44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFz?= - =?utf-8?q?_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_die_Fl?= - =?utf-8?b?aXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBo+OBpuOBhOOBvuOBmQ==?= - =?utf-8?b?44CC?=""") - eq(decode_header(enc), - [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), - (utf8_head, "utf-8")]) - ustr = unicode(h) - eq(ustr.encode('utf-8'), - 'Die Mieter treten hier ein werden mit einem Foerderband ' - 'komfortabel den Korridor entlang, an s\xc3\xbcdl\xc3\xbcndischen ' - 'Wandgem\xc3\xa4lden vorbei, gegen die rotierenden Klingen ' - 'bef\xc3\xb6rdert. Finan\xc4\x8dni metropole se hroutily pod ' - 'tlakem jejich d\xc5\xafvtipu.. \xe6\xad\xa3\xe7\xa2\xba\xe3\x81' - '\xab\xe8\xa8\x80\xe3\x81\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3' - '\xe3\x81\xaf\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3' - '\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' - '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8\xaa\x9e' - '\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81\xe3\x81\x82\xe3' - '\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81\x9f\xe3\x82\x89\xe3\x82' - '\x81\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\xe5\xae\x9f\xe9\x9a\x9b' - '\xe3\x81\xab\xe3\x81\xaf\xe3\x80\x8cWenn ist das Nunstuck git ' - 'und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt ' - 'gersput.\xe3\x80\x8d\xe3\x81\xa8\xe8\xa8\x80\xe3\x81\xa3\xe3\x81' - '\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82') - # Test make_header() - newh = make_header(decode_header(enc)) - eq(newh, enc) - - def test_header_ctor_default_args(self): - eq = self.ndiffAssertEqual - h = Header() - eq(h, '') - h.append('foo', Charset('iso-8859-1')) - eq(h, '=?iso-8859-1?q?foo?=') - - def test_explicit_maxlinelen(self): - eq = self.ndiffAssertEqual - hstr = 'A very long line that must get split to something other than at the 76th character boundary to test the non-default behavior' - h = Header(hstr) - eq(h.encode(), '''\ -A very long line that must get split to something other than at the 76th - character boundary to test the non-default behavior''') - h = Header(hstr, header_name='Subject') - eq(h.encode(), '''\ -A very long line that must get split to something other than at the - 76th character boundary to test the non-default behavior''') - h = Header(hstr, maxlinelen=1024, header_name='Subject') - eq(h.encode(), hstr) - - def test_us_ascii_header(self): - eq = self.assertEqual - s = 'hello' - x = decode_header(s) - eq(x, [('hello', None)]) - h = make_header(x) - eq(s, h.encode()) - - def test_string_charset(self): - eq = self.assertEqual - h = Header() - h.append('hello', 'iso-8859-1') - eq(h, '=?iso-8859-1?q?hello?=') - -## def test_unicode_error(self): -## raises = self.assertRaises -## raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii') -## h = Header() -## raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii') -## raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1') - - def test_utf8_shortest(self): - eq = self.assertEqual - h = Header(u'p\xf6stal', 'utf-8') - eq(h.encode(), '=?utf-8?q?p=C3=B6stal?=') - h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8') - eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=') - - def test_bad_8bit_header(self): - raises = self.assertRaises - eq = self.assertEqual - x = 'Ynwp4dUEbay Auction Semiar- No Charge \x96 Earn Big' - raises(UnicodeError, Header, x) - h = Header() - raises(UnicodeError, h.append, x) - eq(str(Header(x, errors='replace')), x) - h.append(x, errors='replace') - eq(str(h), x) - - def test_encoded_adjacent_nonencoded(self): - eq = self.assertEqual - h = Header() - h.append('hello', 'iso-8859-1') - h.append('world') - s = h.encode() - eq(s, '=?iso-8859-1?q?hello?= world') - h = make_header(decode_header(s)) - eq(h.encode(), s) - - def test_whitespace_eater(self): - eq = self.assertEqual - s = 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.' - parts = decode_header(s) - eq(parts, [('Subject:', None), ('\xf0\xd2\xcf\xd7\xc5\xd2\xcb\xc1 \xce\xc1 \xc6\xc9\xce\xc1\xcc\xd8\xce\xd9\xca', 'koi8-r'), ('zz.', None)]) - hdr = make_header(parts) - eq(hdr.encode(), - 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.') - - def test_broken_base64_header(self): - raises = self.assertRaises - s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?=' - raises(errors.HeaderParseError, decode_header, s) - - - -# Test RFC 2231 header parameters (en/de)coding -class TestRFC2231(TestEmailBase): - def test_get_param(self): - eq = self.assertEqual - msg = self._msgobj('msg_29.txt') - eq(msg.get_param('title'), - ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) - eq(msg.get_param('title', unquote=False), - ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) - - def test_set_param(self): - eq = self.assertEqual - msg = Message() - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii') - eq(msg.get_param('title'), - ('us-ascii', '', 'This is even more ***fun*** isn\'t it!')) - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - eq(msg.get_param('title'), - ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) - msg = self._msgobj('msg_01.txt') - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - eq(msg.as_string(), """\ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) -\tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 -Content-Type: text/plain; charset=us-ascii; -\ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" - - -Hi, - -Do you like this message? - --Me -""") - - def test_del_param(self): - eq = self.ndiffAssertEqual - msg = self._msgobj('msg_01.txt') - msg.set_param('foo', 'bar', charset='us-ascii', language='en') - msg.set_param('title', 'This is even more ***fun*** isn\'t it!', - charset='us-ascii', language='en') - msg.del_param('foo', header='Content-Type') - eq(msg.as_string(), """\ -Return-Path: <bbb@zzz.org> -Delivered-To: bbb@zzz.org -Received: by mail.zzz.org (Postfix, from userid 889) -\tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Message-ID: <15090.61304.110929.45684@aaa.zzz.org> -From: bbb@ddd.com (John X. Doe) -To: bbb@zzz.org -Subject: This is a test message -Date: Fri, 4 May 2001 14:05:44 -0400 -Content-Type: text/plain; charset="us-ascii"; -\ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" - - -Hi, - -Do you like this message? - --Me -""") - - def test_rfc2231_get_content_charset(self): - eq = self.assertEqual - msg = self._msgobj('msg_32.txt') - eq(msg.get_content_charset(), 'us-ascii') - - def test_rfc2231_no_language_or_charset(self): - m = '''\ -Content-Transfer-Encoding: 8bit -Content-Disposition: inline; filename="file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm" -Content-Type: text/html; NAME*0=file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEM; NAME*1=P_nsmail.htm - -''' - msg = email.message_from_string(m) - param = msg.get_param('NAME') - self.failIf(isinstance(param, tuple)) - self.assertEqual( - param, - 'file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm') - - def test_rfc2231_no_language_or_charset_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_filename_encoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_partly_encoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0="''This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual( - msg.get_filename(), - 'This%20is%20even%20more%20***fun*** is it not.pdf') - - def test_rfc2231_partly_nonencoded(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0="This%20is%20even%20more%20"; -\tfilename*1="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual( - msg.get_filename(), - 'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_boundary(self): - m = '''\ -Content-Type: multipart/alternative; -\tboundary*0*="''This%20is%20even%20more%20"; -\tboundary*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tboundary*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_boundary(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_no_language_or_charset_in_charset(self): - # This is a nonsensical charset value, but tests the code anyway - m = '''\ -Content-Type: text/plain; -\tcharset*0*="This%20is%20even%20more%20"; -\tcharset*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tcharset*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_content_charset(), - 'this is even more ***fun*** is it not.pdf') - - def test_rfc2231_bad_encoding_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="bogus'xx'This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2="is it not.pdf" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - 'This is even more ***fun*** is it not.pdf') - - def test_rfc2231_bad_encoding_in_charset(self): - m = """\ -Content-Type: text/plain; charset*=bogus''utf-8%E2%80%9D - -""" - msg = email.message_from_string(m) - # This should return None because non-ascii characters in the charset - # are not allowed. - self.assertEqual(msg.get_content_charset(), None) - - def test_rfc2231_bad_character_in_charset(self): - m = """\ -Content-Type: text/plain; charset*=ascii''utf-8%E2%80%9D - -""" - msg = email.message_from_string(m) - # This should return None because non-ascii characters in the charset - # are not allowed. - self.assertEqual(msg.get_content_charset(), None) - - def test_rfc2231_bad_character_in_filename(self): - m = '''\ -Content-Disposition: inline; -\tfilename*0*="ascii'xx'This%20is%20even%20more%20"; -\tfilename*1*="%2A%2A%2Afun%2A%2A%2A%20"; -\tfilename*2*="is it not.pdf%E2" - -''' - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), - u'This is even more ***fun*** is it not.pdf\ufffd') - - def test_rfc2231_unknown_encoding(self): - m = """\ -Content-Transfer-Encoding: 8bit -Content-Disposition: inline; filename*=X-UNKNOWN''myfile.txt - -""" - msg = email.message_from_string(m) - self.assertEqual(msg.get_filename(), 'myfile.txt') - - def test_rfc2231_single_tick_in_filename_extended(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"Frank's\"; name*1*=\" Document\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, None) - eq(language, None) - eq(s, "Frank's Document") - - def test_rfc2231_single_tick_in_filename(self): - m = """\ -Content-Type: application/x-foo; name*0=\"Frank's\"; name*1=\" Document\" - -""" - msg = email.message_from_string(m) - param = msg.get_param('name') - self.failIf(isinstance(param, tuple)) - self.assertEqual(param, "Frank's Document") - - def test_rfc2231_tick_attack_extended(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"us-ascii'en-us'Frank's\"; name*1*=\" Document\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, "Frank's Document") - - def test_rfc2231_tick_attack(self): - m = """\ -Content-Type: application/x-foo; -\tname*0=\"us-ascii'en-us'Frank's\"; name*1=\" Document\" - -""" - msg = email.message_from_string(m) - param = msg.get_param('name') - self.failIf(isinstance(param, tuple)) - self.assertEqual(param, "us-ascii'en-us'Frank's Document") - - def test_rfc2231_no_extended_values(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; name=\"Frank's Document\" - -""" - msg = email.message_from_string(m) - eq(msg.get_param('name'), "Frank's Document") - - def test_rfc2231_encoded_then_unencoded_segments(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0*=\"us-ascii'en-us'My\"; -\tname*1=\" Document\"; -\tname*2*=\" For You\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, 'My Document For You') - - def test_rfc2231_unencoded_then_encoded_segments(self): - eq = self.assertEqual - m = """\ -Content-Type: application/x-foo; -\tname*0=\"us-ascii'en-us'My\"; -\tname*1*=\" Document\"; -\tname*2*=\" For You\" - -""" - msg = email.message_from_string(m) - charset, language, s = msg.get_param('name') - eq(charset, 'us-ascii') - eq(language, 'en-us') - eq(s, 'My Document For You') - - - -def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - - -def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - - -def test_main(): - for testclass in _testclasses(): - run_unittest(testclass) - - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/email/test/test_email_torture.py b/sys/lib/python/email/test/test_email_torture.py deleted file mode 100644 index d708b74f9..000000000 --- a/sys/lib/python/email/test/test_email_torture.py +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2002-2004 Python Software Foundation -# -# A torture test of the email package. This should not be run as part of the -# standard Python test suite since it requires several meg of email messages -# collected in the wild. These source messages are not checked into the -# Python distro, but are available as part of the standalone email package at -# http://sf.net/projects/mimelib - -import sys -import os -import unittest -from cStringIO import StringIO -from types import ListType - -from email.test.test_email import TestEmailBase -from test.test_support import TestSkipped - -import email -from email import __file__ as testfile -from email.Iterators import _structure - -def openfile(filename): - from os.path import join, dirname, abspath - path = abspath(join(dirname(testfile), os.pardir, 'moredata', filename)) - return open(path, 'r') - -# Prevent this test from running in the Python distro -try: - openfile('crispin-torture.txt') -except IOError: - raise TestSkipped - - - -class TortureBase(TestEmailBase): - def _msgobj(self, filename): - fp = openfile(filename) - try: - msg = email.message_from_file(fp) - finally: - fp.close() - return msg - - - -class TestCrispinTorture(TortureBase): - # Mark Crispin's torture test from the SquirrelMail project - def test_mondo_message(self): - eq = self.assertEqual - neq = self.ndiffAssertEqual - msg = self._msgobj('crispin-torture.txt') - payload = msg.get_payload() - eq(type(payload), ListType) - eq(len(payload), 12) - eq(msg.preamble, None) - eq(msg.epilogue, '\n') - # Probably the best way to verify the message is parsed correctly is to - # dump its structure and compare it against the known structure. - fp = StringIO() - _structure(msg, fp=fp) - neq(fp.getvalue(), """\ -multipart/mixed - text/plain - message/rfc822 - multipart/alternative - text/plain - multipart/mixed - text/richtext - application/andrew-inset - message/rfc822 - audio/basic - audio/basic - image/pbm - message/rfc822 - multipart/mixed - multipart/mixed - text/plain - audio/x-sun - multipart/mixed - image/gif - image/gif - application/x-be2 - application/atomicmail - audio/x-sun - message/rfc822 - multipart/mixed - text/plain - image/pgm - text/plain - message/rfc822 - multipart/mixed - text/plain - image/pbm - message/rfc822 - application/postscript - image/gif - message/rfc822 - multipart/mixed - audio/basic - audio/basic - message/rfc822 - multipart/mixed - application/postscript - text/plain - message/rfc822 - multipart/mixed - text/plain - multipart/parallel - image/gif - audio/basic - application/atomicmail - message/rfc822 - audio/x-sun -""") - - -def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - - -def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - - -def test_main(): - for testclass in _testclasses(): - test_support.run_unittest(testclass) - - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/plat-mac/Audio_mac.py b/sys/lib/python/plat-mac/Audio_mac.py deleted file mode 100644 index fd96095ad..000000000 --- a/sys/lib/python/plat-mac/Audio_mac.py +++ /dev/null @@ -1,121 +0,0 @@ -QSIZE = 100000 -error='Audio_mac.error' - -class Play_Audio_mac: - - def __init__(self, qsize=QSIZE): - self._chan = None - self._qsize = qsize - self._outrate = 22254 - self._sampwidth = 1 - self._nchannels = 1 - self._gc = [] - self._usercallback = None - - def __del__(self): - self.stop() - self._usercallback = None - - def wait(self): - import time - while self.getfilled(): - time.sleep(0.1) - self._chan = None - self._gc = [] - - def stop(self, quietNow = 1): - ##chan = self._chan - self._chan = None - ##chan.SndDisposeChannel(1) - self._gc = [] - - def setoutrate(self, outrate): - self._outrate = outrate - - def setsampwidth(self, sampwidth): - self._sampwidth = sampwidth - - def setnchannels(self, nchannels): - self._nchannels = nchannels - - def writeframes(self, data): - import time - from Carbon.Sound import bufferCmd, callBackCmd, extSH - import struct - import MacOS - if not self._chan: - from Carbon import Snd - self._chan = Snd.SndNewChannel(5, 0, self._callback) - nframes = len(data) / self._nchannels / self._sampwidth - if len(data) != nframes * self._nchannels * self._sampwidth: - raise error, 'data is not a whole number of frames' - while self._gc and \ - self.getfilled() + nframes > \ - self._qsize / self._nchannels / self._sampwidth: - time.sleep(0.1) - if self._sampwidth == 1: - import audioop - data = audioop.add(data, '\x80'*len(data), 1) - h1 = struct.pack('llHhllbbl', - id(data)+MacOS.string_id_to_buffer, - self._nchannels, - self._outrate, 0, - 0, - 0, - extSH, - 60, - nframes) - h2 = 22*'\0' - h3 = struct.pack('hhlll', - self._sampwidth*8, - 0, - 0, - 0, - 0) - header = h1+h2+h3 - self._gc.append((header, data)) - self._chan.SndDoCommand((bufferCmd, 0, header), 0) - self._chan.SndDoCommand((callBackCmd, 0, 0), 0) - - def _callback(self, *args): - del self._gc[0] - if self._usercallback: - self._usercallback() - - def setcallback(self, callback): - self._usercallback = callback - - def getfilled(self): - filled = 0 - for header, data in self._gc: - filled = filled + len(data) - return filled / self._nchannels / self._sampwidth - - def getfillable(self): - return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled() - - def ulaw2lin(self, data): - import audioop - return audioop.ulaw2lin(data, 2) - -def test(): - import aifc - import EasyDialogs - fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",)) - if not fn: return - af = aifc.open(fn, 'r') - print af.getparams() - p = Play_Audio_mac() - p.setoutrate(af.getframerate()) - p.setsampwidth(af.getsampwidth()) - p.setnchannels(af.getnchannels()) - BUFSIZ = 10000 - while 1: - data = af.readframes(BUFSIZ) - if not data: break - p.writeframes(data) - print 'wrote', len(data), 'space', p.getfillable() - p.wait() - -if __name__ == '__main__': - test() diff --git a/sys/lib/python/plat-mac/Carbon/AE.py b/sys/lib/python/plat-mac/Carbon/AE.py deleted file mode 100644 index 0f4601773..000000000 --- a/sys/lib/python/plat-mac/Carbon/AE.py +++ /dev/null @@ -1 +0,0 @@ -from _AE import * diff --git a/sys/lib/python/plat-mac/Carbon/AH.py b/sys/lib/python/plat-mac/Carbon/AH.py deleted file mode 100644 index 0701e7bd8..000000000 --- a/sys/lib/python/plat-mac/Carbon/AH.py +++ /dev/null @@ -1 +0,0 @@ -from _AH import * diff --git a/sys/lib/python/plat-mac/Carbon/Alias.py b/sys/lib/python/plat-mac/Carbon/Alias.py deleted file mode 100644 index cb612a66b..000000000 --- a/sys/lib/python/plat-mac/Carbon/Alias.py +++ /dev/null @@ -1 +0,0 @@ -from _Alias import * diff --git a/sys/lib/python/plat-mac/Carbon/Aliases.py b/sys/lib/python/plat-mac/Carbon/Aliases.py deleted file mode 100644 index 55e1a1f5a..000000000 --- a/sys/lib/python/plat-mac/Carbon/Aliases.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated from 'Aliases.h' - -def FOUR_CHAR_CODE(x): return x -true = True -false = False -rAliasType = FOUR_CHAR_CODE('alis') -kARMMountVol = 0x00000001 -kARMNoUI = 0x00000002 -kARMMultVols = 0x00000008 -kARMSearch = 0x00000100 -kARMSearchMore = 0x00000200 -kARMSearchRelFirst = 0x00000400 -asiZoneName = -3 -asiServerName = -2 -asiVolumeName = -1 -asiAliasName = 0 -asiParentName = 1 -kResolveAliasFileNoUI = 0x00000001 diff --git a/sys/lib/python/plat-mac/Carbon/App.py b/sys/lib/python/plat-mac/Carbon/App.py deleted file mode 100644 index cc0d46d5d..000000000 --- a/sys/lib/python/plat-mac/Carbon/App.py +++ /dev/null @@ -1 +0,0 @@ -from _App import * diff --git a/sys/lib/python/plat-mac/Carbon/Appearance.py b/sys/lib/python/plat-mac/Carbon/Appearance.py deleted file mode 100644 index d99c6dce0..000000000 --- a/sys/lib/python/plat-mac/Carbon/Appearance.py +++ /dev/null @@ -1,648 +0,0 @@ -# Generated from 'Appearance.h' - -def FOUR_CHAR_CODE(x): return x -kAppearanceEventClass = FOUR_CHAR_CODE('appr') -kAEAppearanceChanged = FOUR_CHAR_CODE('thme') -kAESystemFontChanged = FOUR_CHAR_CODE('sysf') -kAESmallSystemFontChanged = FOUR_CHAR_CODE('ssfn') -kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt') -kThemeDataFileType = FOUR_CHAR_CODE('thme') -kThemePlatinumFileType = FOUR_CHAR_CODE('pltn') -kThemeCustomThemesFileType = FOUR_CHAR_CODE('scen') -kThemeSoundTrackFileType = FOUR_CHAR_CODE('tsnd') -kThemeBrushDialogBackgroundActive = 1 -kThemeBrushDialogBackgroundInactive = 2 -kThemeBrushAlertBackgroundActive = 3 -kThemeBrushAlertBackgroundInactive = 4 -kThemeBrushModelessDialogBackgroundActive = 5 -kThemeBrushModelessDialogBackgroundInactive = 6 -kThemeBrushUtilityWindowBackgroundActive = 7 -kThemeBrushUtilityWindowBackgroundInactive = 8 -kThemeBrushListViewSortColumnBackground = 9 -kThemeBrushListViewBackground = 10 -kThemeBrushIconLabelBackground = 11 -kThemeBrushListViewSeparator = 12 -kThemeBrushChasingArrows = 13 -kThemeBrushDragHilite = 14 -kThemeBrushDocumentWindowBackground = 15 -kThemeBrushFinderWindowBackground = 16 -kThemeBrushScrollBarDelimiterActive = 17 -kThemeBrushScrollBarDelimiterInactive = 18 -kThemeBrushFocusHighlight = 19 -kThemeBrushPopupArrowActive = 20 -kThemeBrushPopupArrowPressed = 21 -kThemeBrushPopupArrowInactive = 22 -kThemeBrushAppleGuideCoachmark = 23 -kThemeBrushIconLabelBackgroundSelected = 24 -kThemeBrushStaticAreaFill = 25 -kThemeBrushActiveAreaFill = 26 -kThemeBrushButtonFrameActive = 27 -kThemeBrushButtonFrameInactive = 28 -kThemeBrushButtonFaceActive = 29 -kThemeBrushButtonFaceInactive = 30 -kThemeBrushButtonFacePressed = 31 -kThemeBrushButtonActiveDarkShadow = 32 -kThemeBrushButtonActiveDarkHighlight = 33 -kThemeBrushButtonActiveLightShadow = 34 -kThemeBrushButtonActiveLightHighlight = 35 -kThemeBrushButtonInactiveDarkShadow = 36 -kThemeBrushButtonInactiveDarkHighlight = 37 -kThemeBrushButtonInactiveLightShadow = 38 -kThemeBrushButtonInactiveLightHighlight = 39 -kThemeBrushButtonPressedDarkShadow = 40 -kThemeBrushButtonPressedDarkHighlight = 41 -kThemeBrushButtonPressedLightShadow = 42 -kThemeBrushButtonPressedLightHighlight = 43 -kThemeBrushBevelActiveLight = 44 -kThemeBrushBevelActiveDark = 45 -kThemeBrushBevelInactiveLight = 46 -kThemeBrushBevelInactiveDark = 47 -kThemeBrushNotificationWindowBackground = 48 -kThemeBrushMovableModalBackground = 49 -kThemeBrushSheetBackgroundOpaque = 50 -kThemeBrushDrawerBackground = 51 -kThemeBrushToolbarBackground = 52 -kThemeBrushSheetBackgroundTransparent = 53 -kThemeBrushMenuBackground = 54 -kThemeBrushMenuBackgroundSelected = 55 -kThemeBrushSheetBackground = kThemeBrushSheetBackgroundOpaque -kThemeBrushBlack = -1 -kThemeBrushWhite = -2 -kThemeBrushPrimaryHighlightColor = -3 -kThemeBrushSecondaryHighlightColor = -4 -kThemeTextColorDialogActive = 1 -kThemeTextColorDialogInactive = 2 -kThemeTextColorAlertActive = 3 -kThemeTextColorAlertInactive = 4 -kThemeTextColorModelessDialogActive = 5 -kThemeTextColorModelessDialogInactive = 6 -kThemeTextColorWindowHeaderActive = 7 -kThemeTextColorWindowHeaderInactive = 8 -kThemeTextColorPlacardActive = 9 -kThemeTextColorPlacardInactive = 10 -kThemeTextColorPlacardPressed = 11 -kThemeTextColorPushButtonActive = 12 -kThemeTextColorPushButtonInactive = 13 -kThemeTextColorPushButtonPressed = 14 -kThemeTextColorBevelButtonActive = 15 -kThemeTextColorBevelButtonInactive = 16 -kThemeTextColorBevelButtonPressed = 17 -kThemeTextColorPopupButtonActive = 18 -kThemeTextColorPopupButtonInactive = 19 -kThemeTextColorPopupButtonPressed = 20 -kThemeTextColorIconLabel = 21 -kThemeTextColorListView = 22 -kThemeTextColorDocumentWindowTitleActive = 23 -kThemeTextColorDocumentWindowTitleInactive = 24 -kThemeTextColorMovableModalWindowTitleActive = 25 -kThemeTextColorMovableModalWindowTitleInactive = 26 -kThemeTextColorUtilityWindowTitleActive = 27 -kThemeTextColorUtilityWindowTitleInactive = 28 -kThemeTextColorPopupWindowTitleActive = 29 -kThemeTextColorPopupWindowTitleInactive = 30 -kThemeTextColorRootMenuActive = 31 -kThemeTextColorRootMenuSelected = 32 -kThemeTextColorRootMenuDisabled = 33 -kThemeTextColorMenuItemActive = 34 -kThemeTextColorMenuItemSelected = 35 -kThemeTextColorMenuItemDisabled = 36 -kThemeTextColorPopupLabelActive = 37 -kThemeTextColorPopupLabelInactive = 38 -kThemeTextColorTabFrontActive = 39 -kThemeTextColorTabNonFrontActive = 40 -kThemeTextColorTabNonFrontPressed = 41 -kThemeTextColorTabFrontInactive = 42 -kThemeTextColorTabNonFrontInactive = 43 -kThemeTextColorIconLabelSelected = 44 -kThemeTextColorBevelButtonStickyActive = 45 -kThemeTextColorBevelButtonStickyInactive = 46 -kThemeTextColorNotification = 47 -kThemeTextColorBlack = -1 -kThemeTextColorWhite = -2 -kThemeStateInactive = 0 -kThemeStateActive = 1 -kThemeStatePressed = 2 -kThemeStateRollover = 6 -kThemeStateUnavailable = 7 -kThemeStateUnavailableInactive = 8 -kThemeStateDisabled = 0 -kThemeStatePressedUp = 2 -kThemeStatePressedDown = 3 -kThemeArrowCursor = 0 -kThemeCopyArrowCursor = 1 -kThemeAliasArrowCursor = 2 -kThemeContextualMenuArrowCursor = 3 -kThemeIBeamCursor = 4 -kThemeCrossCursor = 5 -kThemePlusCursor = 6 -kThemeWatchCursor = 7 -kThemeClosedHandCursor = 8 -kThemeOpenHandCursor = 9 -kThemePointingHandCursor = 10 -kThemeCountingUpHandCursor = 11 -kThemeCountingDownHandCursor = 12 -kThemeCountingUpAndDownHandCursor = 13 -kThemeSpinningCursor = 14 -kThemeResizeLeftCursor = 15 -kThemeResizeRightCursor = 16 -kThemeResizeLeftRightCursor = 17 -kThemeMenuBarNormal = 0 -kThemeMenuBarSelected = 1 -kThemeMenuSquareMenuBar = (1 << 0) -kThemeMenuActive = 0 -kThemeMenuSelected = 1 -kThemeMenuDisabled = 3 -kThemeMenuTypePullDown = 0 -kThemeMenuTypePopUp = 1 -kThemeMenuTypeHierarchical = 2 -kThemeMenuTypeInactive = 0x0100 -kThemeMenuItemPlain = 0 -kThemeMenuItemHierarchical = 1 -kThemeMenuItemScrollUpArrow = 2 -kThemeMenuItemScrollDownArrow = 3 -kThemeMenuItemAtTop = 0x0100 -kThemeMenuItemAtBottom = 0x0200 -kThemeMenuItemHierBackground = 0x0400 -kThemeMenuItemPopUpBackground = 0x0800 -kThemeMenuItemHasIcon = 0x8000 -kThemeMenuItemNoBackground = 0x4000 -kThemeBackgroundTabPane = 1 -kThemeBackgroundPlacard = 2 -kThemeBackgroundWindowHeader = 3 -kThemeBackgroundListViewWindowHeader = 4 -kThemeBackgroundSecondaryGroupBox = 5 -kThemeNameTag = FOUR_CHAR_CODE('name') -kThemeVariantNameTag = FOUR_CHAR_CODE('varn') -kThemeVariantBaseTintTag = FOUR_CHAR_CODE('tint') -kThemeHighlightColorTag = FOUR_CHAR_CODE('hcol') -kThemeScrollBarArrowStyleTag = FOUR_CHAR_CODE('sbar') -kThemeScrollBarThumbStyleTag = FOUR_CHAR_CODE('sbth') -kThemeSoundsEnabledTag = FOUR_CHAR_CODE('snds') -kThemeDblClickCollapseTag = FOUR_CHAR_CODE('coll') -kThemeAppearanceFileNameTag = FOUR_CHAR_CODE('thme') -kThemeSystemFontTag = FOUR_CHAR_CODE('lgsf') -kThemeSmallSystemFontTag = FOUR_CHAR_CODE('smsf') -kThemeViewsFontTag = FOUR_CHAR_CODE('vfnt') -kThemeViewsFontSizeTag = FOUR_CHAR_CODE('vfsz') -kThemeDesktopPatternNameTag = FOUR_CHAR_CODE('patn') -kThemeDesktopPatternTag = FOUR_CHAR_CODE('patt') -kThemeDesktopPictureNameTag = FOUR_CHAR_CODE('dpnm') -kThemeDesktopPictureAliasTag = FOUR_CHAR_CODE('dpal') -kThemeDesktopPictureAlignmentTag = FOUR_CHAR_CODE('dpan') -kThemeHighlightColorNameTag = FOUR_CHAR_CODE('hcnm') -kThemeExamplePictureIDTag = FOUR_CHAR_CODE('epic') -kThemeSoundTrackNameTag = FOUR_CHAR_CODE('sndt') -kThemeSoundMaskTag = FOUR_CHAR_CODE('smsk') -kThemeUserDefinedTag = FOUR_CHAR_CODE('user') -kThemeSmoothFontEnabledTag = FOUR_CHAR_CODE('smoo') -kThemeSmoothFontMinSizeTag = FOUR_CHAR_CODE('smos') -kTiledOnScreen = 1 -kCenterOnScreen = 2 -kFitToScreen = 3 -kFillScreen = 4 -kUseBestGuess = 5 -kThemeCheckBoxClassicX = 0 -kThemeCheckBoxCheckMark = 1 -kThemeScrollBarArrowsSingle = 0 -kThemeScrollBarArrowsLowerRight = 1 -kThemeScrollBarThumbNormal = 0 -kThemeScrollBarThumbProportional = 1 -kThemeSystemFont = 0 -kThemeSmallSystemFont = 1 -kThemeSmallEmphasizedSystemFont = 2 -kThemeViewsFont = 3 -kThemeEmphasizedSystemFont = 4 -kThemeApplicationFont = 5 -kThemeLabelFont = 6 -kThemeMenuTitleFont = 100 -kThemeMenuItemFont = 101 -kThemeMenuItemMarkFont = 102 -kThemeMenuItemCmdKeyFont = 103 -kThemeWindowTitleFont = 104 -kThemePushButtonFont = 105 -kThemeUtilityWindowTitleFont = 106 -kThemeAlertHeaderFont = 107 -kThemeCurrentPortFont = 200 -kThemeTabNonFront = 0 -kThemeTabNonFrontPressed = 1 -kThemeTabNonFrontInactive = 2 -kThemeTabFront = 3 -kThemeTabFrontInactive = 4 -kThemeTabNonFrontUnavailable = 5 -kThemeTabFrontUnavailable = 6 -kThemeTabNorth = 0 -kThemeTabSouth = 1 -kThemeTabEast = 2 -kThemeTabWest = 3 -kThemeSmallTabHeight = 16 -kThemeLargeTabHeight = 21 -kThemeTabPaneOverlap = 3 -kThemeSmallTabHeightMax = 19 -kThemeLargeTabHeightMax = 24 -kThemeMediumScrollBar = 0 -kThemeSmallScrollBar = 1 -kThemeMediumSlider = 2 -kThemeMediumProgressBar = 3 -kThemeMediumIndeterminateBar = 4 -kThemeRelevanceBar = 5 -kThemeSmallSlider = 6 -kThemeLargeProgressBar = 7 -kThemeLargeIndeterminateBar = 8 -kThemeTrackActive = 0 -kThemeTrackDisabled = 1 -kThemeTrackNothingToScroll = 2 -kThemeTrackInactive = 3 -kThemeLeftOutsideArrowPressed = 0x01 -kThemeLeftInsideArrowPressed = 0x02 -kThemeLeftTrackPressed = 0x04 -kThemeThumbPressed = 0x08 -kThemeRightTrackPressed = 0x10 -kThemeRightInsideArrowPressed = 0x20 -kThemeRightOutsideArrowPressed = 0x40 -kThemeTopOutsideArrowPressed = kThemeLeftOutsideArrowPressed -kThemeTopInsideArrowPressed = kThemeLeftInsideArrowPressed -kThemeTopTrackPressed = kThemeLeftTrackPressed -kThemeBottomTrackPressed = kThemeRightTrackPressed -kThemeBottomInsideArrowPressed = kThemeRightInsideArrowPressed -kThemeBottomOutsideArrowPressed = kThemeRightOutsideArrowPressed -kThemeThumbPlain = 0 -kThemeThumbUpward = 1 -kThemeThumbDownward = 2 -kThemeTrackHorizontal = (1 << 0) -kThemeTrackRightToLeft = (1 << 1) -kThemeTrackShowThumb = (1 << 2) -kThemeTrackThumbRgnIsNotGhost = (1 << 3) -kThemeTrackNoScrollBarArrows = (1 << 4) -kThemeWindowHasGrow = (1 << 0) -kThemeWindowHasHorizontalZoom = (1 << 3) -kThemeWindowHasVerticalZoom = (1 << 4) -kThemeWindowHasFullZoom = kThemeWindowHasHorizontalZoom + kThemeWindowHasVerticalZoom -kThemeWindowHasCloseBox = (1 << 5) -kThemeWindowHasCollapseBox = (1 << 6) -kThemeWindowHasTitleText = (1 << 7) -kThemeWindowIsCollapsed = (1 << 8) -kThemeWindowHasDirty = (1 << 9) -kThemeDocumentWindow = 0 -kThemeDialogWindow = 1 -kThemeMovableDialogWindow = 2 -kThemeAlertWindow = 3 -kThemeMovableAlertWindow = 4 -kThemePlainDialogWindow = 5 -kThemeShadowDialogWindow = 6 -kThemePopupWindow = 7 -kThemeUtilityWindow = 8 -kThemeUtilitySideWindow = 9 -kThemeSheetWindow = 10 -kThemeDrawerWindow = 11 -kThemeWidgetCloseBox = 0 -kThemeWidgetZoomBox = 1 -kThemeWidgetCollapseBox = 2 -kThemeWidgetDirtyCloseBox = 6 -kThemeArrowLeft = 0 -kThemeArrowDown = 1 -kThemeArrowRight = 2 -kThemeArrowUp = 3 -kThemeArrow3pt = 0 -kThemeArrow5pt = 1 -kThemeArrow7pt = 2 -kThemeArrow9pt = 3 -kThemeGrowLeft = (1 << 0) -kThemeGrowRight = (1 << 1) -kThemeGrowUp = (1 << 2) -kThemeGrowDown = (1 << 3) -kThemePushButton = 0 -kThemeCheckBox = 1 -kThemeRadioButton = 2 -kThemeBevelButton = 3 -kThemeArrowButton = 4 -kThemePopupButton = 5 -kThemeDisclosureButton = 6 -kThemeIncDecButton = 7 -kThemeSmallBevelButton = 8 -kThemeMediumBevelButton = 3 -kThemeLargeBevelButton = 9 -kThemeListHeaderButton = 10 -kThemeRoundButton = 11 -kThemeLargeRoundButton = 12 -kThemeSmallCheckBox = 13 -kThemeSmallRadioButton = 14 -kThemeRoundedBevelButton = 15 -kThemeNormalCheckBox = kThemeCheckBox -kThemeNormalRadioButton = kThemeRadioButton -kThemeButtonOff = 0 -kThemeButtonOn = 1 -kThemeButtonMixed = 2 -kThemeDisclosureRight = 0 -kThemeDisclosureDown = 1 -kThemeDisclosureLeft = 2 -kThemeAdornmentNone = 0 -kThemeAdornmentDefault = (1 << 0) -kThemeAdornmentFocus = (1 << 2) -kThemeAdornmentRightToLeft = (1 << 4) -kThemeAdornmentDrawIndicatorOnly = (1 << 5) -kThemeAdornmentHeaderButtonLeftNeighborSelected = (1 << 6) -kThemeAdornmentHeaderButtonRightNeighborSelected = (1 << 7) -kThemeAdornmentHeaderButtonSortUp = (1 << 8) -kThemeAdornmentHeaderMenuButton = (1 << 9) -kThemeAdornmentHeaderButtonNoShadow = (1 << 10) -kThemeAdornmentHeaderButtonShadowOnly = (1 << 11) -kThemeAdornmentNoShadow = kThemeAdornmentHeaderButtonNoShadow -kThemeAdornmentShadowOnly = kThemeAdornmentHeaderButtonShadowOnly -kThemeAdornmentArrowLeftArrow = (1 << 6) -kThemeAdornmentArrowDownArrow = (1 << 7) -kThemeAdornmentArrowDoubleArrow = (1 << 8) -kThemeAdornmentArrowUpArrow = (1 << 9) -kThemeNoSounds = 0 -kThemeWindowSoundsMask = (1 << 0) -kThemeMenuSoundsMask = (1 << 1) -kThemeControlSoundsMask = (1 << 2) -kThemeFinderSoundsMask = (1 << 3) -kThemeDragSoundNone = 0 -kThemeDragSoundMoveWindow = FOUR_CHAR_CODE('wmov') -kThemeDragSoundGrowWindow = FOUR_CHAR_CODE('wgro') -kThemeDragSoundMoveUtilWindow = FOUR_CHAR_CODE('umov') -kThemeDragSoundGrowUtilWindow = FOUR_CHAR_CODE('ugro') -kThemeDragSoundMoveDialog = FOUR_CHAR_CODE('dmov') -kThemeDragSoundMoveAlert = FOUR_CHAR_CODE('amov') -kThemeDragSoundMoveIcon = FOUR_CHAR_CODE('imov') -kThemeDragSoundSliderThumb = FOUR_CHAR_CODE('slth') -kThemeDragSoundSliderGhost = FOUR_CHAR_CODE('slgh') -kThemeDragSoundScrollBarThumb = FOUR_CHAR_CODE('sbth') -kThemeDragSoundScrollBarGhost = FOUR_CHAR_CODE('sbgh') -kThemeDragSoundScrollBarArrowDecreasing = FOUR_CHAR_CODE('sbad') -kThemeDragSoundScrollBarArrowIncreasing = FOUR_CHAR_CODE('sbai') -kThemeDragSoundDragging = FOUR_CHAR_CODE('drag') -kThemeSoundNone = 0 -kThemeSoundMenuOpen = FOUR_CHAR_CODE('mnuo') -kThemeSoundMenuClose = FOUR_CHAR_CODE('mnuc') -kThemeSoundMenuItemHilite = FOUR_CHAR_CODE('mnui') -kThemeSoundMenuItemRelease = FOUR_CHAR_CODE('mnus') -kThemeSoundWindowClosePress = FOUR_CHAR_CODE('wclp') -kThemeSoundWindowCloseEnter = FOUR_CHAR_CODE('wcle') -kThemeSoundWindowCloseExit = FOUR_CHAR_CODE('wclx') -kThemeSoundWindowCloseRelease = FOUR_CHAR_CODE('wclr') -kThemeSoundWindowZoomPress = FOUR_CHAR_CODE('wzmp') -kThemeSoundWindowZoomEnter = FOUR_CHAR_CODE('wzme') -kThemeSoundWindowZoomExit = FOUR_CHAR_CODE('wzmx') -kThemeSoundWindowZoomRelease = FOUR_CHAR_CODE('wzmr') -kThemeSoundWindowCollapsePress = FOUR_CHAR_CODE('wcop') -kThemeSoundWindowCollapseEnter = FOUR_CHAR_CODE('wcoe') -kThemeSoundWindowCollapseExit = FOUR_CHAR_CODE('wcox') -kThemeSoundWindowCollapseRelease = FOUR_CHAR_CODE('wcor') -kThemeSoundWindowDragBoundary = FOUR_CHAR_CODE('wdbd') -kThemeSoundUtilWinClosePress = FOUR_CHAR_CODE('uclp') -kThemeSoundUtilWinCloseEnter = FOUR_CHAR_CODE('ucle') -kThemeSoundUtilWinCloseExit = FOUR_CHAR_CODE('uclx') -kThemeSoundUtilWinCloseRelease = FOUR_CHAR_CODE('uclr') -kThemeSoundUtilWinZoomPress = FOUR_CHAR_CODE('uzmp') -kThemeSoundUtilWinZoomEnter = FOUR_CHAR_CODE('uzme') -kThemeSoundUtilWinZoomExit = FOUR_CHAR_CODE('uzmx') -kThemeSoundUtilWinZoomRelease = FOUR_CHAR_CODE('uzmr') -kThemeSoundUtilWinCollapsePress = FOUR_CHAR_CODE('ucop') -kThemeSoundUtilWinCollapseEnter = FOUR_CHAR_CODE('ucoe') -kThemeSoundUtilWinCollapseExit = FOUR_CHAR_CODE('ucox') -kThemeSoundUtilWinCollapseRelease = FOUR_CHAR_CODE('ucor') -kThemeSoundUtilWinDragBoundary = FOUR_CHAR_CODE('udbd') -kThemeSoundWindowOpen = FOUR_CHAR_CODE('wopn') -kThemeSoundWindowClose = FOUR_CHAR_CODE('wcls') -kThemeSoundWindowZoomIn = FOUR_CHAR_CODE('wzmi') -kThemeSoundWindowZoomOut = FOUR_CHAR_CODE('wzmo') -kThemeSoundWindowCollapseUp = FOUR_CHAR_CODE('wcol') -kThemeSoundWindowCollapseDown = FOUR_CHAR_CODE('wexp') -kThemeSoundWindowActivate = FOUR_CHAR_CODE('wact') -kThemeSoundUtilWindowOpen = FOUR_CHAR_CODE('uopn') -kThemeSoundUtilWindowClose = FOUR_CHAR_CODE('ucls') -kThemeSoundUtilWindowZoomIn = FOUR_CHAR_CODE('uzmi') -kThemeSoundUtilWindowZoomOut = FOUR_CHAR_CODE('uzmo') -kThemeSoundUtilWindowCollapseUp = FOUR_CHAR_CODE('ucol') -kThemeSoundUtilWindowCollapseDown = FOUR_CHAR_CODE('uexp') -kThemeSoundUtilWindowActivate = FOUR_CHAR_CODE('uact') -kThemeSoundDialogOpen = FOUR_CHAR_CODE('dopn') -kThemeSoundDialogClose = FOUR_CHAR_CODE('dlgc') -kThemeSoundAlertOpen = FOUR_CHAR_CODE('aopn') -kThemeSoundAlertClose = FOUR_CHAR_CODE('altc') -kThemeSoundPopupWindowOpen = FOUR_CHAR_CODE('pwop') -kThemeSoundPopupWindowClose = FOUR_CHAR_CODE('pwcl') -kThemeSoundButtonPress = FOUR_CHAR_CODE('btnp') -kThemeSoundButtonEnter = FOUR_CHAR_CODE('btne') -kThemeSoundButtonExit = FOUR_CHAR_CODE('btnx') -kThemeSoundButtonRelease = FOUR_CHAR_CODE('btnr') -kThemeSoundDefaultButtonPress = FOUR_CHAR_CODE('dbtp') -kThemeSoundDefaultButtonEnter = FOUR_CHAR_CODE('dbte') -kThemeSoundDefaultButtonExit = FOUR_CHAR_CODE('dbtx') -kThemeSoundDefaultButtonRelease = FOUR_CHAR_CODE('dbtr') -kThemeSoundCancelButtonPress = FOUR_CHAR_CODE('cbtp') -kThemeSoundCancelButtonEnter = FOUR_CHAR_CODE('cbte') -kThemeSoundCancelButtonExit = FOUR_CHAR_CODE('cbtx') -kThemeSoundCancelButtonRelease = FOUR_CHAR_CODE('cbtr') -kThemeSoundCheckboxPress = FOUR_CHAR_CODE('chkp') -kThemeSoundCheckboxEnter = FOUR_CHAR_CODE('chke') -kThemeSoundCheckboxExit = FOUR_CHAR_CODE('chkx') -kThemeSoundCheckboxRelease = FOUR_CHAR_CODE('chkr') -kThemeSoundRadioPress = FOUR_CHAR_CODE('radp') -kThemeSoundRadioEnter = FOUR_CHAR_CODE('rade') -kThemeSoundRadioExit = FOUR_CHAR_CODE('radx') -kThemeSoundRadioRelease = FOUR_CHAR_CODE('radr') -kThemeSoundScrollArrowPress = FOUR_CHAR_CODE('sbap') -kThemeSoundScrollArrowEnter = FOUR_CHAR_CODE('sbae') -kThemeSoundScrollArrowExit = FOUR_CHAR_CODE('sbax') -kThemeSoundScrollArrowRelease = FOUR_CHAR_CODE('sbar') -kThemeSoundScrollEndOfTrack = FOUR_CHAR_CODE('sbte') -kThemeSoundScrollTrackPress = FOUR_CHAR_CODE('sbtp') -kThemeSoundSliderEndOfTrack = FOUR_CHAR_CODE('slte') -kThemeSoundSliderTrackPress = FOUR_CHAR_CODE('sltp') -kThemeSoundBalloonOpen = FOUR_CHAR_CODE('blno') -kThemeSoundBalloonClose = FOUR_CHAR_CODE('blnc') -kThemeSoundBevelPress = FOUR_CHAR_CODE('bevp') -kThemeSoundBevelEnter = FOUR_CHAR_CODE('beve') -kThemeSoundBevelExit = FOUR_CHAR_CODE('bevx') -kThemeSoundBevelRelease = FOUR_CHAR_CODE('bevr') -kThemeSoundLittleArrowUpPress = FOUR_CHAR_CODE('laup') -kThemeSoundLittleArrowDnPress = FOUR_CHAR_CODE('ladp') -kThemeSoundLittleArrowEnter = FOUR_CHAR_CODE('lare') -kThemeSoundLittleArrowExit = FOUR_CHAR_CODE('larx') -kThemeSoundLittleArrowUpRelease = FOUR_CHAR_CODE('laur') -kThemeSoundLittleArrowDnRelease = FOUR_CHAR_CODE('ladr') -kThemeSoundPopupPress = FOUR_CHAR_CODE('popp') -kThemeSoundPopupEnter = FOUR_CHAR_CODE('pope') -kThemeSoundPopupExit = FOUR_CHAR_CODE('popx') -kThemeSoundPopupRelease = FOUR_CHAR_CODE('popr') -kThemeSoundDisclosurePress = FOUR_CHAR_CODE('dscp') -kThemeSoundDisclosureEnter = FOUR_CHAR_CODE('dsce') -kThemeSoundDisclosureExit = FOUR_CHAR_CODE('dscx') -kThemeSoundDisclosureRelease = FOUR_CHAR_CODE('dscr') -kThemeSoundTabPressed = FOUR_CHAR_CODE('tabp') -kThemeSoundTabEnter = FOUR_CHAR_CODE('tabe') -kThemeSoundTabExit = FOUR_CHAR_CODE('tabx') -kThemeSoundTabRelease = FOUR_CHAR_CODE('tabr') -kThemeSoundDragTargetHilite = FOUR_CHAR_CODE('dthi') -kThemeSoundDragTargetUnhilite = FOUR_CHAR_CODE('dtuh') -kThemeSoundDragTargetDrop = FOUR_CHAR_CODE('dtdr') -kThemeSoundEmptyTrash = FOUR_CHAR_CODE('ftrs') -kThemeSoundSelectItem = FOUR_CHAR_CODE('fsel') -kThemeSoundNewItem = FOUR_CHAR_CODE('fnew') -kThemeSoundReceiveDrop = FOUR_CHAR_CODE('fdrp') -kThemeSoundCopyDone = FOUR_CHAR_CODE('fcpd') -kThemeSoundResolveAlias = FOUR_CHAR_CODE('fral') -kThemeSoundLaunchApp = FOUR_CHAR_CODE('flap') -kThemeSoundDiskInsert = FOUR_CHAR_CODE('dski') -kThemeSoundDiskEject = FOUR_CHAR_CODE('dske') -kThemeSoundFinderDragOnIcon = FOUR_CHAR_CODE('fdon') -kThemeSoundFinderDragOffIcon = FOUR_CHAR_CODE('fdof') -kThemePopupTabNormalPosition = 0 -kThemePopupTabCenterOnWindow = 1 -kThemePopupTabCenterOnOffset = 2 -kThemeMetricScrollBarWidth = 0 -kThemeMetricSmallScrollBarWidth = 1 -kThemeMetricCheckBoxHeight = 2 -kThemeMetricRadioButtonHeight = 3 -kThemeMetricEditTextWhitespace = 4 -kThemeMetricEditTextFrameOutset = 5 -kThemeMetricListBoxFrameOutset = 6 -kThemeMetricFocusRectOutset = 7 -kThemeMetricImageWellThickness = 8 -kThemeMetricScrollBarOverlap = 9 -kThemeMetricLargeTabHeight = 10 -kThemeMetricLargeTabCapsWidth = 11 -kThemeMetricTabFrameOverlap = 12 -kThemeMetricTabIndentOrStyle = 13 -kThemeMetricTabOverlap = 14 -kThemeMetricSmallTabHeight = 15 -kThemeMetricSmallTabCapsWidth = 16 -kThemeMetricDisclosureButtonHeight = 17 -kThemeMetricRoundButtonSize = 18 -kThemeMetricPushButtonHeight = 19 -kThemeMetricListHeaderHeight = 20 -kThemeMetricSmallCheckBoxHeight = 21 -kThemeMetricDisclosureButtonWidth = 22 -kThemeMetricSmallDisclosureButtonHeight = 23 -kThemeMetricSmallDisclosureButtonWidth = 24 -kThemeMetricDisclosureTriangleHeight = 25 -kThemeMetricDisclosureTriangleWidth = 26 -kThemeMetricLittleArrowsHeight = 27 -kThemeMetricLittleArrowsWidth = 28 -kThemeMetricPaneSplitterHeight = 29 -kThemeMetricPopupButtonHeight = 30 -kThemeMetricSmallPopupButtonHeight = 31 -kThemeMetricLargeProgressBarThickness = 32 -kThemeMetricPullDownHeight = 33 -kThemeMetricSmallPullDownHeight = 34 -kThemeMetricSmallPushButtonHeight = 35 -kThemeMetricSmallRadioButtonHeight = 36 -kThemeMetricRelevanceIndicatorHeight = 37 -kThemeMetricResizeControlHeight = 38 -kThemeMetricSmallResizeControlHeight = 39 -kThemeMetricLargeRoundButtonSize = 40 -kThemeMetricHSliderHeight = 41 -kThemeMetricHSliderTickHeight = 42 -kThemeMetricSmallHSliderHeight = 43 -kThemeMetricSmallHSliderTickHeight = 44 -kThemeMetricVSliderWidth = 45 -kThemeMetricVSliderTickWidth = 46 -kThemeMetricSmallVSliderWidth = 47 -kThemeMetricSmallVSliderTickWidth = 48 -kThemeMetricTitleBarControlsHeight = 49 -kThemeMetricCheckBoxWidth = 50 -kThemeMetricSmallCheckBoxWidth = 51 -kThemeMetricRadioButtonWidth = 52 -kThemeMetricSmallRadioButtonWidth = 53 -kThemeMetricSmallHSliderMinThumbWidth = 54 -kThemeMetricSmallVSliderMinThumbHeight = 55 -kThemeMetricSmallHSliderTickOffset = 56 -kThemeMetricSmallVSliderTickOffset = 57 -kThemeMetricNormalProgressBarThickness = 58 -kThemeMetricProgressBarShadowOutset = 59 -kThemeMetricSmallProgressBarShadowOutset = 60 -kThemeMetricPrimaryGroupBoxContentInset = 61 -kThemeMetricSecondaryGroupBoxContentInset = 62 -kThemeMetricMenuMarkColumnWidth = 63 -kThemeMetricMenuExcludedMarkColumnWidth = 64 -kThemeMetricMenuMarkIndent = 65 -kThemeMetricMenuTextLeadingEdgeMargin = 66 -kThemeMetricMenuTextTrailingEdgeMargin = 67 -kThemeMetricMenuIndentWidth = 68 -kThemeMetricMenuIconTrailingEdgeMargin = 69 -# appearanceBadBrushIndexErr = themeInvalidBrushErr -# appearanceProcessRegisteredErr = themeProcessRegisteredErr -# appearanceProcessNotRegisteredErr = themeProcessNotRegisteredErr -# appearanceBadTextColorIndexErr = themeBadTextColorErr -# appearanceThemeHasNoAccents = themeHasNoAccentsErr -# appearanceBadCursorIndexErr = themeBadCursorIndexErr -kThemeActiveDialogBackgroundBrush = kThemeBrushDialogBackgroundActive -kThemeInactiveDialogBackgroundBrush = kThemeBrushDialogBackgroundInactive -kThemeActiveAlertBackgroundBrush = kThemeBrushAlertBackgroundActive -kThemeInactiveAlertBackgroundBrush = kThemeBrushAlertBackgroundInactive -kThemeActiveModelessDialogBackgroundBrush = kThemeBrushModelessDialogBackgroundActive -kThemeInactiveModelessDialogBackgroundBrush = kThemeBrushModelessDialogBackgroundInactive -kThemeActiveUtilityWindowBackgroundBrush = kThemeBrushUtilityWindowBackgroundActive -kThemeInactiveUtilityWindowBackgroundBrush = kThemeBrushUtilityWindowBackgroundInactive -kThemeListViewSortColumnBackgroundBrush = kThemeBrushListViewSortColumnBackground -kThemeListViewBackgroundBrush = kThemeBrushListViewBackground -kThemeIconLabelBackgroundBrush = kThemeBrushIconLabelBackground -kThemeListViewSeparatorBrush = kThemeBrushListViewSeparator -kThemeChasingArrowsBrush = kThemeBrushChasingArrows -kThemeDragHiliteBrush = kThemeBrushDragHilite -kThemeDocumentWindowBackgroundBrush = kThemeBrushDocumentWindowBackground -kThemeFinderWindowBackgroundBrush = kThemeBrushFinderWindowBackground -kThemeActiveScrollBarDelimiterBrush = kThemeBrushScrollBarDelimiterActive -kThemeInactiveScrollBarDelimiterBrush = kThemeBrushScrollBarDelimiterInactive -kThemeFocusHighlightBrush = kThemeBrushFocusHighlight -kThemeActivePopupArrowBrush = kThemeBrushPopupArrowActive -kThemePressedPopupArrowBrush = kThemeBrushPopupArrowPressed -kThemeInactivePopupArrowBrush = kThemeBrushPopupArrowInactive -kThemeAppleGuideCoachmarkBrush = kThemeBrushAppleGuideCoachmark -kThemeActiveDialogTextColor = kThemeTextColorDialogActive -kThemeInactiveDialogTextColor = kThemeTextColorDialogInactive -kThemeActiveAlertTextColor = kThemeTextColorAlertActive -kThemeInactiveAlertTextColor = kThemeTextColorAlertInactive -kThemeActiveModelessDialogTextColor = kThemeTextColorModelessDialogActive -kThemeInactiveModelessDialogTextColor = kThemeTextColorModelessDialogInactive -kThemeActiveWindowHeaderTextColor = kThemeTextColorWindowHeaderActive -kThemeInactiveWindowHeaderTextColor = kThemeTextColorWindowHeaderInactive -kThemeActivePlacardTextColor = kThemeTextColorPlacardActive -kThemeInactivePlacardTextColor = kThemeTextColorPlacardInactive -kThemePressedPlacardTextColor = kThemeTextColorPlacardPressed -kThemeActivePushButtonTextColor = kThemeTextColorPushButtonActive -kThemeInactivePushButtonTextColor = kThemeTextColorPushButtonInactive -kThemePressedPushButtonTextColor = kThemeTextColorPushButtonPressed -kThemeActiveBevelButtonTextColor = kThemeTextColorBevelButtonActive -kThemeInactiveBevelButtonTextColor = kThemeTextColorBevelButtonInactive -kThemePressedBevelButtonTextColor = kThemeTextColorBevelButtonPressed -kThemeActivePopupButtonTextColor = kThemeTextColorPopupButtonActive -kThemeInactivePopupButtonTextColor = kThemeTextColorPopupButtonInactive -kThemePressedPopupButtonTextColor = kThemeTextColorPopupButtonPressed -kThemeIconLabelTextColor = kThemeTextColorIconLabel -kThemeListViewTextColor = kThemeTextColorListView -kThemeActiveDocumentWindowTitleTextColor = kThemeTextColorDocumentWindowTitleActive -kThemeInactiveDocumentWindowTitleTextColor = kThemeTextColorDocumentWindowTitleInactive -kThemeActiveMovableModalWindowTitleTextColor = kThemeTextColorMovableModalWindowTitleActive -kThemeInactiveMovableModalWindowTitleTextColor = kThemeTextColorMovableModalWindowTitleInactive -kThemeActiveUtilityWindowTitleTextColor = kThemeTextColorUtilityWindowTitleActive -kThemeInactiveUtilityWindowTitleTextColor = kThemeTextColorUtilityWindowTitleInactive -kThemeActivePopupWindowTitleColor = kThemeTextColorPopupWindowTitleActive -kThemeInactivePopupWindowTitleColor = kThemeTextColorPopupWindowTitleInactive -kThemeActiveRootMenuTextColor = kThemeTextColorRootMenuActive -kThemeSelectedRootMenuTextColor = kThemeTextColorRootMenuSelected -kThemeDisabledRootMenuTextColor = kThemeTextColorRootMenuDisabled -kThemeActiveMenuItemTextColor = kThemeTextColorMenuItemActive -kThemeSelectedMenuItemTextColor = kThemeTextColorMenuItemSelected -kThemeDisabledMenuItemTextColor = kThemeTextColorMenuItemDisabled -kThemeActivePopupLabelTextColor = kThemeTextColorPopupLabelActive -kThemeInactivePopupLabelTextColor = kThemeTextColorPopupLabelInactive -kAEThemeSwitch = kAEAppearanceChanged -kThemeNoAdornment = kThemeAdornmentNone -kThemeDefaultAdornment = kThemeAdornmentDefault -kThemeFocusAdornment = kThemeAdornmentFocus -kThemeRightToLeftAdornment = kThemeAdornmentRightToLeft -kThemeDrawIndicatorOnly = kThemeAdornmentDrawIndicatorOnly -kThemeBrushPassiveAreaFill = kThemeBrushStaticAreaFill -kThemeMetricCheckBoxGlyphHeight = kThemeMetricCheckBoxHeight -kThemeMetricRadioButtonGlyphHeight = kThemeMetricRadioButtonHeight -kThemeMetricDisclosureButtonSize = kThemeMetricDisclosureButtonHeight -kThemeMetricBestListHeaderHeight = kThemeMetricListHeaderHeight -kThemeMetricSmallProgressBarThickness = kThemeMetricNormalProgressBarThickness -kThemeMetricProgressBarThickness = kThemeMetricLargeProgressBarThickness -kThemeScrollBar = kThemeMediumScrollBar -kThemeSlider = kThemeMediumSlider -kThemeProgressBar = kThemeMediumProgressBar -kThemeIndeterminateBar = kThemeMediumIndeterminateBar diff --git a/sys/lib/python/plat-mac/Carbon/AppleEvents.py b/sys/lib/python/plat-mac/Carbon/AppleEvents.py deleted file mode 100644 index e23c0797a..000000000 --- a/sys/lib/python/plat-mac/Carbon/AppleEvents.py +++ /dev/null @@ -1,960 +0,0 @@ -# Generated from 'AEDataModel.h' - -def FOUR_CHAR_CODE(x): return x -typeBoolean = FOUR_CHAR_CODE('bool') -typeChar = FOUR_CHAR_CODE('TEXT') -typeSInt16 = FOUR_CHAR_CODE('shor') -typeSInt32 = FOUR_CHAR_CODE('long') -typeUInt32 = FOUR_CHAR_CODE('magn') -typeSInt64 = FOUR_CHAR_CODE('comp') -typeIEEE32BitFloatingPoint = FOUR_CHAR_CODE('sing') -typeIEEE64BitFloatingPoint = FOUR_CHAR_CODE('doub') -type128BitFloatingPoint = FOUR_CHAR_CODE('ldbl') -typeDecimalStruct = FOUR_CHAR_CODE('decm') -typeSMInt = typeSInt16 -typeShortInteger = typeSInt16 -typeInteger = typeSInt32 -typeLongInteger = typeSInt32 -typeMagnitude = typeUInt32 -typeComp = typeSInt64 -typeSMFloat = typeIEEE32BitFloatingPoint -typeShortFloat = typeIEEE32BitFloatingPoint -typeFloat = typeIEEE64BitFloatingPoint -typeLongFloat = typeIEEE64BitFloatingPoint -typeExtended = FOUR_CHAR_CODE('exte') -typeAEList = FOUR_CHAR_CODE('list') -typeAERecord = FOUR_CHAR_CODE('reco') -typeAppleEvent = FOUR_CHAR_CODE('aevt') -typeEventRecord = FOUR_CHAR_CODE('evrc') -typeTrue = FOUR_CHAR_CODE('true') -typeFalse = FOUR_CHAR_CODE('fals') -typeAlias = FOUR_CHAR_CODE('alis') -typeEnumerated = FOUR_CHAR_CODE('enum') -typeType = FOUR_CHAR_CODE('type') -typeAppParameters = FOUR_CHAR_CODE('appa') -typeProperty = FOUR_CHAR_CODE('prop') -typeFSS = FOUR_CHAR_CODE('fss ') -typeFSRef = FOUR_CHAR_CODE('fsrf') -typeFileURL = FOUR_CHAR_CODE('furl') -typeKeyword = FOUR_CHAR_CODE('keyw') -typeSectionH = FOUR_CHAR_CODE('sect') -typeWildCard = FOUR_CHAR_CODE('****') -typeApplSignature = FOUR_CHAR_CODE('sign') -typeQDRectangle = FOUR_CHAR_CODE('qdrt') -typeFixed = FOUR_CHAR_CODE('fixd') -typeProcessSerialNumber = FOUR_CHAR_CODE('psn ') -typeApplicationURL = FOUR_CHAR_CODE('aprl') -typeNull = FOUR_CHAR_CODE('null') -typeSessionID = FOUR_CHAR_CODE('ssid') -typeTargetID = FOUR_CHAR_CODE('targ') -typeDispatcherID = FOUR_CHAR_CODE('dspt') -keyTransactionIDAttr = FOUR_CHAR_CODE('tran') -keyReturnIDAttr = FOUR_CHAR_CODE('rtid') -keyEventClassAttr = FOUR_CHAR_CODE('evcl') -keyEventIDAttr = FOUR_CHAR_CODE('evid') -keyAddressAttr = FOUR_CHAR_CODE('addr') -keyOptionalKeywordAttr = FOUR_CHAR_CODE('optk') -keyTimeoutAttr = FOUR_CHAR_CODE('timo') -keyInteractLevelAttr = FOUR_CHAR_CODE('inte') -keyEventSourceAttr = FOUR_CHAR_CODE('esrc') -keyMissedKeywordAttr = FOUR_CHAR_CODE('miss') -keyOriginalAddressAttr = FOUR_CHAR_CODE('from') -keyAcceptTimeoutAttr = FOUR_CHAR_CODE('actm') -kAEDescListFactorNone = 0 -kAEDescListFactorType = 4 -kAEDescListFactorTypeAndSize = 8 -kAutoGenerateReturnID = -1 -kAnyTransactionID = 0 -kAEDataArray = 0 -kAEPackedArray = 1 -kAEDescArray = 3 -kAEKeyDescArray = 4 -kAEHandleArray = 2 -kAENormalPriority = 0x00000000 -kAEHighPriority = 0x00000001 -kAENoReply = 0x00000001 -kAEQueueReply = 0x00000002 -kAEWaitReply = 0x00000003 -kAEDontReconnect = 0x00000080 -kAEWantReceipt = 0x00000200 -kAENeverInteract = 0x00000010 -kAECanInteract = 0x00000020 -kAEAlwaysInteract = 0x00000030 -kAECanSwitchLayer = 0x00000040 -kAEDontRecord = 0x00001000 -kAEDontExecute = 0x00002000 -kAEProcessNonReplyEvents = 0x00008000 -kAEDefaultTimeout = -1 -kNoTimeOut = -2 -kAEInteractWithSelf = 0 -kAEInteractWithLocal = 1 -kAEInteractWithAll = 2 -kAEDoNotIgnoreHandler = 0x00000000 -kAEIgnoreAppPhacHandler = 0x00000001 -kAEIgnoreAppEventHandler = 0x00000002 -kAEIgnoreSysPhacHandler = 0x00000004 -kAEIgnoreSysEventHandler = 0x00000008 -kAEIngoreBuiltInEventHandler = 0x00000010 -# kAEDontDisposeOnResume = (long)0x80000000 -kAENoDispatch = 0 -# kAEUseStandardDispatch = (long)0xFFFFFFFF -keyDirectObject = FOUR_CHAR_CODE('----') -keyErrorNumber = FOUR_CHAR_CODE('errn') -keyErrorString = FOUR_CHAR_CODE('errs') -keyProcessSerialNumber = FOUR_CHAR_CODE('psn ') -keyPreDispatch = FOUR_CHAR_CODE('phac') -keySelectProc = FOUR_CHAR_CODE('selh') -keyAERecorderCount = FOUR_CHAR_CODE('recr') -keyAEVersion = FOUR_CHAR_CODE('vers') -kCoreEventClass = FOUR_CHAR_CODE('aevt') -kAEOpenApplication = FOUR_CHAR_CODE('oapp') -kAEOpenDocuments = FOUR_CHAR_CODE('odoc') -kAEPrintDocuments = FOUR_CHAR_CODE('pdoc') -kAEQuitApplication = FOUR_CHAR_CODE('quit') -kAEAnswer = FOUR_CHAR_CODE('ansr') -kAEApplicationDied = FOUR_CHAR_CODE('obit') -kAEShowPreferences = FOUR_CHAR_CODE('pref') -kAEStartRecording = FOUR_CHAR_CODE('reca') -kAEStopRecording = FOUR_CHAR_CODE('recc') -kAENotifyStartRecording = FOUR_CHAR_CODE('rec1') -kAENotifyStopRecording = FOUR_CHAR_CODE('rec0') -kAENotifyRecording = FOUR_CHAR_CODE('recr') -kAEUnknownSource = 0 -kAEDirectCall = 1 -kAESameProcess = 2 -kAELocalProcess = 3 -kAERemoteProcess = 4 -cAEList = FOUR_CHAR_CODE('list') -cApplication = FOUR_CHAR_CODE('capp') -cArc = FOUR_CHAR_CODE('carc') -cBoolean = FOUR_CHAR_CODE('bool') -cCell = FOUR_CHAR_CODE('ccel') -cChar = FOUR_CHAR_CODE('cha ') -cColorTable = FOUR_CHAR_CODE('clrt') -cColumn = FOUR_CHAR_CODE('ccol') -cDocument = FOUR_CHAR_CODE('docu') -cDrawingArea = FOUR_CHAR_CODE('cdrw') -cEnumeration = FOUR_CHAR_CODE('enum') -cFile = FOUR_CHAR_CODE('file') -cFixed = FOUR_CHAR_CODE('fixd') -cFixedPoint = FOUR_CHAR_CODE('fpnt') -cFixedRectangle = FOUR_CHAR_CODE('frct') -cGraphicLine = FOUR_CHAR_CODE('glin') -cGraphicObject = FOUR_CHAR_CODE('cgob') -cGraphicShape = FOUR_CHAR_CODE('cgsh') -cGraphicText = FOUR_CHAR_CODE('cgtx') -cGroupedGraphic = FOUR_CHAR_CODE('cpic') -cInsertionLoc = FOUR_CHAR_CODE('insl') -cInsertionPoint = FOUR_CHAR_CODE('cins') -cIntlText = FOUR_CHAR_CODE('itxt') -cIntlWritingCode = FOUR_CHAR_CODE('intl') -cItem = FOUR_CHAR_CODE('citm') -cLine = FOUR_CHAR_CODE('clin') -cLongDateTime = FOUR_CHAR_CODE('ldt ') -cLongFixed = FOUR_CHAR_CODE('lfxd') -cLongFixedPoint = FOUR_CHAR_CODE('lfpt') -cLongFixedRectangle = FOUR_CHAR_CODE('lfrc') -cLongInteger = FOUR_CHAR_CODE('long') -cLongPoint = FOUR_CHAR_CODE('lpnt') -cLongRectangle = FOUR_CHAR_CODE('lrct') -cMachineLoc = FOUR_CHAR_CODE('mLoc') -cMenu = FOUR_CHAR_CODE('cmnu') -cMenuItem = FOUR_CHAR_CODE('cmen') -cObject = FOUR_CHAR_CODE('cobj') -cObjectSpecifier = FOUR_CHAR_CODE('obj ') -cOpenableObject = FOUR_CHAR_CODE('coob') -cOval = FOUR_CHAR_CODE('covl') -cParagraph = FOUR_CHAR_CODE('cpar') -cPICT = FOUR_CHAR_CODE('PICT') -cPixel = FOUR_CHAR_CODE('cpxl') -cPixelMap = FOUR_CHAR_CODE('cpix') -cPolygon = FOUR_CHAR_CODE('cpgn') -cProperty = FOUR_CHAR_CODE('prop') -cQDPoint = FOUR_CHAR_CODE('QDpt') -cQDRectangle = FOUR_CHAR_CODE('qdrt') -cRectangle = FOUR_CHAR_CODE('crec') -cRGBColor = FOUR_CHAR_CODE('cRGB') -cRotation = FOUR_CHAR_CODE('trot') -cRoundedRectangle = FOUR_CHAR_CODE('crrc') -cRow = FOUR_CHAR_CODE('crow') -cSelection = FOUR_CHAR_CODE('csel') -cShortInteger = FOUR_CHAR_CODE('shor') -cTable = FOUR_CHAR_CODE('ctbl') -cText = FOUR_CHAR_CODE('ctxt') -cTextFlow = FOUR_CHAR_CODE('cflo') -cTextStyles = FOUR_CHAR_CODE('tsty') -cType = FOUR_CHAR_CODE('type') -cVersion = FOUR_CHAR_CODE('vers') -cWindow = FOUR_CHAR_CODE('cwin') -cWord = FOUR_CHAR_CODE('cwor') -enumArrows = FOUR_CHAR_CODE('arro') -enumJustification = FOUR_CHAR_CODE('just') -enumKeyForm = FOUR_CHAR_CODE('kfrm') -enumPosition = FOUR_CHAR_CODE('posi') -enumProtection = FOUR_CHAR_CODE('prtn') -enumQuality = FOUR_CHAR_CODE('qual') -enumSaveOptions = FOUR_CHAR_CODE('savo') -enumStyle = FOUR_CHAR_CODE('styl') -enumTransferMode = FOUR_CHAR_CODE('tran') -formUniqueID = FOUR_CHAR_CODE('ID ') -kAEAbout = FOUR_CHAR_CODE('abou') -kAEAfter = FOUR_CHAR_CODE('afte') -kAEAliasSelection = FOUR_CHAR_CODE('sali') -kAEAllCaps = FOUR_CHAR_CODE('alcp') -kAEArrowAtEnd = FOUR_CHAR_CODE('aren') -kAEArrowAtStart = FOUR_CHAR_CODE('arst') -kAEArrowBothEnds = FOUR_CHAR_CODE('arbo') -kAEAsk = FOUR_CHAR_CODE('ask ') -kAEBefore = FOUR_CHAR_CODE('befo') -kAEBeginning = FOUR_CHAR_CODE('bgng') -kAEBeginsWith = FOUR_CHAR_CODE('bgwt') -kAEBeginTransaction = FOUR_CHAR_CODE('begi') -kAEBold = FOUR_CHAR_CODE('bold') -kAECaseSensEquals = FOUR_CHAR_CODE('cseq') -kAECentered = FOUR_CHAR_CODE('cent') -kAEChangeView = FOUR_CHAR_CODE('view') -kAEClone = FOUR_CHAR_CODE('clon') -kAEClose = FOUR_CHAR_CODE('clos') -kAECondensed = FOUR_CHAR_CODE('cond') -kAEContains = FOUR_CHAR_CODE('cont') -kAECopy = FOUR_CHAR_CODE('copy') -kAECoreSuite = FOUR_CHAR_CODE('core') -kAECountElements = FOUR_CHAR_CODE('cnte') -kAECreateElement = FOUR_CHAR_CODE('crel') -kAECreatePublisher = FOUR_CHAR_CODE('cpub') -kAECut = FOUR_CHAR_CODE('cut ') -kAEDelete = FOUR_CHAR_CODE('delo') -kAEDoObjectsExist = FOUR_CHAR_CODE('doex') -kAEDoScript = FOUR_CHAR_CODE('dosc') -kAEDrag = FOUR_CHAR_CODE('drag') -kAEDuplicateSelection = FOUR_CHAR_CODE('sdup') -kAEEditGraphic = FOUR_CHAR_CODE('edit') -kAEEmptyTrash = FOUR_CHAR_CODE('empt') -kAEEnd = FOUR_CHAR_CODE('end ') -kAEEndsWith = FOUR_CHAR_CODE('ends') -kAEEndTransaction = FOUR_CHAR_CODE('endt') -kAEEquals = FOUR_CHAR_CODE('= ') -kAEExpanded = FOUR_CHAR_CODE('pexp') -kAEFast = FOUR_CHAR_CODE('fast') -kAEFinderEvents = FOUR_CHAR_CODE('FNDR') -kAEFormulaProtect = FOUR_CHAR_CODE('fpro') -kAEFullyJustified = FOUR_CHAR_CODE('full') -kAEGetClassInfo = FOUR_CHAR_CODE('qobj') -kAEGetData = FOUR_CHAR_CODE('getd') -kAEGetDataSize = FOUR_CHAR_CODE('dsiz') -kAEGetEventInfo = FOUR_CHAR_CODE('gtei') -kAEGetInfoSelection = FOUR_CHAR_CODE('sinf') -kAEGetPrivilegeSelection = FOUR_CHAR_CODE('sprv') -kAEGetSuiteInfo = FOUR_CHAR_CODE('gtsi') -kAEGreaterThan = FOUR_CHAR_CODE('> ') -kAEGreaterThanEquals = FOUR_CHAR_CODE('>= ') -kAEGrow = FOUR_CHAR_CODE('grow') -kAEHidden = FOUR_CHAR_CODE('hidn') -kAEHiQuality = FOUR_CHAR_CODE('hiqu') -kAEImageGraphic = FOUR_CHAR_CODE('imgr') -kAEIsUniform = FOUR_CHAR_CODE('isun') -kAEItalic = FOUR_CHAR_CODE('ital') -kAELeftJustified = FOUR_CHAR_CODE('left') -kAELessThan = FOUR_CHAR_CODE('< ') -kAELessThanEquals = FOUR_CHAR_CODE('<= ') -kAELowercase = FOUR_CHAR_CODE('lowc') -kAEMakeObjectsVisible = FOUR_CHAR_CODE('mvis') -kAEMiscStandards = FOUR_CHAR_CODE('misc') -kAEModifiable = FOUR_CHAR_CODE('modf') -kAEMove = FOUR_CHAR_CODE('move') -kAENo = FOUR_CHAR_CODE('no ') -kAENoArrow = FOUR_CHAR_CODE('arno') -kAENonmodifiable = FOUR_CHAR_CODE('nmod') -kAEOpen = FOUR_CHAR_CODE('odoc') -kAEOpenSelection = FOUR_CHAR_CODE('sope') -kAEOutline = FOUR_CHAR_CODE('outl') -kAEPageSetup = FOUR_CHAR_CODE('pgsu') -kAEPaste = FOUR_CHAR_CODE('past') -kAEPlain = FOUR_CHAR_CODE('plan') -kAEPrint = FOUR_CHAR_CODE('pdoc') -kAEPrintSelection = FOUR_CHAR_CODE('spri') -kAEPrintWindow = FOUR_CHAR_CODE('pwin') -kAEPutAwaySelection = FOUR_CHAR_CODE('sput') -kAEQDAddOver = FOUR_CHAR_CODE('addo') -kAEQDAddPin = FOUR_CHAR_CODE('addp') -kAEQDAdMax = FOUR_CHAR_CODE('admx') -kAEQDAdMin = FOUR_CHAR_CODE('admn') -kAEQDBic = FOUR_CHAR_CODE('bic ') -kAEQDBlend = FOUR_CHAR_CODE('blnd') -kAEQDCopy = FOUR_CHAR_CODE('cpy ') -kAEQDNotBic = FOUR_CHAR_CODE('nbic') -kAEQDNotCopy = FOUR_CHAR_CODE('ncpy') -kAEQDNotOr = FOUR_CHAR_CODE('ntor') -kAEQDNotXor = FOUR_CHAR_CODE('nxor') -kAEQDOr = FOUR_CHAR_CODE('or ') -kAEQDSubOver = FOUR_CHAR_CODE('subo') -kAEQDSubPin = FOUR_CHAR_CODE('subp') -kAEQDSupplementalSuite = FOUR_CHAR_CODE('qdsp') -kAEQDXor = FOUR_CHAR_CODE('xor ') -kAEQuickdrawSuite = FOUR_CHAR_CODE('qdrw') -kAEQuitAll = FOUR_CHAR_CODE('quia') -kAERedo = FOUR_CHAR_CODE('redo') -kAERegular = FOUR_CHAR_CODE('regl') -kAEReopenApplication = FOUR_CHAR_CODE('rapp') -kAEReplace = FOUR_CHAR_CODE('rplc') -kAERequiredSuite = FOUR_CHAR_CODE('reqd') -kAERestart = FOUR_CHAR_CODE('rest') -kAERevealSelection = FOUR_CHAR_CODE('srev') -kAERevert = FOUR_CHAR_CODE('rvrt') -kAERightJustified = FOUR_CHAR_CODE('rght') -kAESave = FOUR_CHAR_CODE('save') -kAESelect = FOUR_CHAR_CODE('slct') -kAESetData = FOUR_CHAR_CODE('setd') -kAESetPosition = FOUR_CHAR_CODE('posn') -kAEShadow = FOUR_CHAR_CODE('shad') -kAEShowClipboard = FOUR_CHAR_CODE('shcl') -kAEShutDown = FOUR_CHAR_CODE('shut') -kAESleep = FOUR_CHAR_CODE('slep') -kAESmallCaps = FOUR_CHAR_CODE('smcp') -kAESpecialClassProperties = FOUR_CHAR_CODE('c@#!') -kAEStrikethrough = FOUR_CHAR_CODE('strk') -kAESubscript = FOUR_CHAR_CODE('sbsc') -kAESuperscript = FOUR_CHAR_CODE('spsc') -kAETableSuite = FOUR_CHAR_CODE('tbls') -kAETextSuite = FOUR_CHAR_CODE('TEXT') -kAETransactionTerminated = FOUR_CHAR_CODE('ttrm') -kAEUnderline = FOUR_CHAR_CODE('undl') -kAEUndo = FOUR_CHAR_CODE('undo') -kAEWholeWordEquals = FOUR_CHAR_CODE('wweq') -kAEYes = FOUR_CHAR_CODE('yes ') -kAEZoom = FOUR_CHAR_CODE('zoom') -kAEMouseClass = FOUR_CHAR_CODE('mous') -kAEDown = FOUR_CHAR_CODE('down') -kAEUp = FOUR_CHAR_CODE('up ') -kAEMoved = FOUR_CHAR_CODE('move') -kAEStoppedMoving = FOUR_CHAR_CODE('stop') -kAEWindowClass = FOUR_CHAR_CODE('wind') -kAEUpdate = FOUR_CHAR_CODE('updt') -kAEActivate = FOUR_CHAR_CODE('actv') -kAEDeactivate = FOUR_CHAR_CODE('dact') -kAECommandClass = FOUR_CHAR_CODE('cmnd') -kAEKeyClass = FOUR_CHAR_CODE('keyc') -kAERawKey = FOUR_CHAR_CODE('rkey') -kAEVirtualKey = FOUR_CHAR_CODE('keyc') -kAENavigationKey = FOUR_CHAR_CODE('nave') -kAEAutoDown = FOUR_CHAR_CODE('auto') -kAEApplicationClass = FOUR_CHAR_CODE('appl') -kAESuspend = FOUR_CHAR_CODE('susp') -kAEResume = FOUR_CHAR_CODE('rsme') -kAEDiskEvent = FOUR_CHAR_CODE('disk') -kAENullEvent = FOUR_CHAR_CODE('null') -kAEWakeUpEvent = FOUR_CHAR_CODE('wake') -kAEScrapEvent = FOUR_CHAR_CODE('scrp') -kAEHighLevel = FOUR_CHAR_CODE('high') -keyAEAngle = FOUR_CHAR_CODE('kang') -keyAEArcAngle = FOUR_CHAR_CODE('parc') -keyAEBaseAddr = FOUR_CHAR_CODE('badd') -keyAEBestType = FOUR_CHAR_CODE('pbst') -keyAEBgndColor = FOUR_CHAR_CODE('kbcl') -keyAEBgndPattern = FOUR_CHAR_CODE('kbpt') -keyAEBounds = FOUR_CHAR_CODE('pbnd') -keyAECellList = FOUR_CHAR_CODE('kclt') -keyAEClassID = FOUR_CHAR_CODE('clID') -keyAEColor = FOUR_CHAR_CODE('colr') -keyAEColorTable = FOUR_CHAR_CODE('cltb') -keyAECurveHeight = FOUR_CHAR_CODE('kchd') -keyAECurveWidth = FOUR_CHAR_CODE('kcwd') -keyAEDashStyle = FOUR_CHAR_CODE('pdst') -keyAEData = FOUR_CHAR_CODE('data') -keyAEDefaultType = FOUR_CHAR_CODE('deft') -keyAEDefinitionRect = FOUR_CHAR_CODE('pdrt') -keyAEDescType = FOUR_CHAR_CODE('dstp') -keyAEDestination = FOUR_CHAR_CODE('dest') -keyAEDoAntiAlias = FOUR_CHAR_CODE('anta') -keyAEDoDithered = FOUR_CHAR_CODE('gdit') -keyAEDoRotate = FOUR_CHAR_CODE('kdrt') -keyAEDoScale = FOUR_CHAR_CODE('ksca') -keyAEDoTranslate = FOUR_CHAR_CODE('ktra') -keyAEEditionFileLoc = FOUR_CHAR_CODE('eloc') -keyAEElements = FOUR_CHAR_CODE('elms') -keyAEEndPoint = FOUR_CHAR_CODE('pend') -keyAEEventClass = FOUR_CHAR_CODE('evcl') -keyAEEventID = FOUR_CHAR_CODE('evti') -keyAEFile = FOUR_CHAR_CODE('kfil') -keyAEFileType = FOUR_CHAR_CODE('fltp') -keyAEFillColor = FOUR_CHAR_CODE('flcl') -keyAEFillPattern = FOUR_CHAR_CODE('flpt') -keyAEFlipHorizontal = FOUR_CHAR_CODE('kfho') -keyAEFlipVertical = FOUR_CHAR_CODE('kfvt') -keyAEFont = FOUR_CHAR_CODE('font') -keyAEFormula = FOUR_CHAR_CODE('pfor') -keyAEGraphicObjects = FOUR_CHAR_CODE('gobs') -keyAEID = FOUR_CHAR_CODE('ID ') -keyAEImageQuality = FOUR_CHAR_CODE('gqua') -keyAEInsertHere = FOUR_CHAR_CODE('insh') -keyAEKeyForms = FOUR_CHAR_CODE('keyf') -keyAEKeyword = FOUR_CHAR_CODE('kywd') -keyAELevel = FOUR_CHAR_CODE('levl') -keyAELineArrow = FOUR_CHAR_CODE('arro') -keyAEName = FOUR_CHAR_CODE('pnam') -keyAENewElementLoc = FOUR_CHAR_CODE('pnel') -keyAEObject = FOUR_CHAR_CODE('kobj') -keyAEObjectClass = FOUR_CHAR_CODE('kocl') -keyAEOffStyles = FOUR_CHAR_CODE('ofst') -keyAEOnStyles = FOUR_CHAR_CODE('onst') -keyAEParameters = FOUR_CHAR_CODE('prms') -keyAEParamFlags = FOUR_CHAR_CODE('pmfg') -keyAEPenColor = FOUR_CHAR_CODE('ppcl') -keyAEPenPattern = FOUR_CHAR_CODE('pppa') -keyAEPenWidth = FOUR_CHAR_CODE('ppwd') -keyAEPixelDepth = FOUR_CHAR_CODE('pdpt') -keyAEPixMapMinus = FOUR_CHAR_CODE('kpmm') -keyAEPMTable = FOUR_CHAR_CODE('kpmt') -keyAEPointList = FOUR_CHAR_CODE('ptlt') -keyAEPointSize = FOUR_CHAR_CODE('ptsz') -keyAEPosition = FOUR_CHAR_CODE('kpos') -keyAEPropData = FOUR_CHAR_CODE('prdt') -keyAEProperties = FOUR_CHAR_CODE('qpro') -keyAEProperty = FOUR_CHAR_CODE('kprp') -keyAEPropFlags = FOUR_CHAR_CODE('prfg') -keyAEPropID = FOUR_CHAR_CODE('prop') -keyAEProtection = FOUR_CHAR_CODE('ppro') -keyAERenderAs = FOUR_CHAR_CODE('kren') -keyAERequestedType = FOUR_CHAR_CODE('rtyp') -keyAEResult = FOUR_CHAR_CODE('----') -keyAEResultInfo = FOUR_CHAR_CODE('rsin') -keyAERotation = FOUR_CHAR_CODE('prot') -keyAERotPoint = FOUR_CHAR_CODE('krtp') -keyAERowList = FOUR_CHAR_CODE('krls') -keyAESaveOptions = FOUR_CHAR_CODE('savo') -keyAEScale = FOUR_CHAR_CODE('pscl') -keyAEScriptTag = FOUR_CHAR_CODE('psct') -keyAEShowWhere = FOUR_CHAR_CODE('show') -keyAEStartAngle = FOUR_CHAR_CODE('pang') -keyAEStartPoint = FOUR_CHAR_CODE('pstp') -keyAEStyles = FOUR_CHAR_CODE('ksty') -keyAESuiteID = FOUR_CHAR_CODE('suit') -keyAEText = FOUR_CHAR_CODE('ktxt') -keyAETextColor = FOUR_CHAR_CODE('ptxc') -keyAETextFont = FOUR_CHAR_CODE('ptxf') -keyAETextPointSize = FOUR_CHAR_CODE('ptps') -keyAETextStyles = FOUR_CHAR_CODE('txst') -keyAETextLineHeight = FOUR_CHAR_CODE('ktlh') -keyAETextLineAscent = FOUR_CHAR_CODE('ktas') -keyAETheText = FOUR_CHAR_CODE('thtx') -keyAETransferMode = FOUR_CHAR_CODE('pptm') -keyAETranslation = FOUR_CHAR_CODE('ptrs') -keyAETryAsStructGraf = FOUR_CHAR_CODE('toog') -keyAEUniformStyles = FOUR_CHAR_CODE('ustl') -keyAEUpdateOn = FOUR_CHAR_CODE('pupd') -keyAEUserTerm = FOUR_CHAR_CODE('utrm') -keyAEWindow = FOUR_CHAR_CODE('wndw') -keyAEWritingCode = FOUR_CHAR_CODE('wrcd') -keyMiscellaneous = FOUR_CHAR_CODE('fmsc') -keySelection = FOUR_CHAR_CODE('fsel') -keyWindow = FOUR_CHAR_CODE('kwnd') -keyWhen = FOUR_CHAR_CODE('when') -keyWhere = FOUR_CHAR_CODE('wher') -keyModifiers = FOUR_CHAR_CODE('mods') -keyKey = FOUR_CHAR_CODE('key ') -keyKeyCode = FOUR_CHAR_CODE('code') -keyKeyboard = FOUR_CHAR_CODE('keyb') -keyDriveNumber = FOUR_CHAR_CODE('drv#') -keyErrorCode = FOUR_CHAR_CODE('err#') -keyHighLevelClass = FOUR_CHAR_CODE('hcls') -keyHighLevelID = FOUR_CHAR_CODE('hid ') -pArcAngle = FOUR_CHAR_CODE('parc') -pBackgroundColor = FOUR_CHAR_CODE('pbcl') -pBackgroundPattern = FOUR_CHAR_CODE('pbpt') -pBestType = FOUR_CHAR_CODE('pbst') -pBounds = FOUR_CHAR_CODE('pbnd') -pClass = FOUR_CHAR_CODE('pcls') -pClipboard = FOUR_CHAR_CODE('pcli') -pColor = FOUR_CHAR_CODE('colr') -pColorTable = FOUR_CHAR_CODE('cltb') -pContents = FOUR_CHAR_CODE('pcnt') -pCornerCurveHeight = FOUR_CHAR_CODE('pchd') -pCornerCurveWidth = FOUR_CHAR_CODE('pcwd') -pDashStyle = FOUR_CHAR_CODE('pdst') -pDefaultType = FOUR_CHAR_CODE('deft') -pDefinitionRect = FOUR_CHAR_CODE('pdrt') -pEnabled = FOUR_CHAR_CODE('enbl') -pEndPoint = FOUR_CHAR_CODE('pend') -pFillColor = FOUR_CHAR_CODE('flcl') -pFillPattern = FOUR_CHAR_CODE('flpt') -pFont = FOUR_CHAR_CODE('font') -pFormula = FOUR_CHAR_CODE('pfor') -pGraphicObjects = FOUR_CHAR_CODE('gobs') -pHasCloseBox = FOUR_CHAR_CODE('hclb') -pHasTitleBar = FOUR_CHAR_CODE('ptit') -pID = FOUR_CHAR_CODE('ID ') -pIndex = FOUR_CHAR_CODE('pidx') -pInsertionLoc = FOUR_CHAR_CODE('pins') -pIsFloating = FOUR_CHAR_CODE('isfl') -pIsFrontProcess = FOUR_CHAR_CODE('pisf') -pIsModal = FOUR_CHAR_CODE('pmod') -pIsModified = FOUR_CHAR_CODE('imod') -pIsResizable = FOUR_CHAR_CODE('prsz') -pIsStationeryPad = FOUR_CHAR_CODE('pspd') -pIsZoomable = FOUR_CHAR_CODE('iszm') -pIsZoomed = FOUR_CHAR_CODE('pzum') -pItemNumber = FOUR_CHAR_CODE('itmn') -pJustification = FOUR_CHAR_CODE('pjst') -pLineArrow = FOUR_CHAR_CODE('arro') -pMenuID = FOUR_CHAR_CODE('mnid') -pName = FOUR_CHAR_CODE('pnam') -pNewElementLoc = FOUR_CHAR_CODE('pnel') -pPenColor = FOUR_CHAR_CODE('ppcl') -pPenPattern = FOUR_CHAR_CODE('pppa') -pPenWidth = FOUR_CHAR_CODE('ppwd') -pPixelDepth = FOUR_CHAR_CODE('pdpt') -pPointList = FOUR_CHAR_CODE('ptlt') -pPointSize = FOUR_CHAR_CODE('ptsz') -pProtection = FOUR_CHAR_CODE('ppro') -pRotation = FOUR_CHAR_CODE('prot') -pScale = FOUR_CHAR_CODE('pscl') -pScript = FOUR_CHAR_CODE('scpt') -pScriptTag = FOUR_CHAR_CODE('psct') -pSelected = FOUR_CHAR_CODE('selc') -pSelection = FOUR_CHAR_CODE('sele') -pStartAngle = FOUR_CHAR_CODE('pang') -pStartPoint = FOUR_CHAR_CODE('pstp') -pTextColor = FOUR_CHAR_CODE('ptxc') -pTextFont = FOUR_CHAR_CODE('ptxf') -pTextItemDelimiters = FOUR_CHAR_CODE('txdl') -pTextPointSize = FOUR_CHAR_CODE('ptps') -pTextStyles = FOUR_CHAR_CODE('txst') -pTransferMode = FOUR_CHAR_CODE('pptm') -pTranslation = FOUR_CHAR_CODE('ptrs') -pUniformStyles = FOUR_CHAR_CODE('ustl') -pUpdateOn = FOUR_CHAR_CODE('pupd') -pUserSelection = FOUR_CHAR_CODE('pusl') -pVersion = FOUR_CHAR_CODE('vers') -pVisible = FOUR_CHAR_CODE('pvis') -typeAEText = FOUR_CHAR_CODE('tTXT') -typeArc = FOUR_CHAR_CODE('carc') -typeBest = FOUR_CHAR_CODE('best') -typeCell = FOUR_CHAR_CODE('ccel') -typeClassInfo = FOUR_CHAR_CODE('gcli') -typeColorTable = FOUR_CHAR_CODE('clrt') -typeColumn = FOUR_CHAR_CODE('ccol') -typeDashStyle = FOUR_CHAR_CODE('tdas') -typeData = FOUR_CHAR_CODE('tdta') -typeDrawingArea = FOUR_CHAR_CODE('cdrw') -typeElemInfo = FOUR_CHAR_CODE('elin') -typeEnumeration = FOUR_CHAR_CODE('enum') -typeEPS = FOUR_CHAR_CODE('EPS ') -typeEventInfo = FOUR_CHAR_CODE('evin') -typeFinderWindow = FOUR_CHAR_CODE('fwin') -typeFixedPoint = FOUR_CHAR_CODE('fpnt') -typeFixedRectangle = FOUR_CHAR_CODE('frct') -typeGraphicLine = FOUR_CHAR_CODE('glin') -typeGraphicText = FOUR_CHAR_CODE('cgtx') -typeGroupedGraphic = FOUR_CHAR_CODE('cpic') -typeInsertionLoc = FOUR_CHAR_CODE('insl') -typeIntlText = FOUR_CHAR_CODE('itxt') -typeIntlWritingCode = FOUR_CHAR_CODE('intl') -typeLongDateTime = FOUR_CHAR_CODE('ldt ') -typeLongFixed = FOUR_CHAR_CODE('lfxd') -typeLongFixedPoint = FOUR_CHAR_CODE('lfpt') -typeLongFixedRectangle = FOUR_CHAR_CODE('lfrc') -typeLongPoint = FOUR_CHAR_CODE('lpnt') -typeLongRectangle = FOUR_CHAR_CODE('lrct') -typeMachineLoc = FOUR_CHAR_CODE('mLoc') -typeOval = FOUR_CHAR_CODE('covl') -typeParamInfo = FOUR_CHAR_CODE('pmin') -typePict = FOUR_CHAR_CODE('PICT') -typePixelMap = FOUR_CHAR_CODE('cpix') -typePixMapMinus = FOUR_CHAR_CODE('tpmm') -typePolygon = FOUR_CHAR_CODE('cpgn') -typePropInfo = FOUR_CHAR_CODE('pinf') -typePtr = FOUR_CHAR_CODE('ptr ') -typeQDPoint = FOUR_CHAR_CODE('QDpt') -typeQDRegion = FOUR_CHAR_CODE('Qrgn') -typeRectangle = FOUR_CHAR_CODE('crec') -typeRGB16 = FOUR_CHAR_CODE('tr16') -typeRGB96 = FOUR_CHAR_CODE('tr96') -typeRGBColor = FOUR_CHAR_CODE('cRGB') -typeRotation = FOUR_CHAR_CODE('trot') -typeRoundedRectangle = FOUR_CHAR_CODE('crrc') -typeRow = FOUR_CHAR_CODE('crow') -typeScrapStyles = FOUR_CHAR_CODE('styl') -typeScript = FOUR_CHAR_CODE('scpt') -typeStyledText = FOUR_CHAR_CODE('STXT') -typeSuiteInfo = FOUR_CHAR_CODE('suin') -typeTable = FOUR_CHAR_CODE('ctbl') -typeTextStyles = FOUR_CHAR_CODE('tsty') -typeTIFF = FOUR_CHAR_CODE('TIFF') -typeVersion = FOUR_CHAR_CODE('vers') -kAEMenuClass = FOUR_CHAR_CODE('menu') -kAEMenuSelect = FOUR_CHAR_CODE('mhit') -kAEMouseDown = FOUR_CHAR_CODE('mdwn') -kAEMouseDownInBack = FOUR_CHAR_CODE('mdbk') -kAEKeyDown = FOUR_CHAR_CODE('kdwn') -kAEResized = FOUR_CHAR_CODE('rsiz') -kAEPromise = FOUR_CHAR_CODE('prom') -keyMenuID = FOUR_CHAR_CODE('mid ') -keyMenuItem = FOUR_CHAR_CODE('mitm') -keyCloseAllWindows = FOUR_CHAR_CODE('caw ') -keyOriginalBounds = FOUR_CHAR_CODE('obnd') -keyNewBounds = FOUR_CHAR_CODE('nbnd') -keyLocalWhere = FOUR_CHAR_CODE('lwhr') -typeHIMenu = FOUR_CHAR_CODE('mobj') -typeHIWindow = FOUR_CHAR_CODE('wobj') -kBySmallIcon = 0 -kByIconView = 1 -kByNameView = 2 -kByDateView = 3 -kBySizeView = 4 -kByKindView = 5 -kByCommentView = 6 -kByLabelView = 7 -kByVersionView = 8 -kAEInfo = 11 -kAEMain = 0 -kAESharing = 13 -kAEZoomIn = 7 -kAEZoomOut = 8 -kTextServiceClass = FOUR_CHAR_CODE('tsvc') -kUpdateActiveInputArea = FOUR_CHAR_CODE('updt') -kShowHideInputWindow = FOUR_CHAR_CODE('shiw') -kPos2Offset = FOUR_CHAR_CODE('p2st') -kOffset2Pos = FOUR_CHAR_CODE('st2p') -kUnicodeNotFromInputMethod = FOUR_CHAR_CODE('unim') -kGetSelectedText = FOUR_CHAR_CODE('gtxt') -keyAETSMDocumentRefcon = FOUR_CHAR_CODE('refc') -keyAEServerInstance = FOUR_CHAR_CODE('srvi') -keyAETheData = FOUR_CHAR_CODE('kdat') -keyAEFixLength = FOUR_CHAR_CODE('fixl') -keyAEUpdateRange = FOUR_CHAR_CODE('udng') -keyAECurrentPoint = FOUR_CHAR_CODE('cpos') -keyAEBufferSize = FOUR_CHAR_CODE('buff') -keyAEMoveView = FOUR_CHAR_CODE('mvvw') -keyAENextBody = FOUR_CHAR_CODE('nxbd') -keyAETSMScriptTag = FOUR_CHAR_CODE('sclg') -keyAETSMTextFont = FOUR_CHAR_CODE('ktxf') -keyAETSMTextFMFont = FOUR_CHAR_CODE('ktxm') -keyAETSMTextPointSize = FOUR_CHAR_CODE('ktps') -keyAETSMEventRecord = FOUR_CHAR_CODE('tevt') -keyAETSMEventRef = FOUR_CHAR_CODE('tevr') -keyAETextServiceEncoding = FOUR_CHAR_CODE('tsen') -keyAETextServiceMacEncoding = FOUR_CHAR_CODE('tmen') -typeTextRange = FOUR_CHAR_CODE('txrn') -typeComponentInstance = FOUR_CHAR_CODE('cmpi') -typeOffsetArray = FOUR_CHAR_CODE('ofay') -typeTextRangeArray = FOUR_CHAR_CODE('tray') -typeLowLevelEventRecord = FOUR_CHAR_CODE('evtr') -typeEventRef = FOUR_CHAR_CODE('evrf') -typeText = typeChar -kTSMOutsideOfBody = 1 -kTSMInsideOfBody = 2 -kTSMInsideOfActiveInputArea = 3 -kNextBody = 1 -kPreviousBody = 2 -kCaretPosition = 1 -kRawText = 2 -kSelectedRawText = 3 -kConvertedText = 4 -kSelectedConvertedText = 5 -kBlockFillText = 6 -kOutlineText = 7 -kSelectedText = 8 -keyAEHiliteRange = FOUR_CHAR_CODE('hrng') -keyAEPinRange = FOUR_CHAR_CODE('pnrg') -keyAEClauseOffsets = FOUR_CHAR_CODE('clau') -keyAEOffset = FOUR_CHAR_CODE('ofst') -keyAEPoint = FOUR_CHAR_CODE('gpos') -keyAELeftSide = FOUR_CHAR_CODE('klef') -keyAERegionClass = FOUR_CHAR_CODE('rgnc') -keyAEDragging = FOUR_CHAR_CODE('bool') -keyAELeadingEdge = keyAELeftSide -typeUnicodeText = FOUR_CHAR_CODE('utxt') -typeStyledUnicodeText = FOUR_CHAR_CODE('sutx') -typeEncodedString = FOUR_CHAR_CODE('encs') -typeCString = FOUR_CHAR_CODE('cstr') -typePString = FOUR_CHAR_CODE('pstr') -typeMeters = FOUR_CHAR_CODE('metr') -typeInches = FOUR_CHAR_CODE('inch') -typeFeet = FOUR_CHAR_CODE('feet') -typeYards = FOUR_CHAR_CODE('yard') -typeMiles = FOUR_CHAR_CODE('mile') -typeKilometers = FOUR_CHAR_CODE('kmtr') -typeCentimeters = FOUR_CHAR_CODE('cmtr') -typeSquareMeters = FOUR_CHAR_CODE('sqrm') -typeSquareFeet = FOUR_CHAR_CODE('sqft') -typeSquareYards = FOUR_CHAR_CODE('sqyd') -typeSquareMiles = FOUR_CHAR_CODE('sqmi') -typeSquareKilometers = FOUR_CHAR_CODE('sqkm') -typeLiters = FOUR_CHAR_CODE('litr') -typeQuarts = FOUR_CHAR_CODE('qrts') -typeGallons = FOUR_CHAR_CODE('galn') -typeCubicMeters = FOUR_CHAR_CODE('cmet') -typeCubicFeet = FOUR_CHAR_CODE('cfet') -typeCubicInches = FOUR_CHAR_CODE('cuin') -typeCubicCentimeter = FOUR_CHAR_CODE('ccmt') -typeCubicYards = FOUR_CHAR_CODE('cyrd') -typeKilograms = FOUR_CHAR_CODE('kgrm') -typeGrams = FOUR_CHAR_CODE('gram') -typeOunces = FOUR_CHAR_CODE('ozs ') -typePounds = FOUR_CHAR_CODE('lbs ') -typeDegreesC = FOUR_CHAR_CODE('degc') -typeDegreesF = FOUR_CHAR_CODE('degf') -typeDegreesK = FOUR_CHAR_CODE('degk') -kFAServerApp = FOUR_CHAR_CODE('ssrv') -kDoFolderActionEvent = FOUR_CHAR_CODE('fola') -kFolderActionCode = FOUR_CHAR_CODE('actn') -kFolderOpenedEvent = FOUR_CHAR_CODE('fopn') -kFolderClosedEvent = FOUR_CHAR_CODE('fclo') -kFolderWindowMovedEvent = FOUR_CHAR_CODE('fsiz') -kFolderItemsAddedEvent = FOUR_CHAR_CODE('fget') -kFolderItemsRemovedEvent = FOUR_CHAR_CODE('flos') -kItemList = FOUR_CHAR_CODE('flst') -kNewSizeParameter = FOUR_CHAR_CODE('fnsz') -kFASuiteCode = FOUR_CHAR_CODE('faco') -kFAAttachCommand = FOUR_CHAR_CODE('atfa') -kFARemoveCommand = FOUR_CHAR_CODE('rmfa') -kFAEditCommand = FOUR_CHAR_CODE('edfa') -kFAFileParam = FOUR_CHAR_CODE('faal') -kFAIndexParam = FOUR_CHAR_CODE('indx') -kAEInternetSuite = FOUR_CHAR_CODE('gurl') -kAEISWebStarSuite = FOUR_CHAR_CODE('WWW\xbd') -kAEISGetURL = FOUR_CHAR_CODE('gurl') -KAEISHandleCGI = FOUR_CHAR_CODE('sdoc') -cURL = FOUR_CHAR_CODE('url ') -cInternetAddress = FOUR_CHAR_CODE('IPAD') -cHTML = FOUR_CHAR_CODE('html') -cFTPItem = FOUR_CHAR_CODE('ftp ') -kAEISHTTPSearchArgs = FOUR_CHAR_CODE('kfor') -kAEISPostArgs = FOUR_CHAR_CODE('post') -kAEISMethod = FOUR_CHAR_CODE('meth') -kAEISClientAddress = FOUR_CHAR_CODE('addr') -kAEISUserName = FOUR_CHAR_CODE('user') -kAEISPassword = FOUR_CHAR_CODE('pass') -kAEISFromUser = FOUR_CHAR_CODE('frmu') -kAEISServerName = FOUR_CHAR_CODE('svnm') -kAEISServerPort = FOUR_CHAR_CODE('svpt') -kAEISScriptName = FOUR_CHAR_CODE('scnm') -kAEISContentType = FOUR_CHAR_CODE('ctyp') -kAEISReferrer = FOUR_CHAR_CODE('refr') -kAEISUserAgent = FOUR_CHAR_CODE('Agnt') -kAEISAction = FOUR_CHAR_CODE('Kact') -kAEISActionPath = FOUR_CHAR_CODE('Kapt') -kAEISClientIP = FOUR_CHAR_CODE('Kcip') -kAEISFullRequest = FOUR_CHAR_CODE('Kfrq') -pScheme = FOUR_CHAR_CODE('pusc') -pHost = FOUR_CHAR_CODE('HOST') -pPath = FOUR_CHAR_CODE('FTPc') -pUserName = FOUR_CHAR_CODE('RAun') -pUserPassword = FOUR_CHAR_CODE('RApw') -pDNSForm = FOUR_CHAR_CODE('pDNS') -pURL = FOUR_CHAR_CODE('pURL') -pTextEncoding = FOUR_CHAR_CODE('ptxe') -pFTPKind = FOUR_CHAR_CODE('kind') -eScheme = FOUR_CHAR_CODE('esch') -eurlHTTP = FOUR_CHAR_CODE('http') -eurlHTTPS = FOUR_CHAR_CODE('htps') -eurlFTP = FOUR_CHAR_CODE('ftp ') -eurlMail = FOUR_CHAR_CODE('mail') -eurlFile = FOUR_CHAR_CODE('file') -eurlGopher = FOUR_CHAR_CODE('gphr') -eurlTelnet = FOUR_CHAR_CODE('tlnt') -eurlNews = FOUR_CHAR_CODE('news') -eurlSNews = FOUR_CHAR_CODE('snws') -eurlNNTP = FOUR_CHAR_CODE('nntp') -eurlMessage = FOUR_CHAR_CODE('mess') -eurlMailbox = FOUR_CHAR_CODE('mbox') -eurlMulti = FOUR_CHAR_CODE('mult') -eurlLaunch = FOUR_CHAR_CODE('laun') -eurlAFP = FOUR_CHAR_CODE('afp ') -eurlAT = FOUR_CHAR_CODE('at ') -eurlEPPC = FOUR_CHAR_CODE('eppc') -eurlRTSP = FOUR_CHAR_CODE('rtsp') -eurlIMAP = FOUR_CHAR_CODE('imap') -eurlNFS = FOUR_CHAR_CODE('unfs') -eurlPOP = FOUR_CHAR_CODE('upop') -eurlLDAP = FOUR_CHAR_CODE('uldp') -eurlUnknown = FOUR_CHAR_CODE('url?') -kConnSuite = FOUR_CHAR_CODE('macc') -cDevSpec = FOUR_CHAR_CODE('cdev') -cAddressSpec = FOUR_CHAR_CODE('cadr') -cADBAddress = FOUR_CHAR_CODE('cadb') -cAppleTalkAddress = FOUR_CHAR_CODE('cat ') -cBusAddress = FOUR_CHAR_CODE('cbus') -cEthernetAddress = FOUR_CHAR_CODE('cen ') -cFireWireAddress = FOUR_CHAR_CODE('cfw ') -cIPAddress = FOUR_CHAR_CODE('cip ') -cLocalTalkAddress = FOUR_CHAR_CODE('clt ') -cSCSIAddress = FOUR_CHAR_CODE('cscs') -cTokenRingAddress = FOUR_CHAR_CODE('ctok') -cUSBAddress = FOUR_CHAR_CODE('cusb') -pDeviceType = FOUR_CHAR_CODE('pdvt') -pDeviceAddress = FOUR_CHAR_CODE('pdva') -pConduit = FOUR_CHAR_CODE('pcon') -pProtocol = FOUR_CHAR_CODE('pprt') -pATMachine = FOUR_CHAR_CODE('patm') -pATZone = FOUR_CHAR_CODE('patz') -pATType = FOUR_CHAR_CODE('patt') -pDottedDecimal = FOUR_CHAR_CODE('pipd') -pDNS = FOUR_CHAR_CODE('pdns') -pPort = FOUR_CHAR_CODE('ppor') -pNetwork = FOUR_CHAR_CODE('pnet') -pNode = FOUR_CHAR_CODE('pnod') -pSocket = FOUR_CHAR_CODE('psoc') -pSCSIBus = FOUR_CHAR_CODE('pscb') -pSCSILUN = FOUR_CHAR_CODE('pslu') -eDeviceType = FOUR_CHAR_CODE('edvt') -eAddressSpec = FOUR_CHAR_CODE('eads') -eConduit = FOUR_CHAR_CODE('econ') -eProtocol = FOUR_CHAR_CODE('epro') -eADB = FOUR_CHAR_CODE('eadb') -eAnalogAudio = FOUR_CHAR_CODE('epau') -eAppleTalk = FOUR_CHAR_CODE('epat') -eAudioLineIn = FOUR_CHAR_CODE('ecai') -eAudioLineOut = FOUR_CHAR_CODE('ecal') -eAudioOut = FOUR_CHAR_CODE('ecao') -eBus = FOUR_CHAR_CODE('ebus') -eCDROM = FOUR_CHAR_CODE('ecd ') -eCommSlot = FOUR_CHAR_CODE('eccm') -eDigitalAudio = FOUR_CHAR_CODE('epda') -eDisplay = FOUR_CHAR_CODE('edds') -eDVD = FOUR_CHAR_CODE('edvd') -eEthernet = FOUR_CHAR_CODE('ecen') -eFireWire = FOUR_CHAR_CODE('ecfw') -eFloppy = FOUR_CHAR_CODE('efd ') -eHD = FOUR_CHAR_CODE('ehd ') -eInfrared = FOUR_CHAR_CODE('ecir') -eIP = FOUR_CHAR_CODE('epip') -eIrDA = FOUR_CHAR_CODE('epir') -eIRTalk = FOUR_CHAR_CODE('epit') -eKeyboard = FOUR_CHAR_CODE('ekbd') -eLCD = FOUR_CHAR_CODE('edlc') -eLocalTalk = FOUR_CHAR_CODE('eclt') -eMacIP = FOUR_CHAR_CODE('epmi') -eMacVideo = FOUR_CHAR_CODE('epmv') -eMicrophone = FOUR_CHAR_CODE('ecmi') -eModemPort = FOUR_CHAR_CODE('ecmp') -eModemPrinterPort = FOUR_CHAR_CODE('empp') -eModem = FOUR_CHAR_CODE('edmm') -eMonitorOut = FOUR_CHAR_CODE('ecmn') -eMouse = FOUR_CHAR_CODE('emou') -eNuBusCard = FOUR_CHAR_CODE('ednb') -eNuBus = FOUR_CHAR_CODE('enub') -ePCcard = FOUR_CHAR_CODE('ecpc') -ePCIbus = FOUR_CHAR_CODE('ecpi') -ePCIcard = FOUR_CHAR_CODE('edpi') -ePDSslot = FOUR_CHAR_CODE('ecpd') -ePDScard = FOUR_CHAR_CODE('epds') -ePointingDevice = FOUR_CHAR_CODE('edpd') -ePostScript = FOUR_CHAR_CODE('epps') -ePPP = FOUR_CHAR_CODE('eppp') -ePrinterPort = FOUR_CHAR_CODE('ecpp') -ePrinter = FOUR_CHAR_CODE('edpr') -eSvideo = FOUR_CHAR_CODE('epsv') -eSCSI = FOUR_CHAR_CODE('ecsc') -eSerial = FOUR_CHAR_CODE('epsr') -eSpeakers = FOUR_CHAR_CODE('edsp') -eStorageDevice = FOUR_CHAR_CODE('edst') -eSVGA = FOUR_CHAR_CODE('epsg') -eTokenRing = FOUR_CHAR_CODE('etok') -eTrackball = FOUR_CHAR_CODE('etrk') -eTrackpad = FOUR_CHAR_CODE('edtp') -eUSB = FOUR_CHAR_CODE('ecus') -eVideoIn = FOUR_CHAR_CODE('ecvi') -eVideoMonitor = FOUR_CHAR_CODE('edvm') -eVideoOut = FOUR_CHAR_CODE('ecvo') -cKeystroke = FOUR_CHAR_CODE('kprs') -pKeystrokeKey = FOUR_CHAR_CODE('kMsg') -pModifiers = FOUR_CHAR_CODE('kMod') -pKeyKind = FOUR_CHAR_CODE('kknd') -eModifiers = FOUR_CHAR_CODE('eMds') -eOptionDown = FOUR_CHAR_CODE('Kopt') -eCommandDown = FOUR_CHAR_CODE('Kcmd') -eControlDown = FOUR_CHAR_CODE('Kctl') -eShiftDown = FOUR_CHAR_CODE('Ksft') -eCapsLockDown = FOUR_CHAR_CODE('Kclk') -eKeyKind = FOUR_CHAR_CODE('ekst') -eEscapeKey = 0x6B733500 -eDeleteKey = 0x6B733300 -eTabKey = 0x6B733000 -eReturnKey = 0x6B732400 -eClearKey = 0x6B734700 -eEnterKey = 0x6B734C00 -eUpArrowKey = 0x6B737E00 -eDownArrowKey = 0x6B737D00 -eLeftArrowKey = 0x6B737B00 -eRightArrowKey = 0x6B737C00 -eHelpKey = 0x6B737200 -eHomeKey = 0x6B737300 -ePageUpKey = 0x6B737400 -ePageDownKey = 0x6B737900 -eForwardDelKey = 0x6B737500 -eEndKey = 0x6B737700 -eF1Key = 0x6B737A00 -eF2Key = 0x6B737800 -eF3Key = 0x6B736300 -eF4Key = 0x6B737600 -eF5Key = 0x6B736000 -eF6Key = 0x6B736100 -eF7Key = 0x6B736200 -eF8Key = 0x6B736400 -eF9Key = 0x6B736500 -eF10Key = 0x6B736D00 -eF11Key = 0x6B736700 -eF12Key = 0x6B736F00 -eF13Key = 0x6B736900 -eF14Key = 0x6B736B00 -eF15Key = 0x6B737100 -kAEAND = FOUR_CHAR_CODE('AND ') -kAEOR = FOUR_CHAR_CODE('OR ') -kAENOT = FOUR_CHAR_CODE('NOT ') -kAEFirst = FOUR_CHAR_CODE('firs') -kAELast = FOUR_CHAR_CODE('last') -kAEMiddle = FOUR_CHAR_CODE('midd') -kAEAny = FOUR_CHAR_CODE('any ') -kAEAll = FOUR_CHAR_CODE('all ') -kAENext = FOUR_CHAR_CODE('next') -kAEPrevious = FOUR_CHAR_CODE('prev') -keyAECompOperator = FOUR_CHAR_CODE('relo') -keyAELogicalTerms = FOUR_CHAR_CODE('term') -keyAELogicalOperator = FOUR_CHAR_CODE('logc') -keyAEObject1 = FOUR_CHAR_CODE('obj1') -keyAEObject2 = FOUR_CHAR_CODE('obj2') -keyAEDesiredClass = FOUR_CHAR_CODE('want') -keyAEContainer = FOUR_CHAR_CODE('from') -keyAEKeyForm = FOUR_CHAR_CODE('form') -keyAEKeyData = FOUR_CHAR_CODE('seld') -keyAERangeStart = FOUR_CHAR_CODE('star') -keyAERangeStop = FOUR_CHAR_CODE('stop') -keyDisposeTokenProc = FOUR_CHAR_CODE('xtok') -keyAECompareProc = FOUR_CHAR_CODE('cmpr') -keyAECountProc = FOUR_CHAR_CODE('cont') -keyAEMarkTokenProc = FOUR_CHAR_CODE('mkid') -keyAEMarkProc = FOUR_CHAR_CODE('mark') -keyAEAdjustMarksProc = FOUR_CHAR_CODE('adjm') -keyAEGetErrDescProc = FOUR_CHAR_CODE('indc') -formAbsolutePosition = FOUR_CHAR_CODE('indx') -formRelativePosition = FOUR_CHAR_CODE('rele') -formTest = FOUR_CHAR_CODE('test') -formRange = FOUR_CHAR_CODE('rang') -formPropertyID = FOUR_CHAR_CODE('prop') -formName = FOUR_CHAR_CODE('name') -typeObjectSpecifier = FOUR_CHAR_CODE('obj ') -typeObjectBeingExamined = FOUR_CHAR_CODE('exmn') -typeCurrentContainer = FOUR_CHAR_CODE('ccnt') -typeToken = FOUR_CHAR_CODE('toke') -typeRelativeDescriptor = FOUR_CHAR_CODE('rel ') -typeAbsoluteOrdinal = FOUR_CHAR_CODE('abso') -typeIndexDescriptor = FOUR_CHAR_CODE('inde') -typeRangeDescriptor = FOUR_CHAR_CODE('rang') -typeLogicalDescriptor = FOUR_CHAR_CODE('logi') -typeCompDescriptor = FOUR_CHAR_CODE('cmpd') -typeOSLTokenList = FOUR_CHAR_CODE('ostl') -kAEIDoMinimum = 0x0000 -kAEIDoWhose = 0x0001 -kAEIDoMarking = 0x0004 -kAEPassSubDescs = 0x0008 -kAEResolveNestedLists = 0x0010 -kAEHandleSimpleRanges = 0x0020 -kAEUseRelativeIterators = 0x0040 -typeWhoseDescriptor = FOUR_CHAR_CODE('whos') -formWhose = FOUR_CHAR_CODE('whos') -typeWhoseRange = FOUR_CHAR_CODE('wrng') -keyAEWhoseRangeStart = FOUR_CHAR_CODE('wstr') -keyAEWhoseRangeStop = FOUR_CHAR_CODE('wstp') -keyAEIndex = FOUR_CHAR_CODE('kidx') -keyAETest = FOUR_CHAR_CODE('ktst') diff --git a/sys/lib/python/plat-mac/Carbon/AppleHelp.py b/sys/lib/python/plat-mac/Carbon/AppleHelp.py deleted file mode 100644 index 3496d5926..000000000 --- a/sys/lib/python/plat-mac/Carbon/AppleHelp.py +++ /dev/null @@ -1,6 +0,0 @@ -# Generated from 'AppleHelp.h' - -kAHInternalErr = -10790 -kAHInternetConfigPrefErr = -10791 -kAHTOCTypeUser = 0 -kAHTOCTypeDeveloper = 1 diff --git a/sys/lib/python/plat-mac/Carbon/CF.py b/sys/lib/python/plat-mac/Carbon/CF.py deleted file mode 100644 index 4a784c0f8..000000000 --- a/sys/lib/python/plat-mac/Carbon/CF.py +++ /dev/null @@ -1 +0,0 @@ -from _CF import * diff --git a/sys/lib/python/plat-mac/Carbon/CG.py b/sys/lib/python/plat-mac/Carbon/CG.py deleted file mode 100755 index 96f577232..000000000 --- a/sys/lib/python/plat-mac/Carbon/CG.py +++ /dev/null @@ -1 +0,0 @@ -from _CG import * diff --git a/sys/lib/python/plat-mac/Carbon/CarbonEvents.py b/sys/lib/python/plat-mac/Carbon/CarbonEvents.py deleted file mode 100755 index 357ee5d38..000000000 --- a/sys/lib/python/plat-mac/Carbon/CarbonEvents.py +++ /dev/null @@ -1,451 +0,0 @@ -# Generated from 'CarbonEvents.h' - -def FOUR_CHAR_CODE(x): return x -def FOUR_CHAR_CODE(x): return x -false = 0 -true = 1 -keyAEEventClass = FOUR_CHAR_CODE('evcl') -keyAEEventID = FOUR_CHAR_CODE('evti') -eventAlreadyPostedErr = -9860 -eventTargetBusyErr = -9861 -eventClassInvalidErr = -9862 -eventClassIncorrectErr = -9864 -eventHandlerAlreadyInstalledErr = -9866 -eventInternalErr = -9868 -eventKindIncorrectErr = -9869 -eventParameterNotFoundErr = -9870 -eventNotHandledErr = -9874 -eventLoopTimedOutErr = -9875 -eventLoopQuitErr = -9876 -eventNotInQueueErr = -9877 -eventHotKeyExistsErr = -9878 -eventHotKeyInvalidErr = -9879 -kEventPriorityLow = 0 -kEventPriorityStandard = 1 -kEventPriorityHigh = 2 -kEventLeaveInQueue = false -kEventRemoveFromQueue = true -kTrackMouseLocationOptionDontConsumeMouseUp = (1 << 0) -kMouseTrackingMouseDown = 1 -kMouseTrackingMouseUp = 2 -kMouseTrackingMouseExited = 3 -kMouseTrackingMouseEntered = 4 -kMouseTrackingMouseDragged = 5 -kMouseTrackingKeyModifiersChanged = 6 -kMouseTrackingUserCancelled = 7 -kMouseTrackingTimedOut = 8 -kMouseTrackingMouseMoved = 9 -kEventAttributeNone = 0 -kEventAttributeUserEvent = (1 << 0) -kEventClassMouse = FOUR_CHAR_CODE('mous') -kEventClassKeyboard = FOUR_CHAR_CODE('keyb') -kEventClassTextInput = FOUR_CHAR_CODE('text') -kEventClassApplication = FOUR_CHAR_CODE('appl') -kEventClassAppleEvent = FOUR_CHAR_CODE('eppc') -kEventClassMenu = FOUR_CHAR_CODE('menu') -kEventClassWindow = FOUR_CHAR_CODE('wind') -kEventClassControl = FOUR_CHAR_CODE('cntl') -kEventClassCommand = FOUR_CHAR_CODE('cmds') -kEventClassTablet = FOUR_CHAR_CODE('tblt') -kEventClassVolume = FOUR_CHAR_CODE('vol ') -kEventClassAppearance = FOUR_CHAR_CODE('appm') -kEventClassService = FOUR_CHAR_CODE('serv') -kEventMouseDown = 1 -kEventMouseUp = 2 -kEventMouseMoved = 5 -kEventMouseDragged = 6 -kEventMouseWheelMoved = 10 -kEventMouseButtonPrimary = 1 -kEventMouseButtonSecondary = 2 -kEventMouseButtonTertiary = 3 -kEventMouseWheelAxisX = 0 -kEventMouseWheelAxisY = 1 -kEventTextInputUpdateActiveInputArea = 1 -kEventTextInputUnicodeForKeyEvent = 2 -kEventTextInputOffsetToPos = 3 -kEventTextInputPosToOffset = 4 -kEventTextInputShowHideBottomWindow = 5 -kEventTextInputGetSelectedText = 6 -kEventRawKeyDown = 1 -kEventRawKeyRepeat = 2 -kEventRawKeyUp = 3 -kEventRawKeyModifiersChanged = 4 -kEventHotKeyPressed = 5 -kEventHotKeyReleased = 6 -kEventKeyModifierNumLockBit = 16 -kEventKeyModifierFnBit = 17 -kEventKeyModifierNumLockMask = 1L << kEventKeyModifierNumLockBit -kEventKeyModifierFnMask = 1L << kEventKeyModifierFnBit -kEventAppActivated = 1 -kEventAppDeactivated = 2 -kEventAppQuit = 3 -kEventAppLaunchNotification = 4 -kEventAppLaunched = 5 -kEventAppTerminated = 6 -kEventAppFrontSwitched = 7 -kEventAppGetDockTileMenu = 20 -kEventAppleEvent = 1 -kEventWindowUpdate = 1 -kEventWindowDrawContent = 2 -kEventWindowActivated = 5 -kEventWindowDeactivated = 6 -kEventWindowGetClickActivation = 7 -kEventWindowShowing = 22 -kEventWindowHiding = 23 -kEventWindowShown = 24 -kEventWindowHidden = 25 -kEventWindowCollapsing = 86 -kEventWindowCollapsed = 67 -kEventWindowExpanding = 87 -kEventWindowExpanded = 70 -kEventWindowZoomed = 76 -kEventWindowBoundsChanging = 26 -kEventWindowBoundsChanged = 27 -kEventWindowResizeStarted = 28 -kEventWindowResizeCompleted = 29 -kEventWindowDragStarted = 30 -kEventWindowDragCompleted = 31 -kEventWindowClosed = 73 -kWindowBoundsChangeUserDrag = (1 << 0) -kWindowBoundsChangeUserResize = (1 << 1) -kWindowBoundsChangeSizeChanged = (1 << 2) -kWindowBoundsChangeOriginChanged = (1 << 3) -kWindowBoundsChangeZoom = (1 << 4) -kEventWindowClickDragRgn = 32 -kEventWindowClickResizeRgn = 33 -kEventWindowClickCollapseRgn = 34 -kEventWindowClickCloseRgn = 35 -kEventWindowClickZoomRgn = 36 -kEventWindowClickContentRgn = 37 -kEventWindowClickProxyIconRgn = 38 -kEventWindowClickToolbarButtonRgn = 41 -kEventWindowClickStructureRgn = 42 -kEventWindowCursorChange = 40 -kEventWindowCollapse = 66 -kEventWindowCollapseAll = 68 -kEventWindowExpand = 69 -kEventWindowExpandAll = 71 -kEventWindowClose = 72 -kEventWindowCloseAll = 74 -kEventWindowZoom = 75 -kEventWindowZoomAll = 77 -kEventWindowContextualMenuSelect = 78 -kEventWindowPathSelect = 79 -kEventWindowGetIdealSize = 80 -kEventWindowGetMinimumSize = 81 -kEventWindowGetMaximumSize = 82 -kEventWindowConstrain = 83 -kEventWindowHandleContentClick = 85 -kEventWindowProxyBeginDrag = 128 -kEventWindowProxyEndDrag = 129 -kEventWindowToolbarSwitchMode = 150 -kDockChangedUser = 1 -kDockChangedOrientation = 2 -kDockChangedAutohide = 3 -kDockChangedDisplay = 4 -kDockChangedItems = 5 -kDockChangedUnknown = 6 -kEventWindowFocusAcquired = 200 -kEventWindowFocusRelinquish = 201 -kEventWindowDrawFrame = 1000 -kEventWindowDrawPart = 1001 -kEventWindowGetRegion = 1002 -kEventWindowHitTest = 1003 -kEventWindowInit = 1004 -kEventWindowDispose = 1005 -kEventWindowDragHilite = 1006 -kEventWindowModified = 1007 -kEventWindowSetupProxyDragImage = 1008 -kEventWindowStateChanged = 1009 -kEventWindowMeasureTitle = 1010 -kEventWindowDrawGrowBox = 1011 -kEventWindowGetGrowImageRegion = 1012 -kEventWindowPaint = 1013 -kEventMenuBeginTracking = 1 -kEventMenuEndTracking = 2 -kEventMenuChangeTrackingMode = 3 -kEventMenuOpening = 4 -kEventMenuClosed = 5 -kEventMenuTargetItem = 6 -kEventMenuMatchKey = 7 -kEventMenuEnableItems = 8 -kEventMenuPopulate = 9 -kEventMenuMeasureItemWidth = 100 -kEventMenuMeasureItemHeight = 101 -kEventMenuDrawItem = 102 -kEventMenuDrawItemContent = 103 -kEventMenuDispose = 1001 -kMenuContextMenuBar = 1 << 0 -kMenuContextPullDown = 1 << 8 -kMenuContextPopUp = 1 << 9 -kMenuContextSubmenu = 1 << 10 -kMenuContextMenuBarTracking = 1 << 16 -kMenuContextPopUpTracking = 1 << 17 -kMenuContextKeyMatching = 1 << 18 -kMenuContextMenuEnabling = 1 << 19 -kMenuContextCommandIDSearch = 1 << 20 -kEventProcessCommand = 1 -kEventCommandProcess = 1 -kEventCommandUpdateStatus = 2 -kHICommandOK = FOUR_CHAR_CODE('ok ') -kHICommandCancel = FOUR_CHAR_CODE('not!') -kHICommandQuit = FOUR_CHAR_CODE('quit') -kHICommandUndo = FOUR_CHAR_CODE('undo') -kHICommandRedo = FOUR_CHAR_CODE('redo') -kHICommandCut = FOUR_CHAR_CODE('cut ') -kHICommandCopy = FOUR_CHAR_CODE('copy') -kHICommandPaste = FOUR_CHAR_CODE('past') -kHICommandClear = FOUR_CHAR_CODE('clea') -kHICommandSelectAll = FOUR_CHAR_CODE('sall') -kHICommandHide = FOUR_CHAR_CODE('hide') -kHICommandHideOthers = FOUR_CHAR_CODE('hido') -kHICommandShowAll = FOUR_CHAR_CODE('shal') -kHICommandPreferences = FOUR_CHAR_CODE('pref') -kHICommandZoomWindow = FOUR_CHAR_CODE('zoom') -kHICommandMinimizeWindow = FOUR_CHAR_CODE('mini') -kHICommandMinimizeAll = FOUR_CHAR_CODE('mina') -kHICommandMaximizeWindow = FOUR_CHAR_CODE('maxi') -kHICommandMaximizeAll = FOUR_CHAR_CODE('maxa') -kHICommandArrangeInFront = FOUR_CHAR_CODE('frnt') -kHICommandBringAllToFront = FOUR_CHAR_CODE('bfrt') -kHICommandWindowListSeparator = FOUR_CHAR_CODE('wldv') -kHICommandWindowListTerminator = FOUR_CHAR_CODE('wlst') -kHICommandSelectWindow = FOUR_CHAR_CODE('swin') -kHICommandAbout = FOUR_CHAR_CODE('abou') -kHICommandNew = FOUR_CHAR_CODE('new ') -kHICommandOpen = FOUR_CHAR_CODE('open') -kHICommandClose = FOUR_CHAR_CODE('clos') -kHICommandSave = FOUR_CHAR_CODE('save') -kHICommandSaveAs = FOUR_CHAR_CODE('svas') -kHICommandRevert = FOUR_CHAR_CODE('rvrt') -kHICommandPrint = FOUR_CHAR_CODE('prnt') -kHICommandPageSetup = FOUR_CHAR_CODE('page') -kHICommandAppHelp = FOUR_CHAR_CODE('ahlp') -kHICommandFromMenu = (1L << 0) -kHICommandFromControl = (1L << 1) -kHICommandFromWindow = (1L << 2) -kEventControlInitialize = 1000 -kEventControlDispose = 1001 -kEventControlGetOptimalBounds = 1003 -kEventControlDefInitialize = kEventControlInitialize -kEventControlDefDispose = kEventControlDispose -kEventControlHit = 1 -kEventControlSimulateHit = 2 -kEventControlHitTest = 3 -kEventControlDraw = 4 -kEventControlApplyBackground = 5 -kEventControlApplyTextColor = 6 -kEventControlSetFocusPart = 7 -kEventControlGetFocusPart = 8 -kEventControlActivate = 9 -kEventControlDeactivate = 10 -kEventControlSetCursor = 11 -kEventControlContextualMenuClick = 12 -kEventControlClick = 13 -kEventControlTrack = 51 -kEventControlGetScrollToHereStartPoint = 52 -kEventControlGetIndicatorDragConstraint = 53 -kEventControlIndicatorMoved = 54 -kEventControlGhostingFinished = 55 -kEventControlGetActionProcPart = 56 -kEventControlGetPartRegion = 101 -kEventControlGetPartBounds = 102 -kEventControlSetData = 103 -kEventControlGetData = 104 -kEventControlValueFieldChanged = 151 -kEventControlAddedSubControl = 152 -kEventControlRemovingSubControl = 153 -kEventControlBoundsChanged = 154 -kEventControlOwningWindowChanged = 159 -kEventControlArbitraryMessage = 201 -kControlBoundsChangeSizeChanged = (1 << 2) -kControlBoundsChangePositionChanged = (1 << 3) -kEventTabletPoint = 1 -kEventTabletProximity = 2 -kEventTabletPointer = 1 -kEventVolumeMounted = 1 -kEventVolumeUnmounted = 2 -typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') -kEventAppearanceScrollBarVariantChanged = 1 -kEventServiceCopy = 1 -kEventServicePaste = 2 -kEventServiceGetTypes = 3 -kEventServicePerform = 4 -kEventParamDirectObject = FOUR_CHAR_CODE('----') -kEventParamPostTarget = FOUR_CHAR_CODE('ptrg') -typeEventTargetRef = FOUR_CHAR_CODE('etrg') -kEventParamWindowRef = FOUR_CHAR_CODE('wind') -kEventParamGrafPort = FOUR_CHAR_CODE('graf') -kEventParamDragRef = FOUR_CHAR_CODE('drag') -kEventParamMenuRef = FOUR_CHAR_CODE('menu') -kEventParamEventRef = FOUR_CHAR_CODE('evnt') -kEventParamControlRef = FOUR_CHAR_CODE('ctrl') -kEventParamRgnHandle = FOUR_CHAR_CODE('rgnh') -kEventParamEnabled = FOUR_CHAR_CODE('enab') -kEventParamDimensions = FOUR_CHAR_CODE('dims') -kEventParamAvailableBounds = FOUR_CHAR_CODE('avlb') -kEventParamAEEventID = keyAEEventID -kEventParamAEEventClass = keyAEEventClass -kEventParamCGContextRef = FOUR_CHAR_CODE('cntx') -kEventParamDeviceDepth = FOUR_CHAR_CODE('devd') -kEventParamDeviceColor = FOUR_CHAR_CODE('devc') -typeWindowRef = FOUR_CHAR_CODE('wind') -typeGrafPtr = FOUR_CHAR_CODE('graf') -typeGWorldPtr = FOUR_CHAR_CODE('gwld') -typeDragRef = FOUR_CHAR_CODE('drag') -typeMenuRef = FOUR_CHAR_CODE('menu') -typeControlRef = FOUR_CHAR_CODE('ctrl') -typeCollection = FOUR_CHAR_CODE('cltn') -typeQDRgnHandle = FOUR_CHAR_CODE('rgnh') -typeOSStatus = FOUR_CHAR_CODE('osst') -typeCFStringRef = FOUR_CHAR_CODE('cfst') -typeCFIndex = FOUR_CHAR_CODE('cfix') -typeCFTypeRef = FOUR_CHAR_CODE('cfty') -typeCGContextRef = FOUR_CHAR_CODE('cntx') -typeHIPoint = FOUR_CHAR_CODE('hipt') -typeHISize = FOUR_CHAR_CODE('hisz') -typeHIRect = FOUR_CHAR_CODE('hirc') -kEventParamMouseLocation = FOUR_CHAR_CODE('mloc') -kEventParamMouseButton = FOUR_CHAR_CODE('mbtn') -kEventParamClickCount = FOUR_CHAR_CODE('ccnt') -kEventParamMouseWheelAxis = FOUR_CHAR_CODE('mwax') -kEventParamMouseWheelDelta = FOUR_CHAR_CODE('mwdl') -kEventParamMouseDelta = FOUR_CHAR_CODE('mdta') -kEventParamMouseChord = FOUR_CHAR_CODE('chor') -kEventParamTabletEventType = FOUR_CHAR_CODE('tblt') -typeMouseButton = FOUR_CHAR_CODE('mbtn') -typeMouseWheelAxis = FOUR_CHAR_CODE('mwax') -kEventParamKeyCode = FOUR_CHAR_CODE('kcod') -kEventParamKeyMacCharCodes = FOUR_CHAR_CODE('kchr') -kEventParamKeyModifiers = FOUR_CHAR_CODE('kmod') -kEventParamKeyUnicodes = FOUR_CHAR_CODE('kuni') -kEventParamKeyboardType = FOUR_CHAR_CODE('kbdt') -typeEventHotKeyID = FOUR_CHAR_CODE('hkid') -kEventParamTextInputSendRefCon = FOUR_CHAR_CODE('tsrc') -kEventParamTextInputSendComponentInstance = FOUR_CHAR_CODE('tsci') -kEventParamTextInputSendSLRec = FOUR_CHAR_CODE('tssl') -kEventParamTextInputReplySLRec = FOUR_CHAR_CODE('trsl') -kEventParamTextInputSendText = FOUR_CHAR_CODE('tstx') -kEventParamTextInputReplyText = FOUR_CHAR_CODE('trtx') -kEventParamTextInputSendUpdateRng = FOUR_CHAR_CODE('tsup') -kEventParamTextInputSendHiliteRng = FOUR_CHAR_CODE('tshi') -kEventParamTextInputSendClauseRng = FOUR_CHAR_CODE('tscl') -kEventParamTextInputSendPinRng = FOUR_CHAR_CODE('tspn') -kEventParamTextInputSendFixLen = FOUR_CHAR_CODE('tsfx') -kEventParamTextInputSendLeadingEdge = FOUR_CHAR_CODE('tsle') -kEventParamTextInputReplyLeadingEdge = FOUR_CHAR_CODE('trle') -kEventParamTextInputSendTextOffset = FOUR_CHAR_CODE('tsto') -kEventParamTextInputReplyTextOffset = FOUR_CHAR_CODE('trto') -kEventParamTextInputReplyRegionClass = FOUR_CHAR_CODE('trrg') -kEventParamTextInputSendCurrentPoint = FOUR_CHAR_CODE('tscp') -kEventParamTextInputSendDraggingMode = FOUR_CHAR_CODE('tsdm') -kEventParamTextInputReplyPoint = FOUR_CHAR_CODE('trpt') -kEventParamTextInputReplyFont = FOUR_CHAR_CODE('trft') -kEventParamTextInputReplyFMFont = FOUR_CHAR_CODE('trfm') -kEventParamTextInputReplyPointSize = FOUR_CHAR_CODE('trpz') -kEventParamTextInputReplyLineHeight = FOUR_CHAR_CODE('trlh') -kEventParamTextInputReplyLineAscent = FOUR_CHAR_CODE('trla') -kEventParamTextInputReplyTextAngle = FOUR_CHAR_CODE('trta') -kEventParamTextInputSendShowHide = FOUR_CHAR_CODE('tssh') -kEventParamTextInputReplyShowHide = FOUR_CHAR_CODE('trsh') -kEventParamTextInputSendKeyboardEvent = FOUR_CHAR_CODE('tske') -kEventParamTextInputSendTextServiceEncoding = FOUR_CHAR_CODE('tsse') -kEventParamTextInputSendTextServiceMacEncoding = FOUR_CHAR_CODE('tssm') -kEventParamHICommand = FOUR_CHAR_CODE('hcmd') -typeHICommand = FOUR_CHAR_CODE('hcmd') -kEventParamWindowFeatures = FOUR_CHAR_CODE('wftr') -kEventParamWindowDefPart = FOUR_CHAR_CODE('wdpc') -kEventParamCurrentBounds = FOUR_CHAR_CODE('crct') -kEventParamOriginalBounds = FOUR_CHAR_CODE('orct') -kEventParamPreviousBounds = FOUR_CHAR_CODE('prct') -kEventParamClickActivation = FOUR_CHAR_CODE('clac') -kEventParamWindowRegionCode = FOUR_CHAR_CODE('wshp') -kEventParamWindowDragHiliteFlag = FOUR_CHAR_CODE('wdhf') -kEventParamWindowModifiedFlag = FOUR_CHAR_CODE('wmff') -kEventParamWindowProxyGWorldPtr = FOUR_CHAR_CODE('wpgw') -kEventParamWindowProxyImageRgn = FOUR_CHAR_CODE('wpir') -kEventParamWindowProxyOutlineRgn = FOUR_CHAR_CODE('wpor') -kEventParamWindowStateChangedFlags = FOUR_CHAR_CODE('wscf') -kEventParamWindowTitleFullWidth = FOUR_CHAR_CODE('wtfw') -kEventParamWindowTitleTextWidth = FOUR_CHAR_CODE('wttw') -kEventParamWindowGrowRect = FOUR_CHAR_CODE('grct') -kEventParamAttributes = FOUR_CHAR_CODE('attr') -kEventParamDockChangedReason = FOUR_CHAR_CODE('dcrs') -kEventParamPreviousDockRect = FOUR_CHAR_CODE('pdrc') -kEventParamCurrentDockRect = FOUR_CHAR_CODE('cdrc') -typeWindowRegionCode = FOUR_CHAR_CODE('wshp') -typeWindowDefPartCode = FOUR_CHAR_CODE('wdpt') -typeClickActivationResult = FOUR_CHAR_CODE('clac') -kEventParamControlPart = FOUR_CHAR_CODE('cprt') -kEventParamInitCollection = FOUR_CHAR_CODE('icol') -kEventParamControlMessage = FOUR_CHAR_CODE('cmsg') -kEventParamControlParam = FOUR_CHAR_CODE('cprm') -kEventParamControlResult = FOUR_CHAR_CODE('crsl') -kEventParamControlRegion = FOUR_CHAR_CODE('crgn') -kEventParamControlAction = FOUR_CHAR_CODE('caup') -kEventParamControlIndicatorDragConstraint = FOUR_CHAR_CODE('cidc') -kEventParamControlIndicatorRegion = FOUR_CHAR_CODE('cirn') -kEventParamControlIsGhosting = FOUR_CHAR_CODE('cgst') -kEventParamControlIndicatorOffset = FOUR_CHAR_CODE('ciof') -kEventParamControlClickActivationResult = FOUR_CHAR_CODE('ccar') -kEventParamControlSubControl = FOUR_CHAR_CODE('csub') -kEventParamControlOptimalBounds = FOUR_CHAR_CODE('cobn') -kEventParamControlOptimalBaselineOffset = FOUR_CHAR_CODE('cobo') -kEventParamControlDataTag = FOUR_CHAR_CODE('cdtg') -kEventParamControlDataBuffer = FOUR_CHAR_CODE('cdbf') -kEventParamControlDataBufferSize = FOUR_CHAR_CODE('cdbs') -kEventParamControlDrawDepth = FOUR_CHAR_CODE('cddp') -kEventParamControlDrawInColor = FOUR_CHAR_CODE('cdic') -kEventParamControlFeatures = FOUR_CHAR_CODE('cftr') -kEventParamControlPartBounds = FOUR_CHAR_CODE('cpbd') -kEventParamControlOriginalOwningWindow = FOUR_CHAR_CODE('coow') -kEventParamControlCurrentOwningWindow = FOUR_CHAR_CODE('ccow') -typeControlActionUPP = FOUR_CHAR_CODE('caup') -typeIndicatorDragConstraint = FOUR_CHAR_CODE('cidc') -typeControlPartCode = FOUR_CHAR_CODE('cprt') -kEventParamCurrentMenuTrackingMode = FOUR_CHAR_CODE('cmtm') -kEventParamNewMenuTrackingMode = FOUR_CHAR_CODE('nmtm') -kEventParamMenuFirstOpen = FOUR_CHAR_CODE('1sto') -kEventParamMenuItemIndex = FOUR_CHAR_CODE('item') -kEventParamMenuCommand = FOUR_CHAR_CODE('mcmd') -kEventParamEnableMenuForKeyEvent = FOUR_CHAR_CODE('fork') -kEventParamMenuEventOptions = FOUR_CHAR_CODE('meop') -kEventParamMenuContext = FOUR_CHAR_CODE('mctx') -kEventParamMenuItemBounds = FOUR_CHAR_CODE('mitb') -kEventParamMenuMarkBounds = FOUR_CHAR_CODE('mmkb') -kEventParamMenuIconBounds = FOUR_CHAR_CODE('micb') -kEventParamMenuTextBounds = FOUR_CHAR_CODE('mtxb') -kEventParamMenuTextBaseline = FOUR_CHAR_CODE('mtbl') -kEventParamMenuCommandKeyBounds = FOUR_CHAR_CODE('mcmb') -kEventParamMenuVirtualTop = FOUR_CHAR_CODE('mvrt') -kEventParamMenuVirtualBottom = FOUR_CHAR_CODE('mvrb') -kEventParamMenuDrawState = FOUR_CHAR_CODE('mdrs') -kEventParamMenuItemType = FOUR_CHAR_CODE('mitp') -kEventParamMenuItemWidth = FOUR_CHAR_CODE('mitw') -kEventParamMenuItemHeight = FOUR_CHAR_CODE('mith') -typeMenuItemIndex = FOUR_CHAR_CODE('midx') -typeMenuCommand = FOUR_CHAR_CODE('mcmd') -typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd') -typeMenuEventOptions = FOUR_CHAR_CODE('meop') -typeThemeMenuState = FOUR_CHAR_CODE('tmns') -typeThemeMenuItemType = FOUR_CHAR_CODE('tmit') -kEventParamProcessID = FOUR_CHAR_CODE('psn ') -kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref') -kEventParamLaunchErr = FOUR_CHAR_CODE('err ') -kEventParamTabletPointRec = FOUR_CHAR_CODE('tbrc') -kEventParamTabletProximityRec = FOUR_CHAR_CODE('tbpx') -typeTabletPointRec = FOUR_CHAR_CODE('tbrc') -typeTabletProximityRec = FOUR_CHAR_CODE('tbpx') -kEventParamTabletPointerRec = FOUR_CHAR_CODE('tbrc') -typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') -kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') -kEventParamScrapRef = FOUR_CHAR_CODE('scrp') -kEventParamServiceCopyTypes = FOUR_CHAR_CODE('svsd') -kEventParamServicePasteTypes = FOUR_CHAR_CODE('svpt') -kEventParamServiceMessageName = FOUR_CHAR_CODE('svmg') -kEventParamServiceUserData = FOUR_CHAR_CODE('svud') -typeScrapRef = FOUR_CHAR_CODE('scrp') -typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma') -# sHandler = NewEventHandlerUPP( x ) -kMouseTrackingMousePressed = kMouseTrackingMouseDown -kMouseTrackingMouseReleased = kMouseTrackingMouseUp diff --git a/sys/lib/python/plat-mac/Carbon/CarbonEvt.py b/sys/lib/python/plat-mac/Carbon/CarbonEvt.py deleted file mode 100755 index 63a779299..000000000 --- a/sys/lib/python/plat-mac/Carbon/CarbonEvt.py +++ /dev/null @@ -1 +0,0 @@ -from _CarbonEvt import * diff --git a/sys/lib/python/plat-mac/Carbon/Cm.py b/sys/lib/python/plat-mac/Carbon/Cm.py deleted file mode 100644 index 3c8bc331b..000000000 --- a/sys/lib/python/plat-mac/Carbon/Cm.py +++ /dev/null @@ -1 +0,0 @@ -from _Cm import * diff --git a/sys/lib/python/plat-mac/Carbon/Components.py b/sys/lib/python/plat-mac/Carbon/Components.py deleted file mode 100644 index 75574cf6d..000000000 --- a/sys/lib/python/plat-mac/Carbon/Components.py +++ /dev/null @@ -1,62 +0,0 @@ -# Generated from 'Components.h' - -def FOUR_CHAR_CODE(x): return x -kAppleManufacturer = FOUR_CHAR_CODE('appl') -kComponentResourceType = FOUR_CHAR_CODE('thng') -kComponentAliasResourceType = FOUR_CHAR_CODE('thga') -kAnyComponentType = 0 -kAnyComponentSubType = 0 -kAnyComponentManufacturer = 0 -kAnyComponentFlagsMask = 0 -cmpIsMissing = 1L << 29 -cmpWantsRegisterMessage = 1L << 31 -kComponentOpenSelect = -1 -kComponentCloseSelect = -2 -kComponentCanDoSelect = -3 -kComponentVersionSelect = -4 -kComponentRegisterSelect = -5 -kComponentTargetSelect = -6 -kComponentUnregisterSelect = -7 -kComponentGetMPWorkFunctionSelect = -8 -kComponentExecuteWiredActionSelect = -9 -kComponentGetPublicResourceSelect = -10 -componentDoAutoVersion = (1 << 0) -componentWantsUnregister = (1 << 1) -componentAutoVersionIncludeFlags = (1 << 2) -componentHasMultiplePlatforms = (1 << 3) -componentLoadResident = (1 << 4) -defaultComponentIdentical = 0 -defaultComponentAnyFlags = 1 -defaultComponentAnyManufacturer = 2 -defaultComponentAnySubType = 4 -defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer) -defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType) -registerComponentGlobal = 1 -registerComponentNoDuplicates = 2 -registerComponentAfterExisting = 4 -registerComponentAliasesOnly = 8 -platform68k = 1 -platformPowerPC = 2 -platformInterpreted = 3 -platformWin32 = 4 -platformPowerPCNativeEntryPoint = 5 -mpWorkFlagDoWork = (1 << 0) -mpWorkFlagDoCompletion = (1 << 1) -mpWorkFlagCopyWorkBlock = (1 << 2) -mpWorkFlagDontBlock = (1 << 3) -mpWorkFlagGetProcessorCount = (1 << 4) -mpWorkFlagGetIsRunning = (1 << 6) -cmpAliasNoFlags = 0 -cmpAliasOnlyThisFile = 1 -uppComponentFunctionImplementedProcInfo = 0x000002F0 -uppGetComponentVersionProcInfo = 0x000000F0 -uppComponentSetTargetProcInfo = 0x000003F0 -uppCallComponentOpenProcInfo = 0x000003F0 -uppCallComponentCloseProcInfo = 0x000003F0 -uppCallComponentCanDoProcInfo = 0x000002F0 -uppCallComponentVersionProcInfo = 0x000000F0 -uppCallComponentRegisterProcInfo = 0x000000F0 -uppCallComponentTargetProcInfo = 0x000003F0 -uppCallComponentUnregisterProcInfo = 0x000000F0 -uppCallComponentGetMPWorkFunctionProcInfo = 0x00000FF0 -uppCallComponentGetPublicResourceProcInfo = 0x00003BF0 diff --git a/sys/lib/python/plat-mac/Carbon/ControlAccessor.py b/sys/lib/python/plat-mac/Carbon/ControlAccessor.py deleted file mode 100644 index 099892538..000000000 --- a/sys/lib/python/plat-mac/Carbon/ControlAccessor.py +++ /dev/null @@ -1,56 +0,0 @@ -# Accessor functions for control properties - -from Controls import * -import struct - -# These needn't go through this module, but are here for completeness -def SetControlData_Handle(control, part, selector, data): - control.SetControlData_Handle(part, selector, data) - -def GetControlData_Handle(control, part, selector): - return control.GetControlData_Handle(part, selector) - -_accessdict = { - kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), -} - -_codingdict = { - kControlPushButtonDefaultTag : ("b", None, None), - - kControlEditTextTextTag: (None, None, None), - kControlEditTextPasswordTag: (None, None, None), - - kControlPopupButtonMenuIDTag: ("h", None, None), - - kControlListBoxDoubleClickTag: ("b", None, None), -} - -def SetControlData(control, part, selector, data): - if _accessdict.has_key(selector): - setfunc, getfunc = _accessdict[selector] - setfunc(control, part, selector, data) - return - if not _codingdict.has_key(selector): - raise KeyError, ('Unknown control selector', selector) - structfmt, coder, decoder = _codingdict[selector] - if coder: - data = coder(data) - if structfmt: - data = struct.pack(structfmt, data) - control.SetControlData(part, selector, data) - -def GetControlData(control, part, selector): - if _accessdict.has_key(selector): - setfunc, getfunc = _accessdict[selector] - return getfunc(control, part, selector, data) - if not _codingdict.has_key(selector): - raise KeyError, ('Unknown control selector', selector) - structfmt, coder, decoder = _codingdict[selector] - data = control.GetControlData(part, selector) - if structfmt: - data = struct.unpack(structfmt, data) - if decoder: - data = decoder(data) - if type(data) == type(()) and len(data) == 1: - data = data[0] - return data diff --git a/sys/lib/python/plat-mac/Carbon/Controls.py b/sys/lib/python/plat-mac/Carbon/Controls.py deleted file mode 100644 index 6e5d8ea7f..000000000 --- a/sys/lib/python/plat-mac/Carbon/Controls.py +++ /dev/null @@ -1,668 +0,0 @@ -# Generated from 'Controls.h' - -def FOUR_CHAR_CODE(x): return x -from Carbon.TextEdit import * -from Carbon.QuickDraw import * -from Carbon.Dragconst import * -from Carbon.CarbonEvents import * -from Carbon.Appearance import * -kDataBrowserItemAnyState = -1 -kControlBevelButtonCenterPopupGlyphTag = -1 -kDataBrowserClientPropertyFlagsMask = 0xFF000000 - -kControlDefProcType = FOUR_CHAR_CODE('CDEF') -kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL') -kControlColorTableResourceType = FOUR_CHAR_CODE('cctb') -kControlDefProcResourceType = FOUR_CHAR_CODE('CDEF') -controlNotifyNothing = FOUR_CHAR_CODE('nada') -controlNotifyClick = FOUR_CHAR_CODE('clik') -controlNotifyFocus = FOUR_CHAR_CODE('focu') -controlNotifyKey = FOUR_CHAR_CODE('key ') -kControlCanAutoInvalidate = 1L << 0 -staticTextProc = 256 -editTextProc = 272 -iconProc = 288 -userItemProc = 304 -pictItemProc = 320 -cFrameColor = 0 -cBodyColor = 1 -cTextColor = 2 -cThumbColor = 3 -kNumberCtlCTabEntries = 4 -kControlNoVariant = 0 -kControlUsesOwningWindowsFontVariant = 1 << 3 -kControlNoPart = 0 -kControlIndicatorPart = 129 -kControlDisabledPart = 254 -kControlInactivePart = 255 -kControlEntireControl = 0 -kControlStructureMetaPart = -1 -kControlContentMetaPart = -2 -kControlFocusNoPart = 0 -kControlFocusNextPart = -1 -kControlFocusPrevPart = -2 -kControlCollectionTagBounds = FOUR_CHAR_CODE('boun') -kControlCollectionTagValue = FOUR_CHAR_CODE('valu') -kControlCollectionTagMinimum = FOUR_CHAR_CODE('min ') -kControlCollectionTagMaximum = FOUR_CHAR_CODE('max ') -kControlCollectionTagViewSize = FOUR_CHAR_CODE('view') -kControlCollectionTagVisibility = FOUR_CHAR_CODE('visi') -kControlCollectionTagRefCon = FOUR_CHAR_CODE('refc') -kControlCollectionTagTitle = FOUR_CHAR_CODE('titl') -kControlCollectionTagUnicodeTitle = FOUR_CHAR_CODE('uttl') -kControlCollectionTagIDSignature = FOUR_CHAR_CODE('idsi') -kControlCollectionTagIDID = FOUR_CHAR_CODE('idid') -kControlCollectionTagCommand = FOUR_CHAR_CODE('cmd ') -kControlCollectionTagVarCode = FOUR_CHAR_CODE('varc') -kControlContentTextOnly = 0 -kControlNoContent = 0 -kControlContentIconSuiteRes = 1 -kControlContentCIconRes = 2 -kControlContentPictRes = 3 -kControlContentICONRes = 4 -kControlContentIconSuiteHandle = 129 -kControlContentCIconHandle = 130 -kControlContentPictHandle = 131 -kControlContentIconRef = 132 -kControlContentICON = 133 -kControlKeyScriptBehaviorAllowAnyScript = FOUR_CHAR_CODE('any ') -kControlKeyScriptBehaviorPrefersRoman = FOUR_CHAR_CODE('prmn') -kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') -kControlFontBigSystemFont = -1 -kControlFontSmallSystemFont = -2 -kControlFontSmallBoldSystemFont = -3 -kControlFontViewSystemFont = -4 -kControlUseFontMask = 0x0001 -kControlUseFaceMask = 0x0002 -kControlUseSizeMask = 0x0004 -kControlUseForeColorMask = 0x0008 -kControlUseBackColorMask = 0x0010 -kControlUseModeMask = 0x0020 -kControlUseJustMask = 0x0040 -kControlUseAllMask = 0x00FF -kControlAddFontSizeMask = 0x0100 -kControlAddToMetaFontMask = 0x0200 -kControlUseThemeFontIDMask = 0x0080 -kDoNotActivateAndIgnoreClick = 0 -kDoNotActivateAndHandleClick = 1 -kActivateAndIgnoreClick = 2 -kActivateAndHandleClick = 3 -kControlFontStyleTag = FOUR_CHAR_CODE('font') -kControlKeyFilterTag = FOUR_CHAR_CODE('fltr') -kControlKindTag = FOUR_CHAR_CODE('kind') -kControlSizeTag = FOUR_CHAR_CODE('size') -kControlSupportsGhosting = 1 << 0 -kControlSupportsEmbedding = 1 << 1 -kControlSupportsFocus = 1 << 2 -kControlWantsIdle = 1 << 3 -kControlWantsActivate = 1 << 4 -kControlHandlesTracking = 1 << 5 -kControlSupportsDataAccess = 1 << 6 -kControlHasSpecialBackground = 1 << 7 -kControlGetsFocusOnClick = 1 << 8 -kControlSupportsCalcBestRect = 1 << 9 -kControlSupportsLiveFeedback = 1 << 10 -kControlHasRadioBehavior = 1 << 11 -kControlSupportsDragAndDrop = 1 << 12 -kControlAutoToggles = 1 << 14 -kControlSupportsGetRegion = 1 << 17 -kControlSupportsFlattening = 1 << 19 -kControlSupportsSetCursor = 1 << 20 -kControlSupportsContextualMenus = 1 << 21 -kControlSupportsClickActivation = 1 << 22 -kControlIdlesWithTimer = 1 << 23 -drawCntl = 0 -testCntl = 1 -calcCRgns = 2 -initCntl = 3 -dispCntl = 4 -posCntl = 5 -thumbCntl = 6 -dragCntl = 7 -autoTrack = 8 -calcCntlRgn = 10 -calcThumbRgn = 11 -drawThumbOutline = 12 -kControlMsgDrawGhost = 13 -kControlMsgCalcBestRect = 14 -kControlMsgHandleTracking = 15 -kControlMsgFocus = 16 -kControlMsgKeyDown = 17 -kControlMsgIdle = 18 -kControlMsgGetFeatures = 19 -kControlMsgSetData = 20 -kControlMsgGetData = 21 -kControlMsgActivate = 22 -kControlMsgSetUpBackground = 23 -kControlMsgCalcValueFromPos = 26 -kControlMsgTestNewMsgSupport = 27 -kControlMsgSubValueChanged = 25 -kControlMsgSubControlAdded = 28 -kControlMsgSubControlRemoved = 29 -kControlMsgApplyTextColor = 30 -kControlMsgGetRegion = 31 -kControlMsgFlatten = 32 -kControlMsgSetCursor = 33 -kControlMsgDragEnter = 38 -kControlMsgDragLeave = 39 -kControlMsgDragWithin = 40 -kControlMsgDragReceive = 41 -kControlMsgDisplayDebugInfo = 46 -kControlMsgContextualMenuClick = 47 -kControlMsgGetClickActivation = 48 -kControlSizeNormal = 0 -kControlSizeSmall = 1 -kControlSizeLarge = 2 -kControlSizeAuto = 0xFFFF -kDrawControlEntireControl = 0 -kDrawControlIndicatorOnly = 129 -kDragControlEntireControl = 0 -kDragControlIndicator = 1 -kControlSupportsNewMessages = FOUR_CHAR_CODE(' ok ') -kControlKeyFilterBlockKey = 0 -kControlKeyFilterPassKey = 1 -noConstraint = kNoConstraint -hAxisOnly = 1 -vAxisOnly = 2 -kControlDefProcPtr = 0 -kControlDefObjectClass = 1 -kControlKindSignatureApple = FOUR_CHAR_CODE('appl') -kControlPropertyPersistent = 0x00000001 -kDragTrackingEnterControl = 2 -kDragTrackingInControl = 3 -kDragTrackingLeaveControl = 4 -useWFont = kControlUsesOwningWindowsFontVariant -inThumb = kControlIndicatorPart -kNoHiliteControlPart = kControlNoPart -kInIndicatorControlPart = kControlIndicatorPart -kReservedControlPart = kControlDisabledPart -kControlInactiveControlPart = kControlInactivePart -kControlTabListResType = FOUR_CHAR_CODE('tab#') -kControlListDescResType = FOUR_CHAR_CODE('ldes') -kControlCheckBoxUncheckedValue = 0 -kControlCheckBoxCheckedValue = 1 -kControlCheckBoxMixedValue = 2 -kControlRadioButtonUncheckedValue = 0 -kControlRadioButtonCheckedValue = 1 -kControlRadioButtonMixedValue = 2 -popupFixedWidth = 1 << 0 -popupVariableWidth = 1 << 1 -popupUseAddResMenu = 1 << 2 -popupUseWFont = 1 << 3 -popupTitleBold = 1 << 8 -popupTitleItalic = 1 << 9 -popupTitleUnderline = 1 << 10 -popupTitleOutline = 1 << 11 -popupTitleShadow = 1 << 12 -popupTitleCondense = 1 << 13 -popupTitleExtend = 1 << 14 -popupTitleNoStyle = 1 << 15 -popupTitleLeftJust = 0x00000000 -popupTitleCenterJust = 0x00000001 -popupTitleRightJust = 0x000000FF -pushButProc = 0 -checkBoxProc = 1 -radioButProc = 2 -scrollBarProc = 16 -popupMenuProc = 1008 -kControlLabelPart = 1 -kControlMenuPart = 2 -kControlTrianglePart = 4 -kControlEditTextPart = 5 -kControlPicturePart = 6 -kControlIconPart = 7 -kControlClockPart = 8 -kControlListBoxPart = 24 -kControlListBoxDoubleClickPart = 25 -kControlImageWellPart = 26 -kControlRadioGroupPart = 27 -kControlButtonPart = 10 -kControlCheckBoxPart = 11 -kControlRadioButtonPart = 11 -kControlUpButtonPart = 20 -kControlDownButtonPart = 21 -kControlPageUpPart = 22 -kControlPageDownPart = 23 -kControlClockHourDayPart = 9 -kControlClockMinuteMonthPart = 10 -kControlClockSecondYearPart = 11 -kControlClockAMPMPart = 12 -kControlDataBrowserPart = 24 -kControlDataBrowserDraggedPart = 25 -kControlBevelButtonSmallBevelProc = 32 -kControlBevelButtonNormalBevelProc = 33 -kControlBevelButtonLargeBevelProc = 34 -kControlBevelButtonSmallBevelVariant = 0 -kControlBevelButtonNormalBevelVariant = (1 << 0) -kControlBevelButtonLargeBevelVariant = (1 << 1) -kControlBevelButtonMenuOnRightVariant = (1 << 2) -kControlBevelButtonSmallBevel = 0 -kControlBevelButtonNormalBevel = 1 -kControlBevelButtonLargeBevel = 2 -kControlBehaviorPushbutton = 0 -kControlBehaviorToggles = 0x0100 -kControlBehaviorSticky = 0x0200 -kControlBehaviorSingleValueMenu = 0 -kControlBehaviorMultiValueMenu = 0x4000 -kControlBehaviorOffsetContents = 0x8000 -kControlBehaviorCommandMenu = 0x2000 -kControlBevelButtonMenuOnBottom = 0 -kControlBevelButtonMenuOnRight = (1 << 2) -kControlKindBevelButton = FOUR_CHAR_CODE('bevl') -kControlBevelButtonAlignSysDirection = -1 -kControlBevelButtonAlignCenter = 0 -kControlBevelButtonAlignLeft = 1 -kControlBevelButtonAlignRight = 2 -kControlBevelButtonAlignTop = 3 -kControlBevelButtonAlignBottom = 4 -kControlBevelButtonAlignTopLeft = 5 -kControlBevelButtonAlignBottomLeft = 6 -kControlBevelButtonAlignTopRight = 7 -kControlBevelButtonAlignBottomRight = 8 -kControlBevelButtonAlignTextSysDirection = teFlushDefault -kControlBevelButtonAlignTextCenter = teCenter -kControlBevelButtonAlignTextFlushRight = teFlushRight -kControlBevelButtonAlignTextFlushLeft = teFlushLeft -kControlBevelButtonPlaceSysDirection = -1 -kControlBevelButtonPlaceNormally = 0 -kControlBevelButtonPlaceToRightOfGraphic = 1 -kControlBevelButtonPlaceToLeftOfGraphic = 2 -kControlBevelButtonPlaceBelowGraphic = 3 -kControlBevelButtonPlaceAboveGraphic = 4 -kControlBevelButtonContentTag = FOUR_CHAR_CODE('cont') -kControlBevelButtonTransformTag = FOUR_CHAR_CODE('tran') -kControlBevelButtonTextAlignTag = FOUR_CHAR_CODE('tali') -kControlBevelButtonTextOffsetTag = FOUR_CHAR_CODE('toff') -kControlBevelButtonGraphicAlignTag = FOUR_CHAR_CODE('gali') -kControlBevelButtonGraphicOffsetTag = FOUR_CHAR_CODE('goff') -kControlBevelButtonTextPlaceTag = FOUR_CHAR_CODE('tplc') -kControlBevelButtonMenuValueTag = FOUR_CHAR_CODE('mval') -kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd') -kControlBevelButtonMenuRefTag = FOUR_CHAR_CODE('mhnd') -# kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') -kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu') -kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly') -kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal') -kControlBevelButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') -kControlBevelButtonKindTag = FOUR_CHAR_CODE('bebk') -kControlSliderProc = 48 -kControlSliderLiveFeedback = (1 << 0) -kControlSliderHasTickMarks = (1 << 1) -kControlSliderReverseDirection = (1 << 2) -kControlSliderNonDirectional = (1 << 3) -kControlSliderPointsDownOrRight = 0 -kControlSliderPointsUpOrLeft = 1 -kControlSliderDoesNotPoint = 2 -kControlKindSlider = FOUR_CHAR_CODE('sldr') -kControlTriangleProc = 64 -kControlTriangleLeftFacingProc = 65 -kControlTriangleAutoToggleProc = 66 -kControlTriangleLeftFacingAutoToggleProc = 67 -kControlDisclosureTrianglePointDefault = 0 -kControlDisclosureTrianglePointRight = 1 -kControlDisclosureTrianglePointLeft = 2 -kControlKindDisclosureTriangle = FOUR_CHAR_CODE('dist') -kControlTriangleLastValueTag = FOUR_CHAR_CODE('last') -kControlProgressBarProc = 80 -kControlRelevanceBarProc = 81 -kControlKindProgressBar = FOUR_CHAR_CODE('prgb') -kControlKindRelevanceBar = FOUR_CHAR_CODE('relb') -kControlProgressBarIndeterminateTag = FOUR_CHAR_CODE('inde') -kControlProgressBarAnimatingTag = FOUR_CHAR_CODE('anim') -kControlLittleArrowsProc = 96 -kControlKindLittleArrows = FOUR_CHAR_CODE('larr') -kControlChasingArrowsProc = 112 -kControlKindChasingArrows = FOUR_CHAR_CODE('carr') -kControlChasingArrowsAnimatingTag = FOUR_CHAR_CODE('anim') -kControlTabLargeProc = 128 -kControlTabSmallProc = 129 -kControlTabLargeNorthProc = 128 -kControlTabSmallNorthProc = 129 -kControlTabLargeSouthProc = 130 -kControlTabSmallSouthProc = 131 -kControlTabLargeEastProc = 132 -kControlTabSmallEastProc = 133 -kControlTabLargeWestProc = 134 -kControlTabSmallWestProc = 135 -kControlTabDirectionNorth = 0 -kControlTabDirectionSouth = 1 -kControlTabDirectionEast = 2 -kControlTabDirectionWest = 3 -kControlTabSizeLarge = kControlSizeNormal -kControlTabSizeSmall = kControlSizeSmall -kControlKindTabs = FOUR_CHAR_CODE('tabs') -kControlTabContentRectTag = FOUR_CHAR_CODE('rect') -kControlTabEnabledFlagTag = FOUR_CHAR_CODE('enab') -kControlTabFontStyleTag = kControlFontStyleTag -kControlTabInfoTag = FOUR_CHAR_CODE('tabi') -kControlTabImageContentTag = FOUR_CHAR_CODE('cont') -kControlTabInfoVersionZero = 0 -kControlTabInfoVersionOne = 1 -kControlSeparatorLineProc = 144 -kControlKindSeparator = FOUR_CHAR_CODE('sepa') -kControlGroupBoxTextTitleProc = 160 -kControlGroupBoxCheckBoxProc = 161 -kControlGroupBoxPopupButtonProc = 162 -kControlGroupBoxSecondaryTextTitleProc = 164 -kControlGroupBoxSecondaryCheckBoxProc = 165 -kControlGroupBoxSecondaryPopupButtonProc = 166 -kControlKindGroupBox = FOUR_CHAR_CODE('grpb') -kControlKindCheckGroupBox = FOUR_CHAR_CODE('cgrp') -kControlKindPopupGroupBox = FOUR_CHAR_CODE('pgrp') -kControlGroupBoxMenuHandleTag = FOUR_CHAR_CODE('mhan') -kControlGroupBoxMenuRefTag = FOUR_CHAR_CODE('mhan') -kControlGroupBoxFontStyleTag = kControlFontStyleTag -kControlGroupBoxTitleRectTag = FOUR_CHAR_CODE('trec') -kControlImageWellProc = 176 -kControlKindImageWell = FOUR_CHAR_CODE('well') -kControlImageWellContentTag = FOUR_CHAR_CODE('cont') -kControlImageWellTransformTag = FOUR_CHAR_CODE('tran') -kControlImageWellIsDragDestinationTag = FOUR_CHAR_CODE('drag') -kControlPopupArrowEastProc = 192 -kControlPopupArrowWestProc = 193 -kControlPopupArrowNorthProc = 194 -kControlPopupArrowSouthProc = 195 -kControlPopupArrowSmallEastProc = 196 -kControlPopupArrowSmallWestProc = 197 -kControlPopupArrowSmallNorthProc = 198 -kControlPopupArrowSmallSouthProc = 199 -kControlPopupArrowOrientationEast = 0 -kControlPopupArrowOrientationWest = 1 -kControlPopupArrowOrientationNorth = 2 -kControlPopupArrowOrientationSouth = 3 -kControlPopupArrowSizeNormal = 0 -kControlPopupArrowSizeSmall = 1 -kControlKindPopupArrow = FOUR_CHAR_CODE('parr') -kControlPlacardProc = 224 -kControlKindPlacard = FOUR_CHAR_CODE('plac') -kControlClockTimeProc = 240 -kControlClockTimeSecondsProc = 241 -kControlClockDateProc = 242 -kControlClockMonthYearProc = 243 -kControlClockTypeHourMinute = 0 -kControlClockTypeHourMinuteSecond = 1 -kControlClockTypeMonthDayYear = 2 -kControlClockTypeMonthYear = 3 -kControlClockFlagStandard = 0 -kControlClockNoFlags = 0 -kControlClockFlagDisplayOnly = 1 -kControlClockIsDisplayOnly = 1 -kControlClockFlagLive = 2 -kControlClockIsLive = 2 -kControlKindClock = FOUR_CHAR_CODE('clck') -kControlClockLongDateTag = FOUR_CHAR_CODE('date') -kControlClockFontStyleTag = kControlFontStyleTag -kControlClockAnimatingTag = FOUR_CHAR_CODE('anim') -kControlUserPaneProc = 256 -kControlKindUserPane = FOUR_CHAR_CODE('upan') -kControlUserItemDrawProcTag = FOUR_CHAR_CODE('uidp') -kControlUserPaneDrawProcTag = FOUR_CHAR_CODE('draw') -kControlUserPaneHitTestProcTag = FOUR_CHAR_CODE('hitt') -kControlUserPaneTrackingProcTag = FOUR_CHAR_CODE('trak') -kControlUserPaneIdleProcTag = FOUR_CHAR_CODE('idle') -kControlUserPaneKeyDownProcTag = FOUR_CHAR_CODE('keyd') -kControlUserPaneActivateProcTag = FOUR_CHAR_CODE('acti') -kControlUserPaneFocusProcTag = FOUR_CHAR_CODE('foci') -kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back') -kControlEditTextProc = 272 -kControlEditTextPasswordProc = 274 -kControlEditTextInlineInputProc = 276 -kControlKindEditText = FOUR_CHAR_CODE('etxt') -kControlEditTextStyleTag = kControlFontStyleTag -kControlEditTextTextTag = FOUR_CHAR_CODE('text') -kControlEditTextTEHandleTag = FOUR_CHAR_CODE('than') -kControlEditTextKeyFilterTag = kControlKeyFilterTag -kControlEditTextSelectionTag = FOUR_CHAR_CODE('sele') -kControlEditTextPasswordTag = FOUR_CHAR_CODE('pass') -kControlEditTextKeyScriptBehaviorTag = FOUR_CHAR_CODE('kscr') -kControlEditTextLockedTag = FOUR_CHAR_CODE('lock') -kControlEditTextFixedTextTag = FOUR_CHAR_CODE('ftxt') -kControlEditTextValidationProcTag = FOUR_CHAR_CODE('vali') -kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup') -kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') -kControlEditTextCFStringTag = FOUR_CHAR_CODE('cfst') -kControlEditTextPasswordCFStringTag = FOUR_CHAR_CODE('pwcf') -kControlStaticTextProc = 288 -kControlKindStaticText = FOUR_CHAR_CODE('stxt') -kControlStaticTextStyleTag = kControlFontStyleTag -kControlStaticTextTextTag = FOUR_CHAR_CODE('text') -kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei') -kControlStaticTextTruncTag = FOUR_CHAR_CODE('trun') -kControlStaticTextCFStringTag = FOUR_CHAR_CODE('cfst') -kControlPictureProc = 304 -kControlPictureNoTrackProc = 305 -kControlKindPicture = FOUR_CHAR_CODE('pict') -kControlPictureHandleTag = FOUR_CHAR_CODE('pich') -kControlIconProc = 320 -kControlIconNoTrackProc = 321 -kControlIconSuiteProc = 322 -kControlIconSuiteNoTrackProc = 323 -kControlIconRefProc = 324 -kControlIconRefNoTrackProc = 325 -kControlKindIcon = FOUR_CHAR_CODE('icon') -kControlIconTransformTag = FOUR_CHAR_CODE('trfm') -kControlIconAlignmentTag = FOUR_CHAR_CODE('algn') -kControlIconResourceIDTag = FOUR_CHAR_CODE('ires') -kControlIconContentTag = FOUR_CHAR_CODE('cont') -kControlWindowHeaderProc = 336 -kControlWindowListViewHeaderProc = 337 -kControlKindWindowHeader = FOUR_CHAR_CODE('whed') -kControlListBoxProc = 352 -kControlListBoxAutoSizeProc = 353 -kControlKindListBox = FOUR_CHAR_CODE('lbox') -kControlListBoxListHandleTag = FOUR_CHAR_CODE('lhan') -kControlListBoxKeyFilterTag = kControlKeyFilterTag -kControlListBoxFontStyleTag = kControlFontStyleTag -kControlListBoxDoubleClickTag = FOUR_CHAR_CODE('dblc') -kControlListBoxLDEFTag = FOUR_CHAR_CODE('ldef') -kControlPushButtonProc = 368 -kControlCheckBoxProc = 369 -kControlRadioButtonProc = 370 -kControlPushButLeftIconProc = 374 -kControlPushButRightIconProc = 375 -kControlCheckBoxAutoToggleProc = 371 -kControlRadioButtonAutoToggleProc = 372 -kControlPushButtonIconOnLeft = 6 -kControlPushButtonIconOnRight = 7 -kControlKindPushButton = FOUR_CHAR_CODE('push') -kControlKindPushIconButton = FOUR_CHAR_CODE('picn') -kControlKindRadioButton = FOUR_CHAR_CODE('rdio') -kControlKindCheckBox = FOUR_CHAR_CODE('cbox') -kControlPushButtonDefaultTag = FOUR_CHAR_CODE('dflt') -kControlPushButtonCancelTag = FOUR_CHAR_CODE('cncl') -kControlScrollBarProc = 384 -kControlScrollBarLiveProc = 386 -kControlKindScrollBar = FOUR_CHAR_CODE('sbar') -kControlScrollBarShowsArrowsTag = FOUR_CHAR_CODE('arro') -kControlPopupButtonProc = 400 -kControlPopupFixedWidthVariant = 1 << 0 -kControlPopupVariableWidthVariant = 1 << 1 -kControlPopupUseAddResMenuVariant = 1 << 2 -kControlPopupUseWFontVariant = kControlUsesOwningWindowsFontVariant -kControlKindPopupButton = FOUR_CHAR_CODE('popb') -kControlPopupButtonMenuHandleTag = FOUR_CHAR_CODE('mhan') -kControlPopupButtonMenuRefTag = FOUR_CHAR_CODE('mhan') -kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid') -kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht') -kControlPopupButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') -kControlPopupButtonCheckCurrentTag = FOUR_CHAR_CODE('chck') -kControlRadioGroupProc = 416 -kControlKindRadioGroup = FOUR_CHAR_CODE('rgrp') -kControlScrollTextBoxProc = 432 -kControlScrollTextBoxAutoScrollProc = 433 -kControlKindScrollingTextBox = FOUR_CHAR_CODE('stbx') -kControlScrollTextBoxDelayBeforeAutoScrollTag = FOUR_CHAR_CODE('stdl') -kControlScrollTextBoxDelayBetweenAutoScrollTag = FOUR_CHAR_CODE('scdl') -kControlScrollTextBoxAutoScrollAmountTag = FOUR_CHAR_CODE('samt') -kControlScrollTextBoxContentsTag = FOUR_CHAR_CODE('tres') -kControlScrollTextBoxAnimatingTag = FOUR_CHAR_CODE('anim') -kControlKindDisclosureButton = FOUR_CHAR_CODE('disb') -kControlDisclosureButtonClosed = 0 -kControlDisclosureButtonDisclosed = 1 -kControlRoundButtonNormalSize = kControlSizeNormal -kControlRoundButtonLargeSize = kControlSizeLarge -kControlRoundButtonContentTag = FOUR_CHAR_CODE('cont') -kControlRoundButtonSizeTag = kControlSizeTag -kControlKindRoundButton = FOUR_CHAR_CODE('rndb') -kControlKindDataBrowser = FOUR_CHAR_CODE('datb') -errDataBrowserNotConfigured = -4970 -errDataBrowserItemNotFound = -4971 -errDataBrowserItemNotAdded = -4975 -errDataBrowserPropertyNotFound = -4972 -errDataBrowserInvalidPropertyPart = -4973 -errDataBrowserInvalidPropertyData = -4974 -errDataBrowserPropertyNotSupported = -4979 -kControlDataBrowserIncludesFrameAndFocusTag = FOUR_CHAR_CODE('brdr') -kControlDataBrowserKeyFilterTag = kControlEditTextKeyFilterTag -kControlDataBrowserEditTextKeyFilterTag = kControlDataBrowserKeyFilterTag -kControlDataBrowserEditTextValidationProcTag = kControlEditTextValidationProcTag -kDataBrowserNoView = 0x3F3F3F3F -kDataBrowserListView = FOUR_CHAR_CODE('lstv') -kDataBrowserColumnView = FOUR_CHAR_CODE('clmv') -kDataBrowserDragSelect = 1 << 0 -kDataBrowserSelectOnlyOne = 1 << 1 -kDataBrowserResetSelection = 1 << 2 -kDataBrowserCmdTogglesSelection = 1 << 3 -kDataBrowserNoDisjointSelection = 1 << 4 -kDataBrowserAlwaysExtendSelection = 1 << 5 -kDataBrowserNeverEmptySelectionSet = 1 << 6 -kDataBrowserOrderUndefined = 0 -kDataBrowserOrderIncreasing = 1 -kDataBrowserOrderDecreasing = 2 -kDataBrowserNoItem = 0L -kDataBrowserItemNoState = 0 -# kDataBrowserItemAnyState = (unsigned long)(-1) -kDataBrowserItemIsSelected = 1 << 0 -kDataBrowserContainerIsOpen = 1 << 1 -kDataBrowserItemIsDragTarget = 1 << 2 -kDataBrowserRevealOnly = 0 -kDataBrowserRevealAndCenterInView = 1 << 0 -kDataBrowserRevealWithoutSelecting = 1 << 1 -kDataBrowserItemsAdd = 0 -kDataBrowserItemsAssign = 1 -kDataBrowserItemsToggle = 2 -kDataBrowserItemsRemove = 3 -kDataBrowserSelectionAnchorUp = 0 -kDataBrowserSelectionAnchorDown = 1 -kDataBrowserSelectionAnchorLeft = 2 -kDataBrowserSelectionAnchorRight = 3 -kDataBrowserEditMsgUndo = kHICommandUndo -kDataBrowserEditMsgRedo = kHICommandRedo -kDataBrowserEditMsgCut = kHICommandCut -kDataBrowserEditMsgCopy = kHICommandCopy -kDataBrowserEditMsgPaste = kHICommandPaste -kDataBrowserEditMsgClear = kHICommandClear -kDataBrowserEditMsgSelectAll = kHICommandSelectAll -kDataBrowserItemAdded = 1 -kDataBrowserItemRemoved = 2 -kDataBrowserEditStarted = 3 -kDataBrowserEditStopped = 4 -kDataBrowserItemSelected = 5 -kDataBrowserItemDeselected = 6 -kDataBrowserItemDoubleClicked = 7 -kDataBrowserContainerOpened = 8 -kDataBrowserContainerClosing = 9 -kDataBrowserContainerClosed = 10 -kDataBrowserContainerSorting = 11 -kDataBrowserContainerSorted = 12 -kDataBrowserUserToggledContainer = 16 -kDataBrowserTargetChanged = 15 -kDataBrowserUserStateChanged = 13 -kDataBrowserSelectionSetChanged = 14 -kDataBrowserItemNoProperty = 0L -kDataBrowserItemIsActiveProperty = 1L -kDataBrowserItemIsSelectableProperty = 2L -kDataBrowserItemIsEditableProperty = 3L -kDataBrowserItemIsContainerProperty = 4L -kDataBrowserContainerIsOpenableProperty = 5L -kDataBrowserContainerIsClosableProperty = 6L -kDataBrowserContainerIsSortableProperty = 7L -kDataBrowserItemSelfIdentityProperty = 8L -kDataBrowserContainerAliasIDProperty = 9L -kDataBrowserColumnViewPreviewProperty = 10L -kDataBrowserItemParentContainerProperty = 11L -kDataBrowserCustomType = 0x3F3F3F3F -kDataBrowserIconType = FOUR_CHAR_CODE('icnr') -kDataBrowserTextType = FOUR_CHAR_CODE('text') -kDataBrowserDateTimeType = FOUR_CHAR_CODE('date') -kDataBrowserSliderType = FOUR_CHAR_CODE('sldr') -kDataBrowserCheckboxType = FOUR_CHAR_CODE('chbx') -kDataBrowserProgressBarType = FOUR_CHAR_CODE('prog') -kDataBrowserRelevanceRankType = FOUR_CHAR_CODE('rank') -kDataBrowserPopupMenuType = FOUR_CHAR_CODE('menu') -kDataBrowserIconAndTextType = FOUR_CHAR_CODE('ticn') -kDataBrowserPropertyEnclosingPart = 0L -kDataBrowserPropertyContentPart = FOUR_CHAR_CODE('----') -kDataBrowserPropertyDisclosurePart = FOUR_CHAR_CODE('disc') -kDataBrowserPropertyTextPart = kDataBrowserTextType -kDataBrowserPropertyIconPart = kDataBrowserIconType -kDataBrowserPropertySliderPart = kDataBrowserSliderType -kDataBrowserPropertyCheckboxPart = kDataBrowserCheckboxType -kDataBrowserPropertyProgressBarPart = kDataBrowserProgressBarType -kDataBrowserPropertyRelevanceRankPart = kDataBrowserRelevanceRankType -kDataBrowserUniversalPropertyFlagsMask = 0xFF -kDataBrowserPropertyIsMutable = 1 << 0 -kDataBrowserDefaultPropertyFlags = 0 << 0 -kDataBrowserUniversalPropertyFlags = kDataBrowserUniversalPropertyFlagsMask -kDataBrowserPropertyIsEditable = kDataBrowserPropertyIsMutable -kDataBrowserPropertyFlagsOffset = 8 -kDataBrowserPropertyFlagsMask = 0xFF << kDataBrowserPropertyFlagsOffset -kDataBrowserCheckboxTriState = 1 << kDataBrowserPropertyFlagsOffset -kDataBrowserDateTimeRelative = 1 << (kDataBrowserPropertyFlagsOffset) -kDataBrowserDateTimeDateOnly = 1 << (kDataBrowserPropertyFlagsOffset + 1) -kDataBrowserDateTimeTimeOnly = 1 << (kDataBrowserPropertyFlagsOffset + 2) -kDataBrowserDateTimeSecondsToo = 1 << (kDataBrowserPropertyFlagsOffset + 3) -kDataBrowserSliderPlainThumb = kThemeThumbPlain << kDataBrowserPropertyFlagsOffset -kDataBrowserSliderUpwardThumb = kThemeThumbUpward << kDataBrowserPropertyFlagsOffset -kDataBrowserSliderDownwardThumb = kThemeThumbDownward << kDataBrowserPropertyFlagsOffset -kDataBrowserDoNotTruncateText = 3 << kDataBrowserPropertyFlagsOffset -kDataBrowserTruncateTextAtEnd = 2 << kDataBrowserPropertyFlagsOffset -kDataBrowserTruncateTextMiddle = 0 << kDataBrowserPropertyFlagsOffset -kDataBrowserTruncateTextAtStart = 1 << kDataBrowserPropertyFlagsOffset -kDataBrowserPropertyModificationFlags = kDataBrowserPropertyFlagsMask -kDataBrowserRelativeDateTime = kDataBrowserDateTimeRelative -kDataBrowserViewSpecificFlagsOffset = 16 -kDataBrowserViewSpecificFlagsMask = 0xFF << kDataBrowserViewSpecificFlagsOffset -kDataBrowserViewSpecificPropertyFlags = kDataBrowserViewSpecificFlagsMask -kDataBrowserClientPropertyFlagsOffset = 24 -# kDataBrowserClientPropertyFlagsMask = (unsigned long)(0xFF << kDataBrowserClientPropertyFlagsOffset) -kDataBrowserLatestCallbacks = 0 -kDataBrowserContentHit = 1 -kDataBrowserNothingHit = 0 -kDataBrowserStopTracking = -1 -kDataBrowserLatestCustomCallbacks = 0 -kDataBrowserTableViewMinimalHilite = 0 -kDataBrowserTableViewFillHilite = 1 -kDataBrowserTableViewSelectionColumn = 1 << kDataBrowserViewSpecificFlagsOffset -kDataBrowserTableViewLastColumn = -1 -kDataBrowserListViewMovableColumn = 1 << (kDataBrowserViewSpecificFlagsOffset + 1) -kDataBrowserListViewSortableColumn = 1 << (kDataBrowserViewSpecificFlagsOffset + 2) -kDataBrowserListViewSelectionColumn = kDataBrowserTableViewSelectionColumn -kDataBrowserListViewDefaultColumnFlags = kDataBrowserListViewMovableColumn + kDataBrowserListViewSortableColumn -kDataBrowserListViewLatestHeaderDesc = 0 -kDataBrowserListViewAppendColumn = kDataBrowserTableViewLastColumn -kControlEditUnicodeTextPostUpdateProcTag = FOUR_CHAR_CODE('upup') -kControlEditUnicodeTextProc = 912 -kControlEditUnicodeTextPasswordProc = 914 -kControlKindEditUnicodeText = FOUR_CHAR_CODE('eutx') -kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue -kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue -kControlCheckboxMixedValue = kControlCheckBoxMixedValue -inLabel = kControlLabelPart -inMenu = kControlMenuPart -inTriangle = kControlTrianglePart -inButton = kControlButtonPart -inCheckBox = kControlCheckBoxPart -inUpButton = kControlUpButtonPart -inDownButton = kControlDownButtonPart -inPageUp = kControlPageUpPart -inPageDown = kControlPageDownPart -kInLabelControlPart = kControlLabelPart -kInMenuControlPart = kControlMenuPart -kInTriangleControlPart = kControlTrianglePart -kInButtonControlPart = kControlButtonPart -kInCheckBoxControlPart = kControlCheckBoxPart -kInUpButtonControlPart = kControlUpButtonPart -kInDownButtonControlPart = kControlDownButtonPart -kInPageUpControlPart = kControlPageUpPart -kInPageDownControlPart = kControlPageDownPart diff --git a/sys/lib/python/plat-mac/Carbon/CoreFoundation.py b/sys/lib/python/plat-mac/Carbon/CoreFoundation.py deleted file mode 100644 index 8d9c89464..000000000 --- a/sys/lib/python/plat-mac/Carbon/CoreFoundation.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated from 'CFBase.h' - -def FOUR_CHAR_CODE(x): return x -kCFCompareLessThan = -1 -kCFCompareEqualTo = 0 -kCFCompareGreaterThan = 1 -kCFNotFound = -1 -kCFPropertyListImmutable = 0 -kCFPropertyListMutableContainers = 1 -kCFPropertyListMutableContainersAndLeaves = 2 -# kCFStringEncodingInvalidId = (long)0xFFFFFFFF -kCFStringEncodingMacRoman = 0 -kCFStringEncodingWindowsLatin1 = 0x0500 -kCFStringEncodingISOLatin1 = 0x0201 -kCFStringEncodingNextStepLatin = 0x0B01 -kCFStringEncodingASCII = 0x0600 -kCFStringEncodingUnicode = 0x0100 -kCFStringEncodingUTF8 = 0x08000100 -kCFStringEncodingNonLossyASCII = 0x0BFF -kCFCompareCaseInsensitive = 1 -kCFCompareBackwards = 4 -kCFCompareAnchored = 8 -kCFCompareNonliteral = 16 -kCFCompareLocalized = 32 -kCFCompareNumerically = 64 -kCFURLPOSIXPathStyle = 0 -kCFURLHFSPathStyle = 1 -kCFURLWindowsPathStyle = 2 diff --git a/sys/lib/python/plat-mac/Carbon/CoreGraphics.py b/sys/lib/python/plat-mac/Carbon/CoreGraphics.py deleted file mode 100755 index f4cb0b944..000000000 --- a/sys/lib/python/plat-mac/Carbon/CoreGraphics.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated from 'CGContext.h' - -def FOUR_CHAR_CODE(x): return x -kCGLineJoinMiter = 0 -kCGLineJoinRound = 1 -kCGLineJoinBevel = 2 -kCGLineCapButt = 0 -kCGLineCapRound = 1 -kCGLineCapSquare = 2 -kCGPathFill = 0 -kCGPathEOFill = 1 -kCGPathStroke = 2 -kCGPathFillStroke = 3 -kCGPathEOFillStroke = 4 -kCGTextFill = 0 -kCGTextStroke = 1 -kCGTextFillStroke = 2 -kCGTextInvisible = 3 -kCGTextFillClip = 4 -kCGTextStrokeClip = 5 -kCGTextFillStrokeClip = 6 -kCGTextClip = 7 -kCGEncodingFontSpecific = 0 -kCGEncodingMacRoman = 1 -kCGInterpolationDefault = 0 -kCGInterpolationNone = 1 -kCGInterpolationLow = 2 -kCGInterpolationHigh = 3 diff --git a/sys/lib/python/plat-mac/Carbon/Ctl.py b/sys/lib/python/plat-mac/Carbon/Ctl.py deleted file mode 100644 index b9dc3ef1c..000000000 --- a/sys/lib/python/plat-mac/Carbon/Ctl.py +++ /dev/null @@ -1 +0,0 @@ -from _Ctl import * diff --git a/sys/lib/python/plat-mac/Carbon/Dialogs.py b/sys/lib/python/plat-mac/Carbon/Dialogs.py deleted file mode 100644 index f846d7c39..000000000 --- a/sys/lib/python/plat-mac/Carbon/Dialogs.py +++ /dev/null @@ -1,79 +0,0 @@ -# Generated from 'Dialogs.h' - -def FOUR_CHAR_CODE(x): return x -kControlDialogItem = 4 -kButtonDialogItem = kControlDialogItem | 0 -kCheckBoxDialogItem = kControlDialogItem | 1 -kRadioButtonDialogItem = kControlDialogItem | 2 -kResourceControlDialogItem = kControlDialogItem | 3 -kStaticTextDialogItem = 8 -kEditTextDialogItem = 16 -kIconDialogItem = 32 -kPictureDialogItem = 64 -kUserDialogItem = 0 -kHelpDialogItem = 1 -kItemDisableBit = 128 -ctrlItem = 4 -btnCtrl = 0 -chkCtrl = 1 -radCtrl = 2 -resCtrl = 3 -statText = 8 -editText = 16 -iconItem = 32 -picItem = 64 -userItem = 0 -itemDisable = 128 -kStdOkItemIndex = 1 -kStdCancelItemIndex = 2 -ok = kStdOkItemIndex -cancel = kStdCancelItemIndex -kStopIcon = 0 -kNoteIcon = 1 -kCautionIcon = 2 -stopIcon = kStopIcon -noteIcon = kNoteIcon -cautionIcon = kCautionIcon -kOkItemIndex = 1 -kCancelItemIndex = 2 -overlayDITL = 0 -appendDITLRight = 1 -appendDITLBottom = 2 -kAlertStopAlert = 0 -kAlertNoteAlert = 1 -kAlertCautionAlert = 2 -kAlertPlainAlert = 3 -kAlertDefaultOKText = -1 -kAlertDefaultCancelText = -1 -kAlertDefaultOtherText = -1 -kAlertStdAlertOKButton = 1 -kAlertStdAlertCancelButton = 2 -kAlertStdAlertOtherButton = 3 -kAlertStdAlertHelpButton = 4 -kDialogFlagsUseThemeBackground = (1 << 0) -kDialogFlagsUseControlHierarchy = (1 << 1) -kDialogFlagsHandleMovableModal = (1 << 2) -kDialogFlagsUseThemeControls = (1 << 3) -kAlertFlagsUseThemeBackground = (1 << 0) -kAlertFlagsUseControlHierarchy = (1 << 1) -kAlertFlagsAlertIsMovable = (1 << 2) -kAlertFlagsUseThemeControls = (1 << 3) -kDialogFontNoFontStyle = 0 -kDialogFontUseFontMask = 0x0001 -kDialogFontUseFaceMask = 0x0002 -kDialogFontUseSizeMask = 0x0004 -kDialogFontUseForeColorMask = 0x0008 -kDialogFontUseBackColorMask = 0x0010 -kDialogFontUseModeMask = 0x0020 -kDialogFontUseJustMask = 0x0040 -kDialogFontUseAllMask = 0x00FF -kDialogFontAddFontSizeMask = 0x0100 -kDialogFontUseFontNameMask = 0x0200 -kDialogFontAddToMetaFontMask = 0x0400 -kDialogFontUseThemeFontIDMask = 0x0080 -kHICommandOther = FOUR_CHAR_CODE('othr') -kStdCFStringAlertVersionOne = 1 -kStdAlertDoNotDisposeSheet = 1 << 0 -kStdAlertDoNotAnimateOnDefault = 1 << 1 -kStdAlertDoNotAnimateOnCancel = 1 << 2 -kStdAlertDoNotAnimateOnOther = 1 << 3 diff --git a/sys/lib/python/plat-mac/Carbon/Dlg.py b/sys/lib/python/plat-mac/Carbon/Dlg.py deleted file mode 100644 index 7b22d8498..000000000 --- a/sys/lib/python/plat-mac/Carbon/Dlg.py +++ /dev/null @@ -1 +0,0 @@ -from _Dlg import * diff --git a/sys/lib/python/plat-mac/Carbon/Drag.py b/sys/lib/python/plat-mac/Carbon/Drag.py deleted file mode 100644 index a2349d714..000000000 --- a/sys/lib/python/plat-mac/Carbon/Drag.py +++ /dev/null @@ -1 +0,0 @@ -from _Drag import * diff --git a/sys/lib/python/plat-mac/Carbon/Dragconst.py b/sys/lib/python/plat-mac/Carbon/Dragconst.py deleted file mode 100644 index 38e12be7a..000000000 --- a/sys/lib/python/plat-mac/Carbon/Dragconst.py +++ /dev/null @@ -1,86 +0,0 @@ -# Generated from 'Drag.h' - -def FOUR_CHAR_CODE(x): return x -from Carbon.TextEdit import * -from Carbon.QuickDraw import * -fkDragActionAll = -1 - - -kDragHasLeftSenderWindow = (1 << 0) -kDragInsideSenderApplication = (1 << 1) -kDragInsideSenderWindow = (1 << 2) -kDragRegionAndImage = (1 << 4) -flavorSenderOnly = (1 << 0) -flavorSenderTranslated = (1 << 1) -flavorNotSaved = (1 << 2) -flavorSystemTranslated = (1 << 8) -kDragHasLeftSenderWindow = (1L << 0) -kDragInsideSenderApplication = (1L << 1) -kDragInsideSenderWindow = (1L << 2) -kDragBehaviorNone = 0 -kDragBehaviorZoomBackAnimation = (1L << 0) -kDragRegionAndImage = (1L << 4) -kDragStandardTranslucency = 0L -kDragDarkTranslucency = 1L -kDragDarkerTranslucency = 2L -kDragOpaqueTranslucency = 3L -kDragRegionBegin = 1 -kDragRegionDraw = 2 -kDragRegionHide = 3 -kDragRegionIdle = 4 -kDragRegionEnd = 5 -kZoomNoAcceleration = 0 -kZoomAccelerate = 1 -kZoomDecelerate = 2 -flavorSenderOnly = (1 << 0) -flavorSenderTranslated = (1 << 1) -flavorNotSaved = (1 << 2) -flavorSystemTranslated = (1 << 8) -flavorDataPromised = (1 << 9) -kDragFlavorTypeHFS = FOUR_CHAR_CODE('hfs ') -kDragFlavorTypePromiseHFS = FOUR_CHAR_CODE('phfs') -flavorTypeHFS = kDragFlavorTypeHFS -flavorTypePromiseHFS = kDragFlavorTypePromiseHFS -kDragPromisedFlavorFindFile = FOUR_CHAR_CODE('rWm1') -kDragPromisedFlavor = FOUR_CHAR_CODE('fssP') -kDragPseudoCreatorVolumeOrDirectory = FOUR_CHAR_CODE('MACS') -kDragPseudoFileTypeVolume = FOUR_CHAR_CODE('disk') -kDragPseudoFileTypeDirectory = FOUR_CHAR_CODE('fold') -flavorTypeDirectory = FOUR_CHAR_CODE('diry') -kFlavorTypeClippingName = FOUR_CHAR_CODE('clnm') -kFlavorTypeClippingFilename = FOUR_CHAR_CODE('clfn') -kFlavorTypeDragToTrashOnly = FOUR_CHAR_CODE('fdtt') -kFlavorTypeFinderNoTrackingBehavior = FOUR_CHAR_CODE('fntb') -kDragTrackingEnterHandler = 1 -kDragTrackingEnterWindow = 2 -kDragTrackingInWindow = 3 -kDragTrackingLeaveWindow = 4 -kDragTrackingLeaveHandler = 5 -kDragActionNothing = 0L -kDragActionCopy = 1L -kDragActionAlias = (1L << 1) -kDragActionGeneric = (1L << 2) -kDragActionPrivate = (1L << 3) -kDragActionMove = (1L << 4) -kDragActionDelete = (1L << 5) -# kDragActionAll = (long)0xFFFFFFFF -dragHasLeftSenderWindow = kDragHasLeftSenderWindow -dragInsideSenderApplication = kDragInsideSenderApplication -dragInsideSenderWindow = kDragInsideSenderWindow -dragTrackingEnterHandler = kDragTrackingEnterHandler -dragTrackingEnterWindow = kDragTrackingEnterWindow -dragTrackingInWindow = kDragTrackingInWindow -dragTrackingLeaveWindow = kDragTrackingLeaveWindow -dragTrackingLeaveHandler = kDragTrackingLeaveHandler -dragRegionBegin = kDragRegionBegin -dragRegionDraw = kDragRegionDraw -dragRegionHide = kDragRegionHide -dragRegionIdle = kDragRegionIdle -dragRegionEnd = kDragRegionEnd -zoomNoAcceleration = kZoomNoAcceleration -zoomAccelerate = kZoomAccelerate -zoomDecelerate = kZoomDecelerate -kDragStandardImage = kDragStandardTranslucency -kDragDarkImage = kDragDarkTranslucency -kDragDarkerImage = kDragDarkerTranslucency -kDragOpaqueImage = kDragOpaqueTranslucency diff --git a/sys/lib/python/plat-mac/Carbon/Events.py b/sys/lib/python/plat-mac/Carbon/Events.py deleted file mode 100644 index 269f4f144..000000000 --- a/sys/lib/python/plat-mac/Carbon/Events.py +++ /dev/null @@ -1,102 +0,0 @@ -# Generated from 'Events.h' - -nullEvent = 0 -mouseDown = 1 -mouseUp = 2 -keyDown = 3 -keyUp = 4 -autoKey = 5 -updateEvt = 6 -diskEvt = 7 -activateEvt = 8 -osEvt = 15 -kHighLevelEvent = 23 -mDownMask = 1 << mouseDown -mUpMask = 1 << mouseUp -keyDownMask = 1 << keyDown -keyUpMask = 1 << keyUp -autoKeyMask = 1 << autoKey -updateMask = 1 << updateEvt -diskMask = 1 << diskEvt -activMask = 1 << activateEvt -highLevelEventMask = 0x0400 -osMask = 1 << osEvt -everyEvent = 0xFFFF -charCodeMask = 0x000000FF -keyCodeMask = 0x0000FF00 -adbAddrMask = 0x00FF0000 -# osEvtMessageMask = (unsigned long)0xFF000000 -mouseMovedMessage = 0x00FA -suspendResumeMessage = 0x0001 -resumeFlag = 1 -convertClipboardFlag = 2 -activeFlagBit = 0 -btnStateBit = 7 -cmdKeyBit = 8 -shiftKeyBit = 9 -alphaLockBit = 10 -optionKeyBit = 11 -controlKeyBit = 12 -rightShiftKeyBit = 13 -rightOptionKeyBit = 14 -rightControlKeyBit = 15 -activeFlag = 1 << activeFlagBit -btnState = 1 << btnStateBit -cmdKey = 1 << cmdKeyBit -shiftKey = 1 << shiftKeyBit -alphaLock = 1 << alphaLockBit -optionKey = 1 << optionKeyBit -controlKey = 1 << controlKeyBit -rightShiftKey = 1 << rightShiftKeyBit -rightOptionKey = 1 << rightOptionKeyBit -rightControlKey = 1 << rightControlKeyBit -kNullCharCode = 0 -kHomeCharCode = 1 -kEnterCharCode = 3 -kEndCharCode = 4 -kHelpCharCode = 5 -kBellCharCode = 7 -kBackspaceCharCode = 8 -kTabCharCode = 9 -kLineFeedCharCode = 10 -kVerticalTabCharCode = 11 -kPageUpCharCode = 11 -kFormFeedCharCode = 12 -kPageDownCharCode = 12 -kReturnCharCode = 13 -kFunctionKeyCharCode = 16 -kCommandCharCode = 17 -kCheckCharCode = 18 -kDiamondCharCode = 19 -kAppleLogoCharCode = 20 -kEscapeCharCode = 27 -kClearCharCode = 27 -kLeftArrowCharCode = 28 -kRightArrowCharCode = 29 -kUpArrowCharCode = 30 -kDownArrowCharCode = 31 -kSpaceCharCode = 32 -kDeleteCharCode = 127 -kBulletCharCode = 165 -kNonBreakingSpaceCharCode = 202 -kShiftUnicode = 0x21E7 -kControlUnicode = 0x2303 -kOptionUnicode = 0x2325 -kCommandUnicode = 0x2318 -kPencilUnicode = 0x270E -kCheckUnicode = 0x2713 -kDiamondUnicode = 0x25C6 -kBulletUnicode = 0x2022 -kAppleLogoUnicode = 0xF8FF -networkEvt = 10 -driverEvt = 11 -app1Evt = 12 -app2Evt = 13 -app3Evt = 14 -app4Evt = 15 -networkMask = 0x0400 -driverMask = 0x0800 -app1Mask = 0x1000 -app2Mask = 0x2000 -app3Mask = 0x4000 -app4Mask = 0x8000 diff --git a/sys/lib/python/plat-mac/Carbon/Evt.py b/sys/lib/python/plat-mac/Carbon/Evt.py deleted file mode 100644 index 7a5ffa699..000000000 --- a/sys/lib/python/plat-mac/Carbon/Evt.py +++ /dev/null @@ -1 +0,0 @@ -from _Evt import * diff --git a/sys/lib/python/plat-mac/Carbon/File.py b/sys/lib/python/plat-mac/Carbon/File.py deleted file mode 100644 index 58c28574c..000000000 --- a/sys/lib/python/plat-mac/Carbon/File.py +++ /dev/null @@ -1 +0,0 @@ -from _File import * diff --git a/sys/lib/python/plat-mac/Carbon/Files.py b/sys/lib/python/plat-mac/Carbon/Files.py deleted file mode 100644 index 678bbc794..000000000 --- a/sys/lib/python/plat-mac/Carbon/Files.py +++ /dev/null @@ -1,426 +0,0 @@ -# Generated from 'Files.h' - -def FOUR_CHAR_CODE(x): return x -true = True -false = False -fsCurPerm = 0x00 -fsRdPerm = 0x01 -fsWrPerm = 0x02 -fsRdWrPerm = 0x03 -fsRdWrShPerm = 0x04 -fsRdDenyPerm = 0x10 -fsWrDenyPerm = 0x20 -fsRtParID = 1 -fsRtDirID = 2 -fsAtMark = 0 -fsFromStart = 1 -fsFromLEOF = 2 -fsFromMark = 3 -pleaseCacheBit = 4 -pleaseCacheMask = 0x0010 -noCacheBit = 5 -noCacheMask = 0x0020 -rdVerifyBit = 6 -rdVerifyMask = 0x0040 -rdVerify = 64 -forceReadBit = 6 -forceReadMask = 0x0040 -newLineBit = 7 -newLineMask = 0x0080 -newLineCharMask = 0xFF00 -fsSBPartialName = 1 -fsSBFullName = 2 -fsSBFlAttrib = 4 -fsSBFlFndrInfo = 8 -fsSBFlLgLen = 32 -fsSBFlPyLen = 64 -fsSBFlRLgLen = 128 -fsSBFlRPyLen = 256 -fsSBFlCrDat = 512 -fsSBFlMdDat = 1024 -fsSBFlBkDat = 2048 -fsSBFlXFndrInfo = 4096 -fsSBFlParID = 8192 -fsSBNegate = 16384 -fsSBDrUsrWds = 8 -fsSBDrNmFls = 16 -fsSBDrCrDat = 512 -fsSBDrMdDat = 1024 -fsSBDrBkDat = 2048 -fsSBDrFndrInfo = 4096 -fsSBDrParID = 8192 -fsSBPartialNameBit = 0 -fsSBFullNameBit = 1 -fsSBFlAttribBit = 2 -fsSBFlFndrInfoBit = 3 -fsSBFlLgLenBit = 5 -fsSBFlPyLenBit = 6 -fsSBFlRLgLenBit = 7 -fsSBFlRPyLenBit = 8 -fsSBFlCrDatBit = 9 -fsSBFlMdDatBit = 10 -fsSBFlBkDatBit = 11 -fsSBFlXFndrInfoBit = 12 -fsSBFlParIDBit = 13 -fsSBNegateBit = 14 -fsSBDrUsrWdsBit = 3 -fsSBDrNmFlsBit = 4 -fsSBDrCrDatBit = 9 -fsSBDrMdDatBit = 10 -fsSBDrBkDatBit = 11 -fsSBDrFndrInfoBit = 12 -fsSBDrParIDBit = 13 -bLimitFCBs = 31 -bLocalWList = 30 -bNoMiniFndr = 29 -bNoVNEdit = 28 -bNoLclSync = 27 -bTrshOffLine = 26 -bNoSwitchTo = 25 -bDontShareIt = 21 -bNoDeskItems = 20 -bNoBootBlks = 19 -bAccessCntl = 18 -bNoSysDir = 17 -bHasExtFSVol = 16 -bHasOpenDeny = 15 -bHasCopyFile = 14 -bHasMoveRename = 13 -bHasDesktopMgr = 12 -bHasShortName = 11 -bHasFolderLock = 10 -bHasPersonalAccessPrivileges = 9 -bHasUserGroupList = 8 -bHasCatSearch = 7 -bHasFileIDs = 6 -bHasBTreeMgr = 5 -bHasBlankAccessPrivileges = 4 -bSupportsAsyncRequests = 3 -bSupportsTrashVolumeCache = 2 -bIsEjectable = 0 -bSupportsHFSPlusAPIs = 1 -bSupportsFSCatalogSearch = 2 -bSupportsFSExchangeObjects = 3 -bSupports2TBFiles = 4 -bSupportsLongNames = 5 -bSupportsMultiScriptNames = 6 -bSupportsNamedForks = 7 -bSupportsSubtreeIterators = 8 -bL2PCanMapFileBlocks = 9 -bParentModDateChanges = 10 -bAncestorModDateChanges = 11 -bSupportsSymbolicLinks = 13 -bIsAutoMounted = 14 -bAllowCDiDataHandler = 17 -kLargeIcon = 1 -kLarge4BitIcon = 2 -kLarge8BitIcon = 3 -kSmallIcon = 4 -kSmall4BitIcon = 5 -kSmall8BitIcon = 6 -kicnsIconFamily = 239 -kLargeIconSize = 256 -kLarge4BitIconSize = 512 -kLarge8BitIconSize = 1024 -kSmallIconSize = 64 -kSmall4BitIconSize = 128 -kSmall8BitIconSize = 256 -kWidePosOffsetBit = 8 -kUseWidePositioning = (1 << kWidePosOffsetBit) -kMaximumBlocksIn4GB = 0x007FFFFF -fsUnixPriv = 1 -kNoUserAuthentication = 1 -kPassword = 2 -kEncryptPassword = 3 -kTwoWayEncryptPassword = 6 -kOwnerID2Name = 1 -kGroupID2Name = 2 -kOwnerName2ID = 3 -kGroupName2ID = 4 -kReturnNextUser = 1 -kReturnNextGroup = 2 -kReturnNextUG = 3 -kVCBFlagsIdleFlushBit = 3 -kVCBFlagsIdleFlushMask = 0x0008 -kVCBFlagsHFSPlusAPIsBit = 4 -kVCBFlagsHFSPlusAPIsMask = 0x0010 -kVCBFlagsHardwareGoneBit = 5 -kVCBFlagsHardwareGoneMask = 0x0020 -kVCBFlagsVolumeDirtyBit = 15 -kVCBFlagsVolumeDirtyMask = 0x8000 -kioVAtrbDefaultVolumeBit = 5 -kioVAtrbDefaultVolumeMask = 0x0020 -kioVAtrbFilesOpenBit = 6 -kioVAtrbFilesOpenMask = 0x0040 -kioVAtrbHardwareLockedBit = 7 -kioVAtrbHardwareLockedMask = 0x0080 -kioVAtrbSoftwareLockedBit = 15 -kioVAtrbSoftwareLockedMask = 0x8000 -kioFlAttribLockedBit = 0 -kioFlAttribLockedMask = 0x01 -kioFlAttribResOpenBit = 2 -kioFlAttribResOpenMask = 0x04 -kioFlAttribDataOpenBit = 3 -kioFlAttribDataOpenMask = 0x08 -kioFlAttribDirBit = 4 -kioFlAttribDirMask = 0x10 -ioDirFlg = 4 -ioDirMask = 0x10 -kioFlAttribCopyProtBit = 6 -kioFlAttribCopyProtMask = 0x40 -kioFlAttribFileOpenBit = 7 -kioFlAttribFileOpenMask = 0x80 -kioFlAttribInSharedBit = 2 -kioFlAttribInSharedMask = 0x04 -kioFlAttribMountedBit = 3 -kioFlAttribMountedMask = 0x08 -kioFlAttribSharePointBit = 5 -kioFlAttribSharePointMask = 0x20 -kioFCBWriteBit = 8 -kioFCBWriteMask = 0x0100 -kioFCBResourceBit = 9 -kioFCBResourceMask = 0x0200 -kioFCBWriteLockedBit = 10 -kioFCBWriteLockedMask = 0x0400 -kioFCBLargeFileBit = 11 -kioFCBLargeFileMask = 0x0800 -kioFCBSharedWriteBit = 12 -kioFCBSharedWriteMask = 0x1000 -kioFCBFileLockedBit = 13 -kioFCBFileLockedMask = 0x2000 -kioFCBOwnClumpBit = 14 -kioFCBOwnClumpMask = 0x4000 -kioFCBModifiedBit = 15 -kioFCBModifiedMask = 0x8000 -kioACUserNoSeeFolderBit = 0 -kioACUserNoSeeFolderMask = 0x01 -kioACUserNoSeeFilesBit = 1 -kioACUserNoSeeFilesMask = 0x02 -kioACUserNoMakeChangesBit = 2 -kioACUserNoMakeChangesMask = 0x04 -kioACUserNotOwnerBit = 7 -kioACUserNotOwnerMask = 0x80 -kioACAccessOwnerBit = 31 -# kioACAccessOwnerMask = (long)0x80000000 -kioACAccessBlankAccessBit = 28 -kioACAccessBlankAccessMask = 0x10000000 -kioACAccessUserWriteBit = 26 -kioACAccessUserWriteMask = 0x04000000 -kioACAccessUserReadBit = 25 -kioACAccessUserReadMask = 0x02000000 -kioACAccessUserSearchBit = 24 -kioACAccessUserSearchMask = 0x01000000 -kioACAccessEveryoneWriteBit = 18 -kioACAccessEveryoneWriteMask = 0x00040000 -kioACAccessEveryoneReadBit = 17 -kioACAccessEveryoneReadMask = 0x00020000 -kioACAccessEveryoneSearchBit = 16 -kioACAccessEveryoneSearchMask = 0x00010000 -kioACAccessGroupWriteBit = 10 -kioACAccessGroupWriteMask = 0x00000400 -kioACAccessGroupReadBit = 9 -kioACAccessGroupReadMask = 0x00000200 -kioACAccessGroupSearchBit = 8 -kioACAccessGroupSearchMask = 0x00000100 -kioACAccessOwnerWriteBit = 2 -kioACAccessOwnerWriteMask = 0x00000004 -kioACAccessOwnerReadBit = 1 -kioACAccessOwnerReadMask = 0x00000002 -kioACAccessOwnerSearchBit = 0 -kioACAccessOwnerSearchMask = 0x00000001 -kfullPrivileges = 0x00070007 -kownerPrivileges = 0x00000007 -knoUser = 0 -kadministratorUser = 1 -knoGroup = 0 -AppleShareMediaType = FOUR_CHAR_CODE('afpm') -volMountNoLoginMsgFlagBit = 0 -volMountNoLoginMsgFlagMask = 0x0001 -volMountExtendedFlagsBit = 7 -volMountExtendedFlagsMask = 0x0080 -volMountInteractBit = 15 -volMountInteractMask = 0x8000 -volMountChangedBit = 14 -volMountChangedMask = 0x4000 -volMountFSReservedMask = 0x00FF -volMountSysReservedMask = 0xFF00 -kAFPExtendedFlagsAlternateAddressMask = 1 -kAFPTagTypeIP = 0x01 -kAFPTagTypeIPPort = 0x02 -kAFPTagTypeDDP = 0x03 -kAFPTagTypeDNS = 0x04 -kAFPTagLengthIP = 0x06 -kAFPTagLengthIPPort = 0x08 -kAFPTagLengthDDP = 0x06 -kFSInvalidVolumeRefNum = 0 -kFSCatInfoNone = 0x00000000 -kFSCatInfoTextEncoding = 0x00000001 -kFSCatInfoNodeFlags = 0x00000002 -kFSCatInfoVolume = 0x00000004 -kFSCatInfoParentDirID = 0x00000008 -kFSCatInfoNodeID = 0x00000010 -kFSCatInfoCreateDate = 0x00000020 -kFSCatInfoContentMod = 0x00000040 -kFSCatInfoAttrMod = 0x00000080 -kFSCatInfoAccessDate = 0x00000100 -kFSCatInfoBackupDate = 0x00000200 -kFSCatInfoPermissions = 0x00000400 -kFSCatInfoFinderInfo = 0x00000800 -kFSCatInfoFinderXInfo = 0x00001000 -kFSCatInfoValence = 0x00002000 -kFSCatInfoDataSizes = 0x00004000 -kFSCatInfoRsrcSizes = 0x00008000 -kFSCatInfoSharingFlags = 0x00010000 -kFSCatInfoUserPrivs = 0x00020000 -kFSCatInfoUserAccess = 0x00080000 -kFSCatInfoAllDates = 0x000003E0 -kFSCatInfoGettableInfo = 0x0003FFFF -kFSCatInfoSettableInfo = 0x00001FE3 -# kFSCatInfoReserved = (long)0xFFFC0000 -kFSNodeLockedBit = 0 -kFSNodeLockedMask = 0x0001 -kFSNodeResOpenBit = 2 -kFSNodeResOpenMask = 0x0004 -kFSNodeDataOpenBit = 3 -kFSNodeDataOpenMask = 0x0008 -kFSNodeIsDirectoryBit = 4 -kFSNodeIsDirectoryMask = 0x0010 -kFSNodeCopyProtectBit = 6 -kFSNodeCopyProtectMask = 0x0040 -kFSNodeForkOpenBit = 7 -kFSNodeForkOpenMask = 0x0080 -kFSNodeInSharedBit = 2 -kFSNodeInSharedMask = 0x0004 -kFSNodeIsMountedBit = 3 -kFSNodeIsMountedMask = 0x0008 -kFSNodeIsSharePointBit = 5 -kFSNodeIsSharePointMask = 0x0020 -kFSIterateFlat = 0 -kFSIterateSubtree = 1 -kFSIterateDelete = 2 -# kFSIterateReserved = (long)0xFFFFFFFC -fsSBNodeID = 0x00008000 -fsSBAttributeModDate = 0x00010000 -fsSBAccessDate = 0x00020000 -fsSBPermissions = 0x00040000 -fsSBNodeIDBit = 15 -fsSBAttributeModDateBit = 16 -fsSBAccessDateBit = 17 -fsSBPermissionsBit = 18 -kFSAllocDefaultFlags = 0x0000 -kFSAllocAllOrNothingMask = 0x0001 -kFSAllocContiguousMask = 0x0002 -kFSAllocNoRoundUpMask = 0x0004 -kFSAllocReservedMask = 0xFFF8 -kFSVolInfoNone = 0x0000 -kFSVolInfoCreateDate = 0x0001 -kFSVolInfoModDate = 0x0002 -kFSVolInfoBackupDate = 0x0004 -kFSVolInfoCheckedDate = 0x0008 -kFSVolInfoFileCount = 0x0010 -kFSVolInfoDirCount = 0x0020 -kFSVolInfoSizes = 0x0040 -kFSVolInfoBlocks = 0x0080 -kFSVolInfoNextAlloc = 0x0100 -kFSVolInfoRsrcClump = 0x0200 -kFSVolInfoDataClump = 0x0400 -kFSVolInfoNextID = 0x0800 -kFSVolInfoFinderInfo = 0x1000 -kFSVolInfoFlags = 0x2000 -kFSVolInfoFSInfo = 0x4000 -kFSVolInfoDriveInfo = 0x8000 -kFSVolInfoGettableInfo = 0xFFFF -kFSVolInfoSettableInfo = 0x3004 -kFSVolFlagDefaultVolumeBit = 5 -kFSVolFlagDefaultVolumeMask = 0x0020 -kFSVolFlagFilesOpenBit = 6 -kFSVolFlagFilesOpenMask = 0x0040 -kFSVolFlagHardwareLockedBit = 7 -kFSVolFlagHardwareLockedMask = 0x0080 -kFSVolFlagSoftwareLockedBit = 15 -kFSVolFlagSoftwareLockedMask = 0x8000 -kFNDirectoryModifiedMessage = 1 -kFNNoImplicitAllSubscription = (1 << 0) -rAliasType = FOUR_CHAR_CODE('alis') -kARMMountVol = 0x00000001 -kARMNoUI = 0x00000002 -kARMMultVols = 0x00000008 -kARMSearch = 0x00000100 -kARMSearchMore = 0x00000200 -kARMSearchRelFirst = 0x00000400 -asiZoneName = -3 -asiServerName = -2 -asiVolumeName = -1 -asiAliasName = 0 -asiParentName = 1 -kResolveAliasFileNoUI = 0x00000001 -kClippingCreator = FOUR_CHAR_CODE('drag') -kClippingPictureType = FOUR_CHAR_CODE('clpp') -kClippingTextType = FOUR_CHAR_CODE('clpt') -kClippingSoundType = FOUR_CHAR_CODE('clps') -kClippingUnknownType = FOUR_CHAR_CODE('clpu') -kInternetLocationCreator = FOUR_CHAR_CODE('drag') -kInternetLocationHTTP = FOUR_CHAR_CODE('ilht') -kInternetLocationFTP = FOUR_CHAR_CODE('ilft') -kInternetLocationFile = FOUR_CHAR_CODE('ilfi') -kInternetLocationMail = FOUR_CHAR_CODE('ilma') -kInternetLocationNNTP = FOUR_CHAR_CODE('ilnw') -kInternetLocationAFP = FOUR_CHAR_CODE('ilaf') -kInternetLocationAppleTalk = FOUR_CHAR_CODE('ilat') -kInternetLocationNSL = FOUR_CHAR_CODE('ilns') -kInternetLocationGeneric = FOUR_CHAR_CODE('ilge') -kCustomIconResource = -16455 -kCustomBadgeResourceType = FOUR_CHAR_CODE('badg') -kCustomBadgeResourceID = kCustomIconResource -kCustomBadgeResourceVersion = 0 -# kSystemFolderType = 'macs'. -kRoutingResourceType = FOUR_CHAR_CODE('rout') -kRoutingResourceID = 0 -kContainerFolderAliasType = FOUR_CHAR_CODE('fdrp') -kContainerTrashAliasType = FOUR_CHAR_CODE('trsh') -kContainerHardDiskAliasType = FOUR_CHAR_CODE('hdsk') -kContainerFloppyAliasType = FOUR_CHAR_CODE('flpy') -kContainerServerAliasType = FOUR_CHAR_CODE('srvr') -kApplicationAliasType = FOUR_CHAR_CODE('adrp') -kContainerAliasType = FOUR_CHAR_CODE('drop') -kDesktopPrinterAliasType = FOUR_CHAR_CODE('dtpa') -kContainerCDROMAliasType = FOUR_CHAR_CODE('cddr') -kApplicationCPAliasType = FOUR_CHAR_CODE('acdp') -kApplicationDAAliasType = FOUR_CHAR_CODE('addp') -kPackageAliasType = FOUR_CHAR_CODE('fpka') -kAppPackageAliasType = FOUR_CHAR_CODE('fapa') -kSystemFolderAliasType = FOUR_CHAR_CODE('fasy') -kAppleMenuFolderAliasType = FOUR_CHAR_CODE('faam') -kStartupFolderAliasType = FOUR_CHAR_CODE('fast') -kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn') -kPreferencesFolderAliasType = FOUR_CHAR_CODE('fapf') -kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact') -kExtensionFolderAliasType = FOUR_CHAR_CODE('faex') -kExportedFolderAliasType = FOUR_CHAR_CODE('faet') -kDropFolderAliasType = FOUR_CHAR_CODE('fadr') -kSharedFolderAliasType = FOUR_CHAR_CODE('fash') -kMountedFolderAliasType = FOUR_CHAR_CODE('famn') -kIsOnDesk = 0x0001 -kColor = 0x000E -kIsShared = 0x0040 -kHasNoINITs = 0x0080 -kHasBeenInited = 0x0100 -kHasCustomIcon = 0x0400 -kIsStationery = 0x0800 -kNameLocked = 0x1000 -kHasBundle = 0x2000 -kIsInvisible = 0x4000 -kIsAlias = 0x8000 -fOnDesk = kIsOnDesk -fHasBundle = kHasBundle -fInvisible = kIsInvisible -fTrash = -3 -fDesktop = -2 -fDisk = 0 -kIsStationary = kIsStationery -kExtendedFlagsAreInvalid = 0x8000 -kExtendedFlagHasCustomBadge = 0x0100 -kExtendedFlagHasRoutingInfo = 0x0004 -kFirstMagicBusyFiletype = FOUR_CHAR_CODE('bzy ') -kLastMagicBusyFiletype = FOUR_CHAR_CODE('bzy?') -kMagicBusyCreationDate = 0x4F3AFDB0 diff --git a/sys/lib/python/plat-mac/Carbon/Fm.py b/sys/lib/python/plat-mac/Carbon/Fm.py deleted file mode 100644 index 0f42fdcd9..000000000 --- a/sys/lib/python/plat-mac/Carbon/Fm.py +++ /dev/null @@ -1 +0,0 @@ -from _Fm import * diff --git a/sys/lib/python/plat-mac/Carbon/Folder.py b/sys/lib/python/plat-mac/Carbon/Folder.py deleted file mode 100644 index a4e490289..000000000 --- a/sys/lib/python/plat-mac/Carbon/Folder.py +++ /dev/null @@ -1 +0,0 @@ -from _Folder import * diff --git a/sys/lib/python/plat-mac/Carbon/Folders.py b/sys/lib/python/plat-mac/Carbon/Folders.py deleted file mode 100644 index 52cf15808..000000000 --- a/sys/lib/python/plat-mac/Carbon/Folders.py +++ /dev/null @@ -1,190 +0,0 @@ -# Generated from 'Folders.h' - -def FOUR_CHAR_CODE(x): return x -true = True -false = False -kOnSystemDisk = -32768L -kOnAppropriateDisk = -32767 -kSystemDomain = -32766 -kLocalDomain = -32765 -kNetworkDomain = -32764 -kUserDomain = -32763 -kClassicDomain = -32762 -kCreateFolder = true -kDontCreateFolder = false -kSystemFolderType = FOUR_CHAR_CODE('macs') -kDesktopFolderType = FOUR_CHAR_CODE('desk') -kSystemDesktopFolderType = FOUR_CHAR_CODE('sdsk') -kTrashFolderType = FOUR_CHAR_CODE('trsh') -kSystemTrashFolderType = FOUR_CHAR_CODE('strs') -kWhereToEmptyTrashFolderType = FOUR_CHAR_CODE('empt') -kPrintMonitorDocsFolderType = FOUR_CHAR_CODE('prnt') -kStartupFolderType = FOUR_CHAR_CODE('strt') -kShutdownFolderType = FOUR_CHAR_CODE('shdf') -kAppleMenuFolderType = FOUR_CHAR_CODE('amnu') -kControlPanelFolderType = FOUR_CHAR_CODE('ctrl') -kSystemControlPanelFolderType = FOUR_CHAR_CODE('sctl') -kExtensionFolderType = FOUR_CHAR_CODE('extn') -kFontsFolderType = FOUR_CHAR_CODE('font') -kPreferencesFolderType = FOUR_CHAR_CODE('pref') -kSystemPreferencesFolderType = FOUR_CHAR_CODE('sprf') -kTemporaryFolderType = FOUR_CHAR_CODE('temp') -kExtensionDisabledFolderType = FOUR_CHAR_CODE('extD') -kControlPanelDisabledFolderType = FOUR_CHAR_CODE('ctrD') -kSystemExtensionDisabledFolderType = FOUR_CHAR_CODE('macD') -kStartupItemsDisabledFolderType = FOUR_CHAR_CODE('strD') -kShutdownItemsDisabledFolderType = FOUR_CHAR_CODE('shdD') -kApplicationsFolderType = FOUR_CHAR_CODE('apps') -kDocumentsFolderType = FOUR_CHAR_CODE('docs') -kVolumeRootFolderType = FOUR_CHAR_CODE('root') -kChewableItemsFolderType = FOUR_CHAR_CODE('flnt') -kApplicationSupportFolderType = FOUR_CHAR_CODE('asup') -kTextEncodingsFolderType = FOUR_CHAR_CODE('\xc4tex') -kStationeryFolderType = FOUR_CHAR_CODE('odst') -kOpenDocFolderType = FOUR_CHAR_CODE('odod') -kOpenDocShellPlugInsFolderType = FOUR_CHAR_CODE('odsp') -kEditorsFolderType = FOUR_CHAR_CODE('oded') -kOpenDocEditorsFolderType = FOUR_CHAR_CODE('\xc4odf') -kOpenDocLibrariesFolderType = FOUR_CHAR_CODE('odlb') -kGenEditorsFolderType = FOUR_CHAR_CODE('\xc4edi') -kHelpFolderType = FOUR_CHAR_CODE('\xc4hlp') -kInternetPlugInFolderType = FOUR_CHAR_CODE('\xc4net') -kModemScriptsFolderType = FOUR_CHAR_CODE('\xc4mod') -kPrinterDescriptionFolderType = FOUR_CHAR_CODE('ppdf') -kPrinterDriverFolderType = FOUR_CHAR_CODE('\xc4prd') -kScriptingAdditionsFolderType = FOUR_CHAR_CODE('\xc4scr') -kSharedLibrariesFolderType = FOUR_CHAR_CODE('\xc4lib') -kVoicesFolderType = FOUR_CHAR_CODE('fvoc') -kControlStripModulesFolderType = FOUR_CHAR_CODE('sdev') -kAssistantsFolderType = FOUR_CHAR_CODE('ast\xc4') -kUtilitiesFolderType = FOUR_CHAR_CODE('uti\xc4') -kAppleExtrasFolderType = FOUR_CHAR_CODE('aex\xc4') -kContextualMenuItemsFolderType = FOUR_CHAR_CODE('cmnu') -kMacOSReadMesFolderType = FOUR_CHAR_CODE('mor\xc4') -kALMModulesFolderType = FOUR_CHAR_CODE('walk') -kALMPreferencesFolderType = FOUR_CHAR_CODE('trip') -kALMLocationsFolderType = FOUR_CHAR_CODE('fall') -kColorSyncProfilesFolderType = FOUR_CHAR_CODE('prof') -kThemesFolderType = FOUR_CHAR_CODE('thme') -kFavoritesFolderType = FOUR_CHAR_CODE('favs') -kInternetFolderType = FOUR_CHAR_CODE('int\xc4') -kAppearanceFolderType = FOUR_CHAR_CODE('appr') -kSoundSetsFolderType = FOUR_CHAR_CODE('snds') -kDesktopPicturesFolderType = FOUR_CHAR_CODE('dtp\xc4') -kInternetSearchSitesFolderType = FOUR_CHAR_CODE('issf') -kFindSupportFolderType = FOUR_CHAR_CODE('fnds') -kFindByContentFolderType = FOUR_CHAR_CODE('fbcf') -kInstallerLogsFolderType = FOUR_CHAR_CODE('ilgf') -kScriptsFolderType = FOUR_CHAR_CODE('scr\xc4') -kFolderActionsFolderType = FOUR_CHAR_CODE('fasf') -kLauncherItemsFolderType = FOUR_CHAR_CODE('laun') -kRecentApplicationsFolderType = FOUR_CHAR_CODE('rapp') -kRecentDocumentsFolderType = FOUR_CHAR_CODE('rdoc') -kRecentServersFolderType = FOUR_CHAR_CODE('rsvr') -kSpeakableItemsFolderType = FOUR_CHAR_CODE('spki') -kKeychainFolderType = FOUR_CHAR_CODE('kchn') -kQuickTimeExtensionsFolderType = FOUR_CHAR_CODE('qtex') -kDisplayExtensionsFolderType = FOUR_CHAR_CODE('dspl') -kMultiprocessingFolderType = FOUR_CHAR_CODE('mpxf') -kPrintingPlugInsFolderType = FOUR_CHAR_CODE('pplg') -kDomainTopLevelFolderType = FOUR_CHAR_CODE('dtop') -kDomainLibraryFolderType = FOUR_CHAR_CODE('dlib') -kColorSyncFolderType = FOUR_CHAR_CODE('sync') -kColorSyncCMMFolderType = FOUR_CHAR_CODE('ccmm') -kColorSyncScriptingFolderType = FOUR_CHAR_CODE('cscr') -kPrintersFolderType = FOUR_CHAR_CODE('impr') -kSpeechFolderType = FOUR_CHAR_CODE('spch') -kCarbonLibraryFolderType = FOUR_CHAR_CODE('carb') -kDocumentationFolderType = FOUR_CHAR_CODE('info') -kDeveloperDocsFolderType = FOUR_CHAR_CODE('ddoc') -kDeveloperHelpFolderType = FOUR_CHAR_CODE('devh') -kISSDownloadsFolderType = FOUR_CHAR_CODE('issd') -kUserSpecificTmpFolderType = FOUR_CHAR_CODE('utmp') -kCachedDataFolderType = FOUR_CHAR_CODE('cach') -kFrameworksFolderType = FOUR_CHAR_CODE('fram') -kPrivateFrameworksFolderType = FOUR_CHAR_CODE('pfrm') -kClassicDesktopFolderType = FOUR_CHAR_CODE('sdsk') -kDeveloperFolderType = FOUR_CHAR_CODE('devf') -kSystemSoundsFolderType = FOUR_CHAR_CODE('ssnd') -kComponentsFolderType = FOUR_CHAR_CODE('cmpd') -kQuickTimeComponentsFolderType = FOUR_CHAR_CODE('wcmp') -kCoreServicesFolderType = FOUR_CHAR_CODE('csrv') -kPictureDocumentsFolderType = FOUR_CHAR_CODE('pdoc') -kMovieDocumentsFolderType = FOUR_CHAR_CODE('mdoc') -kMusicDocumentsFolderType = FOUR_CHAR_CODE('\xb5doc') -kInternetSitesFolderType = FOUR_CHAR_CODE('site') -kPublicFolderType = FOUR_CHAR_CODE('pubb') -kAudioSupportFolderType = FOUR_CHAR_CODE('adio') -kAudioSoundsFolderType = FOUR_CHAR_CODE('asnd') -kAudioSoundBanksFolderType = FOUR_CHAR_CODE('bank') -kAudioAlertSoundsFolderType = FOUR_CHAR_CODE('alrt') -kAudioPlugInsFolderType = FOUR_CHAR_CODE('aplg') -kAudioComponentsFolderType = FOUR_CHAR_CODE('acmp') -kKernelExtensionsFolderType = FOUR_CHAR_CODE('kext') -kDirectoryServicesFolderType = FOUR_CHAR_CODE('dsrv') -kDirectoryServicesPlugInsFolderType = FOUR_CHAR_CODE('dplg') -kInstallerReceiptsFolderType = FOUR_CHAR_CODE('rcpt') -kFileSystemSupportFolderType = FOUR_CHAR_CODE('fsys') -kAppleShareSupportFolderType = FOUR_CHAR_CODE('shar') -kAppleShareAuthenticationFolderType = FOUR_CHAR_CODE('auth') -kMIDIDriversFolderType = FOUR_CHAR_CODE('midi') -kLocalesFolderType = FOUR_CHAR_CODE('\xc4loc') -kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') -kUsersFolderType = FOUR_CHAR_CODE('usrs') -kCurrentUserFolderType = FOUR_CHAR_CODE('cusr') -kCurrentUserRemoteFolderLocation = FOUR_CHAR_CODE('rusf') -kCurrentUserRemoteFolderType = FOUR_CHAR_CODE('rusr') -kSharedUserDataFolderType = FOUR_CHAR_CODE('sdat') -kVolumeSettingsFolderType = FOUR_CHAR_CODE('vsfd') -kAppleshareAutomountServerAliasesFolderType = FOUR_CHAR_CODE('srv\xc4') -kPreMacOS91ApplicationsFolderType = FOUR_CHAR_CODE('\x8cpps') -kPreMacOS91InstallerLogsFolderType = FOUR_CHAR_CODE('\x94lgf') -kPreMacOS91AssistantsFolderType = FOUR_CHAR_CODE('\x8cst\xc4') -kPreMacOS91UtilitiesFolderType = FOUR_CHAR_CODE('\x9fti\xc4') -kPreMacOS91AppleExtrasFolderType = FOUR_CHAR_CODE('\x8cex\xc4') -kPreMacOS91MacOSReadMesFolderType = FOUR_CHAR_CODE('\xb5or\xc4') -kPreMacOS91InternetFolderType = FOUR_CHAR_CODE('\x94nt\xc4') -kPreMacOS91AutomountedServersFolderType = FOUR_CHAR_CODE('\xa7rv\xc4') -kPreMacOS91StationeryFolderType = FOUR_CHAR_CODE('\xbfdst') -kCreateFolderAtBoot = 0x00000002 -kCreateFolderAtBootBit = 1 -kFolderCreatedInvisible = 0x00000004 -kFolderCreatedInvisibleBit = 2 -kFolderCreatedNameLocked = 0x00000008 -kFolderCreatedNameLockedBit = 3 -kFolderCreatedAdminPrivs = 0x00000010 -kFolderCreatedAdminPrivsBit = 4 -kFolderInUserFolder = 0x00000020 -kFolderInUserFolderBit = 5 -kFolderTrackedByAlias = 0x00000040 -kFolderTrackedByAliasBit = 6 -kFolderInRemoteUserFolderIfAvailable = 0x00000080 -kFolderInRemoteUserFolderIfAvailableBit = 7 -kFolderNeverMatchedInIdentifyFolder = 0x00000100 -kFolderNeverMatchedInIdentifyFolderBit = 8 -kFolderMustStayOnSameVolume = 0x00000200 -kFolderMustStayOnSameVolumeBit = 9 -kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledMask = 0x00000400 -kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledBit = 10 -kFolderInLocalOrRemoteUserFolder = kFolderInUserFolder | kFolderInRemoteUserFolderIfAvailable -kRelativeFolder = FOUR_CHAR_CODE('relf') -kSpecialFolder = FOUR_CHAR_CODE('spcf') -kBlessedFolder = FOUR_CHAR_CODE('blsf') -kRootFolder = FOUR_CHAR_CODE('rotf') -kCurrentUserFolderLocation = FOUR_CHAR_CODE('cusf') -kFindFolderRedirectionFlagUseDistinctUserFoldersBit = 0 -kFindFolderRedirectionFlagUseGivenVRefAndDirIDAsUserFolderBit = 1 -kFindFolderRedirectionFlagsUseGivenVRefNumAndDirIDAsRemoteUserFolderBit = 2 -kFolderManagerUserRedirectionGlobalsCurrentVersion = 1 -kFindFolderExtendedFlagsDoNotFollowAliasesBit = 0 -kFindFolderExtendedFlagsDoNotUseUserFolderBit = 1 -kFindFolderExtendedFlagsUseOtherUserRecord = 0x01000000 -kFolderManagerNotificationMessageUserLogIn = FOUR_CHAR_CODE('log+') -kFolderManagerNotificationMessagePreUserLogIn = FOUR_CHAR_CODE('logj') -kFolderManagerNotificationMessageUserLogOut = FOUR_CHAR_CODE('log-') -kFolderManagerNotificationMessagePostUserLogOut = FOUR_CHAR_CODE('logp') -kFolderManagerNotificationDiscardCachedData = FOUR_CHAR_CODE('dche') -kFolderManagerNotificationMessageLoginStartup = FOUR_CHAR_CODE('stup') -kDoNotRemoveWhenCurrentApplicationQuitsBit = 0 -kDoNotRemoveWheCurrentApplicationQuitsBit = kDoNotRemoveWhenCurrentApplicationQuitsBit -kStopIfAnyNotificationProcReturnsErrorBit = 31 diff --git a/sys/lib/python/plat-mac/Carbon/Fonts.py b/sys/lib/python/plat-mac/Carbon/Fonts.py deleted file mode 100644 index 8be7e7a41..000000000 --- a/sys/lib/python/plat-mac/Carbon/Fonts.py +++ /dev/null @@ -1,59 +0,0 @@ -# Generated from 'Fonts.h' - -def FOUR_CHAR_CODE(x): return x -kNilOptions = 0 -systemFont = 0 -applFont = 1 -kFMDefaultOptions = kNilOptions -kFMDefaultActivationContext = kFMDefaultOptions -kFMGlobalActivationContext = 0x00000001 -kFMLocalActivationContext = kFMDefaultActivationContext -kFMDefaultIterationScope = kFMDefaultOptions -kFMGlobalIterationScope = 0x00000001 -kFMLocalIterationScope = kFMDefaultIterationScope -kPlatformDefaultGuiFontID = applFont -kPlatformDefaultGuiFontID = -1 -commandMark = 17 -checkMark = 18 -diamondMark = 19 -appleMark = 20 -propFont = 36864L -prpFntH = 36865L -prpFntW = 36866L -prpFntHW = 36867L -fixedFont = 45056L -fxdFntH = 45057L -fxdFntW = 45058L -fxdFntHW = 45059L -fontWid = 44208L -kFMUseGlobalScopeOption = 0x00000001 -kFontIDNewYork = 2 -kFontIDGeneva = 3 -kFontIDMonaco = 4 -kFontIDVenice = 5 -kFontIDLondon = 6 -kFontIDAthens = 7 -kFontIDSanFrancisco = 8 -kFontIDToronto = 9 -kFontIDCairo = 11 -kFontIDLosAngeles = 12 -kFontIDTimes = 20 -kFontIDHelvetica = 21 -kFontIDCourier = 22 -kFontIDSymbol = 23 -kFontIDMobile = 24 -newYork = kFontIDNewYork -geneva = kFontIDGeneva -monaco = kFontIDMonaco -venice = kFontIDVenice -london = kFontIDLondon -athens = kFontIDAthens -sanFran = kFontIDSanFrancisco -toronto = kFontIDToronto -cairo = kFontIDCairo -losAngeles = kFontIDLosAngeles -times = kFontIDTimes -helvetica = kFontIDHelvetica -courier = kFontIDCourier -symbol = kFontIDSymbol -mobile = kFontIDMobile diff --git a/sys/lib/python/plat-mac/Carbon/Help.py b/sys/lib/python/plat-mac/Carbon/Help.py deleted file mode 100644 index 5fca0d7fd..000000000 --- a/sys/lib/python/plat-mac/Carbon/Help.py +++ /dev/null @@ -1 +0,0 @@ -from _Help import * diff --git a/sys/lib/python/plat-mac/Carbon/IBCarbon.py b/sys/lib/python/plat-mac/Carbon/IBCarbon.py deleted file mode 100644 index 60f0e74ca..000000000 --- a/sys/lib/python/plat-mac/Carbon/IBCarbon.py +++ /dev/null @@ -1 +0,0 @@ -from _IBCarbon import * diff --git a/sys/lib/python/plat-mac/Carbon/IBCarbonRuntime.py b/sys/lib/python/plat-mac/Carbon/IBCarbonRuntime.py deleted file mode 100644 index 46780187d..000000000 --- a/sys/lib/python/plat-mac/Carbon/IBCarbonRuntime.py +++ /dev/null @@ -1,5 +0,0 @@ -# Generated from 'IBCarbonRuntime.h' - -kIBCarbonRuntimeCantFindNibFile = -10960 -kIBCarbonRuntimeObjectNotOfRequestedType = -10961 -kIBCarbonRuntimeCantFindObject = -10962 diff --git a/sys/lib/python/plat-mac/Carbon/Icn.py b/sys/lib/python/plat-mac/Carbon/Icn.py deleted file mode 100644 index b04134c8e..000000000 --- a/sys/lib/python/plat-mac/Carbon/Icn.py +++ /dev/null @@ -1 +0,0 @@ -from _Icn import * diff --git a/sys/lib/python/plat-mac/Carbon/Icons.py b/sys/lib/python/plat-mac/Carbon/Icons.py deleted file mode 100644 index 86dae632d..000000000 --- a/sys/lib/python/plat-mac/Carbon/Icons.py +++ /dev/null @@ -1,381 +0,0 @@ -# Generated from 'Icons.h' - -def FOUR_CHAR_CODE(x): return x -from Carbon.Files import * -kGenericDocumentIconResource = -4000 -kGenericStationeryIconResource = -3985 -kGenericEditionFileIconResource = -3989 -kGenericApplicationIconResource = -3996 -kGenericDeskAccessoryIconResource = -3991 -kGenericFolderIconResource = -3999 -kPrivateFolderIconResource = -3994 -kFloppyIconResource = -3998 -kTrashIconResource = -3993 -kGenericRAMDiskIconResource = -3988 -kGenericCDROMIconResource = -3987 -kDesktopIconResource = -3992 -kOpenFolderIconResource = -3997 -kGenericHardDiskIconResource = -3995 -kGenericFileServerIconResource = -3972 -kGenericSuitcaseIconResource = -3970 -kGenericMoverObjectIconResource = -3969 -kGenericPreferencesIconResource = -3971 -kGenericQueryDocumentIconResource = -16506 -kGenericExtensionIconResource = -16415 -kSystemFolderIconResource = -3983 -kHelpIconResource = -20271 -kAppleMenuFolderIconResource = -3982 -genericDocumentIconResource = kGenericDocumentIconResource -genericStationeryIconResource = kGenericStationeryIconResource -genericEditionFileIconResource = kGenericEditionFileIconResource -genericApplicationIconResource = kGenericApplicationIconResource -genericDeskAccessoryIconResource = kGenericDeskAccessoryIconResource -genericFolderIconResource = kGenericFolderIconResource -privateFolderIconResource = kPrivateFolderIconResource -floppyIconResource = kFloppyIconResource -trashIconResource = kTrashIconResource -genericRAMDiskIconResource = kGenericRAMDiskIconResource -genericCDROMIconResource = kGenericCDROMIconResource -desktopIconResource = kDesktopIconResource -openFolderIconResource = kOpenFolderIconResource -genericHardDiskIconResource = kGenericHardDiskIconResource -genericFileServerIconResource = kGenericFileServerIconResource -genericSuitcaseIconResource = kGenericSuitcaseIconResource -genericMoverObjectIconResource = kGenericMoverObjectIconResource -genericPreferencesIconResource = kGenericPreferencesIconResource -genericQueryDocumentIconResource = kGenericQueryDocumentIconResource -genericExtensionIconResource = kGenericExtensionIconResource -systemFolderIconResource = kSystemFolderIconResource -appleMenuFolderIconResource = kAppleMenuFolderIconResource -kStartupFolderIconResource = -3981 -kOwnedFolderIconResource = -3980 -kDropFolderIconResource = -3979 -kSharedFolderIconResource = -3978 -kMountedFolderIconResource = -3977 -kControlPanelFolderIconResource = -3976 -kPrintMonitorFolderIconResource = -3975 -kPreferencesFolderIconResource = -3974 -kExtensionsFolderIconResource = -3973 -kFontsFolderIconResource = -3968 -kFullTrashIconResource = -3984 -startupFolderIconResource = kStartupFolderIconResource -ownedFolderIconResource = kOwnedFolderIconResource -dropFolderIconResource = kDropFolderIconResource -sharedFolderIconResource = kSharedFolderIconResource -mountedFolderIconResource = kMountedFolderIconResource -controlPanelFolderIconResource = kControlPanelFolderIconResource -printMonitorFolderIconResource = kPrintMonitorFolderIconResource -preferencesFolderIconResource = kPreferencesFolderIconResource -extensionsFolderIconResource = kExtensionsFolderIconResource -fontsFolderIconResource = kFontsFolderIconResource -fullTrashIconResource = kFullTrashIconResource -kThumbnail32BitData = FOUR_CHAR_CODE('it32') -kThumbnail8BitMask = FOUR_CHAR_CODE('t8mk') -kHuge1BitMask = FOUR_CHAR_CODE('ich#') -kHuge4BitData = FOUR_CHAR_CODE('ich4') -kHuge8BitData = FOUR_CHAR_CODE('ich8') -kHuge32BitData = FOUR_CHAR_CODE('ih32') -kHuge8BitMask = FOUR_CHAR_CODE('h8mk') -kLarge1BitMask = FOUR_CHAR_CODE('ICN#') -kLarge4BitData = FOUR_CHAR_CODE('icl4') -kLarge8BitData = FOUR_CHAR_CODE('icl8') -kLarge32BitData = FOUR_CHAR_CODE('il32') -kLarge8BitMask = FOUR_CHAR_CODE('l8mk') -kSmall1BitMask = FOUR_CHAR_CODE('ics#') -kSmall4BitData = FOUR_CHAR_CODE('ics4') -kSmall8BitData = FOUR_CHAR_CODE('ics8') -kSmall32BitData = FOUR_CHAR_CODE('is32') -kSmall8BitMask = FOUR_CHAR_CODE('s8mk') -kMini1BitMask = FOUR_CHAR_CODE('icm#') -kMini4BitData = FOUR_CHAR_CODE('icm4') -kMini8BitData = FOUR_CHAR_CODE('icm8') -kTileIconVariant = FOUR_CHAR_CODE('tile') -kRolloverIconVariant = FOUR_CHAR_CODE('over') -kDropIconVariant = FOUR_CHAR_CODE('drop') -kOpenIconVariant = FOUR_CHAR_CODE('open') -kOpenDropIconVariant = FOUR_CHAR_CODE('odrp') -large1BitMask = kLarge1BitMask -large4BitData = kLarge4BitData -large8BitData = kLarge8BitData -small1BitMask = kSmall1BitMask -small4BitData = kSmall4BitData -small8BitData = kSmall8BitData -mini1BitMask = kMini1BitMask -mini4BitData = kMini4BitData -mini8BitData = kMini8BitData -kAlignNone = 0x00 -kAlignVerticalCenter = 0x01 -kAlignTop = 0x02 -kAlignBottom = 0x03 -kAlignHorizontalCenter = 0x04 -kAlignAbsoluteCenter = kAlignVerticalCenter | kAlignHorizontalCenter -kAlignCenterTop = kAlignTop | kAlignHorizontalCenter -kAlignCenterBottom = kAlignBottom | kAlignHorizontalCenter -kAlignLeft = 0x08 -kAlignCenterLeft = kAlignVerticalCenter | kAlignLeft -kAlignTopLeft = kAlignTop | kAlignLeft -kAlignBottomLeft = kAlignBottom | kAlignLeft -kAlignRight = 0x0C -kAlignCenterRight = kAlignVerticalCenter | kAlignRight -kAlignTopRight = kAlignTop | kAlignRight -kAlignBottomRight = kAlignBottom | kAlignRight -atNone = kAlignNone -atVerticalCenter = kAlignVerticalCenter -atTop = kAlignTop -atBottom = kAlignBottom -atHorizontalCenter = kAlignHorizontalCenter -atAbsoluteCenter = kAlignAbsoluteCenter -atCenterTop = kAlignCenterTop -atCenterBottom = kAlignCenterBottom -atLeft = kAlignLeft -atCenterLeft = kAlignCenterLeft -atTopLeft = kAlignTopLeft -atBottomLeft = kAlignBottomLeft -atRight = kAlignRight -atCenterRight = kAlignCenterRight -atTopRight = kAlignTopRight -atBottomRight = kAlignBottomRight -kTransformNone = 0x00 -kTransformDisabled = 0x01 -kTransformOffline = 0x02 -kTransformOpen = 0x03 -kTransformLabel1 = 0x0100 -kTransformLabel2 = 0x0200 -kTransformLabel3 = 0x0300 -kTransformLabel4 = 0x0400 -kTransformLabel5 = 0x0500 -kTransformLabel6 = 0x0600 -kTransformLabel7 = 0x0700 -kTransformSelected = 0x4000 -kTransformSelectedDisabled = kTransformSelected | kTransformDisabled -kTransformSelectedOffline = kTransformSelected | kTransformOffline -kTransformSelectedOpen = kTransformSelected | kTransformOpen -ttNone = kTransformNone -ttDisabled = kTransformDisabled -ttOffline = kTransformOffline -ttOpen = kTransformOpen -ttLabel1 = kTransformLabel1 -ttLabel2 = kTransformLabel2 -ttLabel3 = kTransformLabel3 -ttLabel4 = kTransformLabel4 -ttLabel5 = kTransformLabel5 -ttLabel6 = kTransformLabel6 -ttLabel7 = kTransformLabel7 -ttSelected = kTransformSelected -ttSelectedDisabled = kTransformSelectedDisabled -ttSelectedOffline = kTransformSelectedOffline -ttSelectedOpen = kTransformSelectedOpen -kSelectorLarge1Bit = 0x00000001 -kSelectorLarge4Bit = 0x00000002 -kSelectorLarge8Bit = 0x00000004 -kSelectorLarge32Bit = 0x00000008 -kSelectorLarge8BitMask = 0x00000010 -kSelectorSmall1Bit = 0x00000100 -kSelectorSmall4Bit = 0x00000200 -kSelectorSmall8Bit = 0x00000400 -kSelectorSmall32Bit = 0x00000800 -kSelectorSmall8BitMask = 0x00001000 -kSelectorMini1Bit = 0x00010000 -kSelectorMini4Bit = 0x00020000 -kSelectorMini8Bit = 0x00040000 -kSelectorHuge1Bit = 0x01000000 -kSelectorHuge4Bit = 0x02000000 -kSelectorHuge8Bit = 0x04000000 -kSelectorHuge32Bit = 0x08000000 -kSelectorHuge8BitMask = 0x10000000 -kSelectorAllLargeData = 0x000000FF -kSelectorAllSmallData = 0x0000FF00 -kSelectorAllMiniData = 0x00FF0000 -# kSelectorAllHugeData = (long)0xFF000000 -kSelectorAll1BitData = kSelectorLarge1Bit | kSelectorSmall1Bit | kSelectorMini1Bit | kSelectorHuge1Bit -kSelectorAll4BitData = kSelectorLarge4Bit | kSelectorSmall4Bit | kSelectorMini4Bit | kSelectorHuge4Bit -kSelectorAll8BitData = kSelectorLarge8Bit | kSelectorSmall8Bit | kSelectorMini8Bit | kSelectorHuge8Bit -kSelectorAll32BitData = kSelectorLarge32Bit | kSelectorSmall32Bit | kSelectorHuge32Bit -# kSelectorAllAvailableData = (long)0xFFFFFFFF -svLarge1Bit = kSelectorLarge1Bit -svLarge4Bit = kSelectorLarge4Bit -svLarge8Bit = kSelectorLarge8Bit -svSmall1Bit = kSelectorSmall1Bit -svSmall4Bit = kSelectorSmall4Bit -svSmall8Bit = kSelectorSmall8Bit -svMini1Bit = kSelectorMini1Bit -svMini4Bit = kSelectorMini4Bit -svMini8Bit = kSelectorMini8Bit -svAllLargeData = kSelectorAllLargeData -svAllSmallData = kSelectorAllSmallData -svAllMiniData = kSelectorAllMiniData -svAll1BitData = kSelectorAll1BitData -svAll4BitData = kSelectorAll4BitData -svAll8BitData = kSelectorAll8BitData -# svAllAvailableData = kSelectorAllAvailableData -kSystemIconsCreator = FOUR_CHAR_CODE('macs') -# err = GetIconRef(kOnSystemDisk -kClipboardIcon = FOUR_CHAR_CODE('CLIP') -kClippingUnknownTypeIcon = FOUR_CHAR_CODE('clpu') -kClippingPictureTypeIcon = FOUR_CHAR_CODE('clpp') -kClippingTextTypeIcon = FOUR_CHAR_CODE('clpt') -kClippingSoundTypeIcon = FOUR_CHAR_CODE('clps') -kDesktopIcon = FOUR_CHAR_CODE('desk') -kFinderIcon = FOUR_CHAR_CODE('FNDR') -kFontSuitcaseIcon = FOUR_CHAR_CODE('FFIL') -kFullTrashIcon = FOUR_CHAR_CODE('ftrh') -kGenericApplicationIcon = FOUR_CHAR_CODE('APPL') -kGenericCDROMIcon = FOUR_CHAR_CODE('cddr') -kGenericControlPanelIcon = FOUR_CHAR_CODE('APPC') -kGenericControlStripModuleIcon = FOUR_CHAR_CODE('sdev') -kGenericComponentIcon = FOUR_CHAR_CODE('thng') -kGenericDeskAccessoryIcon = FOUR_CHAR_CODE('APPD') -kGenericDocumentIcon = FOUR_CHAR_CODE('docu') -kGenericEditionFileIcon = FOUR_CHAR_CODE('edtf') -kGenericExtensionIcon = FOUR_CHAR_CODE('INIT') -kGenericFileServerIcon = FOUR_CHAR_CODE('srvr') -kGenericFontIcon = FOUR_CHAR_CODE('ffil') -kGenericFontScalerIcon = FOUR_CHAR_CODE('sclr') -kGenericFloppyIcon = FOUR_CHAR_CODE('flpy') -kGenericHardDiskIcon = FOUR_CHAR_CODE('hdsk') -kGenericIDiskIcon = FOUR_CHAR_CODE('idsk') -kGenericRemovableMediaIcon = FOUR_CHAR_CODE('rmov') -kGenericMoverObjectIcon = FOUR_CHAR_CODE('movr') -kGenericPCCardIcon = FOUR_CHAR_CODE('pcmc') -kGenericPreferencesIcon = FOUR_CHAR_CODE('pref') -kGenericQueryDocumentIcon = FOUR_CHAR_CODE('qery') -kGenericRAMDiskIcon = FOUR_CHAR_CODE('ramd') -kGenericSharedLibaryIcon = FOUR_CHAR_CODE('shlb') -kGenericStationeryIcon = FOUR_CHAR_CODE('sdoc') -kGenericSuitcaseIcon = FOUR_CHAR_CODE('suit') -kGenericURLIcon = FOUR_CHAR_CODE('gurl') -kGenericWORMIcon = FOUR_CHAR_CODE('worm') -kInternationalResourcesIcon = FOUR_CHAR_CODE('ifil') -kKeyboardLayoutIcon = FOUR_CHAR_CODE('kfil') -kSoundFileIcon = FOUR_CHAR_CODE('sfil') -kSystemSuitcaseIcon = FOUR_CHAR_CODE('zsys') -kTrashIcon = FOUR_CHAR_CODE('trsh') -kTrueTypeFontIcon = FOUR_CHAR_CODE('tfil') -kTrueTypeFlatFontIcon = FOUR_CHAR_CODE('sfnt') -kTrueTypeMultiFlatFontIcon = FOUR_CHAR_CODE('ttcf') -kUserIDiskIcon = FOUR_CHAR_CODE('udsk') -kInternationResourcesIcon = kInternationalResourcesIcon -kInternetLocationHTTPIcon = FOUR_CHAR_CODE('ilht') -kInternetLocationFTPIcon = FOUR_CHAR_CODE('ilft') -kInternetLocationAppleShareIcon = FOUR_CHAR_CODE('ilaf') -kInternetLocationAppleTalkZoneIcon = FOUR_CHAR_CODE('ilat') -kInternetLocationFileIcon = FOUR_CHAR_CODE('ilfi') -kInternetLocationMailIcon = FOUR_CHAR_CODE('ilma') -kInternetLocationNewsIcon = FOUR_CHAR_CODE('ilnw') -kInternetLocationNSLNeighborhoodIcon = FOUR_CHAR_CODE('ilns') -kInternetLocationGenericIcon = FOUR_CHAR_CODE('ilge') -kGenericFolderIcon = FOUR_CHAR_CODE('fldr') -kDropFolderIcon = FOUR_CHAR_CODE('dbox') -kMountedFolderIcon = FOUR_CHAR_CODE('mntd') -kOpenFolderIcon = FOUR_CHAR_CODE('ofld') -kOwnedFolderIcon = FOUR_CHAR_CODE('ownd') -kPrivateFolderIcon = FOUR_CHAR_CODE('prvf') -kSharedFolderIcon = FOUR_CHAR_CODE('shfl') -kSharingPrivsNotApplicableIcon = FOUR_CHAR_CODE('shna') -kSharingPrivsReadOnlyIcon = FOUR_CHAR_CODE('shro') -kSharingPrivsReadWriteIcon = FOUR_CHAR_CODE('shrw') -kSharingPrivsUnknownIcon = FOUR_CHAR_CODE('shuk') -kSharingPrivsWritableIcon = FOUR_CHAR_CODE('writ') -kUserFolderIcon = FOUR_CHAR_CODE('ufld') -kWorkgroupFolderIcon = FOUR_CHAR_CODE('wfld') -kGuestUserIcon = FOUR_CHAR_CODE('gusr') -kUserIcon = FOUR_CHAR_CODE('user') -kOwnerIcon = FOUR_CHAR_CODE('susr') -kGroupIcon = FOUR_CHAR_CODE('grup') -kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') -kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aex\xc4') -kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') -kApplicationsFolderIcon = FOUR_CHAR_CODE('apps') -kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') -kAssistantsFolderIcon = FOUR_CHAR_CODE('ast\xc4') -kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') -kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') -kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') -kControlPanelFolderIcon = FOUR_CHAR_CODE('ctrl') -kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdv\xc4') -kDocumentsFolderIcon = FOUR_CHAR_CODE('docs') -kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD') -kExtensionsFolderIcon = FOUR_CHAR_CODE('extn') -kFavoritesFolderIcon = FOUR_CHAR_CODE('favs') -kFontsFolderIcon = FOUR_CHAR_CODE('font') -kHelpFolderIcon = FOUR_CHAR_CODE('\xc4hlp') -kInternetFolderIcon = FOUR_CHAR_CODE('int\xc4') -kInternetPlugInFolderIcon = FOUR_CHAR_CODE('\xc4net') -kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') -kLocalesFolderIcon = FOUR_CHAR_CODE('\xc4loc') -kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('mor\xc4') -kPublicFolderIcon = FOUR_CHAR_CODE('pubf') -kPreferencesFolderIcon = FOUR_CHAR_CODE('prf\xc4') -kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') -kPrinterDriverFolderIcon = FOUR_CHAR_CODE('\xc4prd') -kPrintMonitorFolderIcon = FOUR_CHAR_CODE('prnt') -kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp') -kRecentDocumentsFolderIcon = FOUR_CHAR_CODE('rdoc') -kRecentServersFolderIcon = FOUR_CHAR_CODE('rsrv') -kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('\xc4scr') -kSharedLibrariesFolderIcon = FOUR_CHAR_CODE('\xc4lib') -kScriptsFolderIcon = FOUR_CHAR_CODE('scr\xc4') -kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD') -kShutdownItemsFolderIcon = FOUR_CHAR_CODE('shdf') -kSpeakableItemsFolder = FOUR_CHAR_CODE('spki') -kStartupItemsDisabledFolderIcon = FOUR_CHAR_CODE('strD') -kStartupItemsFolderIcon = FOUR_CHAR_CODE('strt') -kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD') -kSystemFolderIcon = FOUR_CHAR_CODE('macs') -kTextEncodingsFolderIcon = FOUR_CHAR_CODE('\xc4tex') -kUsersFolderIcon = FOUR_CHAR_CODE('usr\xc4') -kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti\xc4') -kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') -kSystemFolderXIcon = FOUR_CHAR_CODE('macx') -kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') -kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') -kMountedBadgeIcon = FOUR_CHAR_CODE('mbdg') -kSharedBadgeIcon = FOUR_CHAR_CODE('sbdg') -kAliasBadgeIcon = FOUR_CHAR_CODE('abdg') -kAlertCautionBadgeIcon = FOUR_CHAR_CODE('cbdg') -kAlertNoteIcon = FOUR_CHAR_CODE('note') -kAlertCautionIcon = FOUR_CHAR_CODE('caut') -kAlertStopIcon = FOUR_CHAR_CODE('stop') -kAppleTalkIcon = FOUR_CHAR_CODE('atlk') -kAppleTalkZoneIcon = FOUR_CHAR_CODE('atzn') -kAFPServerIcon = FOUR_CHAR_CODE('afps') -kFTPServerIcon = FOUR_CHAR_CODE('ftps') -kHTTPServerIcon = FOUR_CHAR_CODE('htps') -kGenericNetworkIcon = FOUR_CHAR_CODE('gnet') -kIPFileServerIcon = FOUR_CHAR_CODE('isrv') -kToolbarCustomizeIcon = FOUR_CHAR_CODE('tcus') -kToolbarDeleteIcon = FOUR_CHAR_CODE('tdel') -kToolbarFavoritesIcon = FOUR_CHAR_CODE('tfav') -kToolbarHomeIcon = FOUR_CHAR_CODE('thom') -kAppleLogoIcon = FOUR_CHAR_CODE('capl') -kAppleMenuIcon = FOUR_CHAR_CODE('sapl') -kBackwardArrowIcon = FOUR_CHAR_CODE('baro') -kFavoriteItemsIcon = FOUR_CHAR_CODE('favr') -kForwardArrowIcon = FOUR_CHAR_CODE('faro') -kGridIcon = FOUR_CHAR_CODE('grid') -kHelpIcon = FOUR_CHAR_CODE('help') -kKeepArrangedIcon = FOUR_CHAR_CODE('arng') -kLockedIcon = FOUR_CHAR_CODE('lock') -kNoFilesIcon = FOUR_CHAR_CODE('nfil') -kNoFolderIcon = FOUR_CHAR_CODE('nfld') -kNoWriteIcon = FOUR_CHAR_CODE('nwrt') -kProtectedApplicationFolderIcon = FOUR_CHAR_CODE('papp') -kProtectedSystemFolderIcon = FOUR_CHAR_CODE('psys') -kRecentItemsIcon = FOUR_CHAR_CODE('rcnt') -kShortcutIcon = FOUR_CHAR_CODE('shrt') -kSortAscendingIcon = FOUR_CHAR_CODE('asnd') -kSortDescendingIcon = FOUR_CHAR_CODE('dsnd') -kUnlockedIcon = FOUR_CHAR_CODE('ulck') -kConnectToIcon = FOUR_CHAR_CODE('cnct') -kGenericWindowIcon = FOUR_CHAR_CODE('gwin') -kQuestionMarkIcon = FOUR_CHAR_CODE('ques') -kDeleteAliasIcon = FOUR_CHAR_CODE('dali') -kEjectMediaIcon = FOUR_CHAR_CODE('ejec') -kBurningIcon = FOUR_CHAR_CODE('burn') -kRightContainerArrowIcon = FOUR_CHAR_CODE('rcar') -kIconServicesNormalUsageFlag = 0 -kIconServicesCatalogInfoMask = (kFSCatInfoNodeID | kFSCatInfoParentDirID | kFSCatInfoVolume | kFSCatInfoNodeFlags | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo | kFSCatInfoUserAccess) -kPlotIconRefNormalFlags = 0L -kPlotIconRefNoImage = (1 << 1) -kPlotIconRefNoMask = (1 << 2) -kIconFamilyType = FOUR_CHAR_CODE('icns') diff --git a/sys/lib/python/plat-mac/Carbon/Launch.py b/sys/lib/python/plat-mac/Carbon/Launch.py deleted file mode 100644 index e553f8f4e..000000000 --- a/sys/lib/python/plat-mac/Carbon/Launch.py +++ /dev/null @@ -1 +0,0 @@ -from _Launch import * diff --git a/sys/lib/python/plat-mac/Carbon/LaunchServices.py b/sys/lib/python/plat-mac/Carbon/LaunchServices.py deleted file mode 100644 index daff44693..000000000 --- a/sys/lib/python/plat-mac/Carbon/LaunchServices.py +++ /dev/null @@ -1,74 +0,0 @@ -# Generated from 'LaunchServices.h' - -def FOUR_CHAR_CODE(x): return x -from Carbon.Files import * -kLSRequestAllInfo = -1 -kLSRolesAll = -1 -kLSUnknownType = FOUR_CHAR_CODE('\0\0\0\0') -kLSUnknownCreator = FOUR_CHAR_CODE('\0\0\0\0') -kLSInvalidExtensionIndex = -1 -kLSUnknownErr = -10810 -kLSNotAnApplicationErr = -10811 -kLSNotInitializedErr = -10812 -kLSDataUnavailableErr = -10813 -kLSApplicationNotFoundErr = -10814 -kLSUnknownTypeErr = -10815 -kLSDataTooOldErr = -10816 -kLSDataErr = -10817 -kLSLaunchInProgressErr = -10818 -kLSNotRegisteredErr = -10819 -kLSAppDoesNotClaimTypeErr = -10820 -kLSAppDoesNotSupportSchemeWarning = -10821 -kLSServerCommunicationErr = -10822 -kLSCannotSetInfoErr = -10823 -kLSInitializeDefaults = 0x00000001 -kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo) -# kLSInvalidExtensionIndex = (unsigned long)0xFFFFFFFF -kLSRequestExtension = 0x00000001 -kLSRequestTypeCreator = 0x00000002 -kLSRequestBasicFlagsOnly = 0x00000004 -kLSRequestAppTypeFlags = 0x00000008 -kLSRequestAllFlags = 0x00000010 -kLSRequestIconAndKind = 0x00000020 -kLSRequestExtensionFlagsOnly = 0x00000040 -# kLSRequestAllInfo = (unsigned long)0xFFFFFFFF -kLSItemInfoIsPlainFile = 0x00000001 -kLSItemInfoIsPackage = 0x00000002 -kLSItemInfoIsApplication = 0x00000004 -kLSItemInfoIsContainer = 0x00000008 -kLSItemInfoIsAliasFile = 0x00000010 -kLSItemInfoIsSymlink = 0x00000020 -kLSItemInfoIsInvisible = 0x00000040 -kLSItemInfoIsNativeApp = 0x00000080 -kLSItemInfoIsClassicApp = 0x00000100 -kLSItemInfoAppPrefersNative = 0x00000200 -kLSItemInfoAppPrefersClassic = 0x00000400 -kLSItemInfoAppIsScriptable = 0x00000800 -kLSItemInfoIsVolume = 0x00001000 -kLSItemInfoExtensionIsHidden = 0x00100000 -kLSRolesNone = 0x00000001 -kLSRolesViewer = 0x00000002 -kLSRolesEditor = 0x00000004 -# kLSRolesAll = (unsigned long)0xFFFFFFFF -kLSUnknownKindID = 0 -# kLSUnknownType = 0 -# kLSUnknownCreator = 0 -kLSAcceptDefault = 0x00000001 -kLSAcceptAllowLoginUI = 0x00000002 -kLSLaunchDefaults = 0x00000001 -kLSLaunchAndPrint = 0x00000002 -kLSLaunchReserved2 = 0x00000004 -kLSLaunchReserved3 = 0x00000008 -kLSLaunchReserved4 = 0x00000010 -kLSLaunchReserved5 = 0x00000020 -kLSLaunchReserved6 = 0x00000040 -kLSLaunchInhibitBGOnly = 0x00000080 -kLSLaunchDontAddToRecents = 0x00000100 -kLSLaunchDontSwitch = 0x00000200 -kLSLaunchNoParams = 0x00000800 -kLSLaunchAsync = 0x00010000 -kLSLaunchStartClassic = 0x00020000 -kLSLaunchInClassic = 0x00040000 -kLSLaunchNewInstance = 0x00080000 -kLSLaunchAndHide = 0x00100000 -kLSLaunchAndHideOthers = 0x00200000 diff --git a/sys/lib/python/plat-mac/Carbon/List.py b/sys/lib/python/plat-mac/Carbon/List.py deleted file mode 100644 index b0d6e2273..000000000 --- a/sys/lib/python/plat-mac/Carbon/List.py +++ /dev/null @@ -1 +0,0 @@ -from _List import * diff --git a/sys/lib/python/plat-mac/Carbon/Lists.py b/sys/lib/python/plat-mac/Carbon/Lists.py deleted file mode 100644 index 723294c61..000000000 --- a/sys/lib/python/plat-mac/Carbon/Lists.py +++ /dev/null @@ -1,35 +0,0 @@ -# Generated from 'Lists.h' - -def FOUR_CHAR_CODE(x): return x -listNotifyNothing = FOUR_CHAR_CODE('nada') -listNotifyClick = FOUR_CHAR_CODE('clik') -listNotifyDoubleClick = FOUR_CHAR_CODE('dblc') -listNotifyPreClick = FOUR_CHAR_CODE('pclk') -lDrawingModeOffBit = 3 -lDoVAutoscrollBit = 1 -lDoHAutoscrollBit = 0 -lDrawingModeOff = 8 -lDoVAutoscroll = 2 -lDoHAutoscroll = 1 -lOnlyOneBit = 7 -lExtendDragBit = 6 -lNoDisjointBit = 5 -lNoExtendBit = 4 -lNoRectBit = 3 -lUseSenseBit = 2 -lNoNilHiliteBit = 1 -lOnlyOne = -128 -lExtendDrag = 64 -lNoDisjoint = 32 -lNoExtend = 16 -lNoRect = 8 -lUseSense = 4 -lNoNilHilite = 2 -lInitMsg = 0 -lDrawMsg = 1 -lHiliteMsg = 2 -lCloseMsg = 3 -kListDefProcPtr = 0 -kListDefUserProcType = kListDefProcPtr -kListDefStandardTextType = 1 -kListDefStandardIconType = 2 diff --git a/sys/lib/python/plat-mac/Carbon/MacHelp.py b/sys/lib/python/plat-mac/Carbon/MacHelp.py deleted file mode 100644 index 06b9912bf..000000000 --- a/sys/lib/python/plat-mac/Carbon/MacHelp.py +++ /dev/null @@ -1,58 +0,0 @@ -# Generated from 'MacHelp.h' - -def FOUR_CHAR_CODE(x): return x -kMacHelpVersion = 0x0003 -kHMSupplyContent = 0 -kHMDisposeContent = 1 -kHMNoContent = FOUR_CHAR_CODE('none') -kHMCFStringContent = FOUR_CHAR_CODE('cfst') -kHMPascalStrContent = FOUR_CHAR_CODE('pstr') -kHMStringResContent = FOUR_CHAR_CODE('str#') -kHMTEHandleContent = FOUR_CHAR_CODE('txth') -kHMTextResContent = FOUR_CHAR_CODE('text') -kHMStrResContent = FOUR_CHAR_CODE('str ') -kHMDefaultSide = 0 -kHMOutsideTopScriptAligned = 1 -kHMOutsideLeftCenterAligned = 2 -kHMOutsideBottomScriptAligned = 3 -kHMOutsideRightCenterAligned = 4 -kHMOutsideTopLeftAligned = 5 -kHMOutsideTopRightAligned = 6 -kHMOutsideLeftTopAligned = 7 -kHMOutsideLeftBottomAligned = 8 -kHMOutsideBottomLeftAligned = 9 -kHMOutsideBottomRightAligned = 10 -kHMOutsideRightTopAligned = 11 -kHMOutsideRightBottomAligned = 12 -kHMOutsideTopCenterAligned = 13 -kHMOutsideBottomCenterAligned = 14 -kHMInsideRightCenterAligned = 15 -kHMInsideLeftCenterAligned = 16 -kHMInsideBottomCenterAligned = 17 -kHMInsideTopCenterAligned = 18 -kHMInsideTopLeftCorner = 19 -kHMInsideTopRightCorner = 20 -kHMInsideBottomLeftCorner = 21 -kHMInsideBottomRightCorner = 22 -kHMAbsoluteCenterAligned = 23 -kHMTopSide = kHMOutsideTopScriptAligned -kHMLeftSide = kHMOutsideLeftCenterAligned -kHMBottomSide = kHMOutsideBottomScriptAligned -kHMRightSide = kHMOutsideRightCenterAligned -kHMTopLeftCorner = kHMOutsideTopLeftAligned -kHMTopRightCorner = kHMOutsideTopRightAligned -kHMLeftTopCorner = kHMOutsideLeftTopAligned -kHMLeftBottomCorner = kHMOutsideLeftBottomAligned -kHMBottomLeftCorner = kHMOutsideBottomLeftAligned -kHMBottomRightCorner = kHMOutsideBottomRightAligned -kHMRightTopCorner = kHMOutsideRightTopAligned -kHMRightBottomCorner = kHMOutsideRightBottomAligned -kHMContentProvided = 0 -kHMContentNotProvided = 1 -kHMContentNotProvidedDontPropagate = 2 -kHMMinimumContentIndex = 0 -kHMMaximumContentIndex = 1 -errHMIllegalContentForMinimumState = -10980 -errHMIllegalContentForMaximumState = -10981 -kHMIllegalContentForMinimumState = errHMIllegalContentForMinimumState -kHelpTagEventHandlerTag = FOUR_CHAR_CODE('hevt') diff --git a/sys/lib/python/plat-mac/Carbon/MacTextEditor.py b/sys/lib/python/plat-mac/Carbon/MacTextEditor.py deleted file mode 100644 index 4609d8db8..000000000 --- a/sys/lib/python/plat-mac/Carbon/MacTextEditor.py +++ /dev/null @@ -1,226 +0,0 @@ -# Generated from 'MacTextEditor.h' - - -def FOUR_CHAR_CODE(x): return x -false = 0 -true = 1 -kTXNClearThisControl = 0xFFFFFFFF -kTXNClearTheseFontFeatures = 0x80000000 -kTXNDontCareTypeSize = 0xFFFFFFFF -kTXNDecrementTypeSize = 0x80000000 -kTXNUseCurrentSelection = 0xFFFFFFFF -kTXNStartOffset = 0 -kTXNEndOffset = 0x7FFFFFFF -MovieFileType = FOUR_CHAR_CODE('moov') -kTXNUseEncodingWordRulesMask = 0x80000000 -kTXNFontSizeAttributeSize = 4 -normal = 0 -kTXNWillDefaultToATSUIBit = 0 -kTXNWillDefaultToCarbonEventBit = 1 -kTXNWillDefaultToATSUIMask = 1L << kTXNWillDefaultToATSUIBit -kTXNWillDefaultToCarbonEventMask = 1L << kTXNWillDefaultToCarbonEventBit -kTXNWantMoviesBit = 0 -kTXNWantSoundBit = 1 -kTXNWantGraphicsBit = 2 -kTXNAlwaysUseQuickDrawTextBit = 3 -kTXNUseTemporaryMemoryBit = 4 -kTXNWantMoviesMask = 1L << kTXNWantMoviesBit -kTXNWantSoundMask = 1L << kTXNWantSoundBit -kTXNWantGraphicsMask = 1L << kTXNWantGraphicsBit -kTXNAlwaysUseQuickDrawTextMask = 1L << kTXNAlwaysUseQuickDrawTextBit -kTXNUseTemporaryMemoryMask = 1L << kTXNUseTemporaryMemoryBit -kTXNDrawGrowIconBit = 0 -kTXNShowWindowBit = 1 -kTXNWantHScrollBarBit = 2 -kTXNWantVScrollBarBit = 3 -kTXNNoTSMEverBit = 4 -kTXNReadOnlyBit = 5 -kTXNNoKeyboardSyncBit = 6 -kTXNNoSelectionBit = 7 -kTXNSaveStylesAsSTYLResourceBit = 8 -kOutputTextInUnicodeEncodingBit = 9 -kTXNDoNotInstallDragProcsBit = 10 -kTXNAlwaysWrapAtViewEdgeBit = 11 -kTXNDontDrawCaretWhenInactiveBit = 12 -kTXNDontDrawSelectionWhenInactiveBit = 13 -kTXNSingleLineOnlyBit = 14 -kTXNDisableDragAndDropBit = 15 -kTXNUseQDforImagingBit = 16 -kTXNDrawGrowIconMask = 1L << kTXNDrawGrowIconBit -kTXNShowWindowMask = 1L << kTXNShowWindowBit -kTXNWantHScrollBarMask = 1L << kTXNWantHScrollBarBit -kTXNWantVScrollBarMask = 1L << kTXNWantVScrollBarBit -kTXNNoTSMEverMask = 1L << kTXNNoTSMEverBit -kTXNReadOnlyMask = 1L << kTXNReadOnlyBit -kTXNNoKeyboardSyncMask = 1L << kTXNNoKeyboardSyncBit -kTXNNoSelectionMask = 1L << kTXNNoSelectionBit -kTXNSaveStylesAsSTYLResourceMask = 1L << kTXNSaveStylesAsSTYLResourceBit -kOutputTextInUnicodeEncodingMask = 1L << kOutputTextInUnicodeEncodingBit -kTXNDoNotInstallDragProcsMask = 1L << kTXNDoNotInstallDragProcsBit -kTXNAlwaysWrapAtViewEdgeMask = 1L << kTXNAlwaysWrapAtViewEdgeBit -kTXNDontDrawCaretWhenInactiveMask = 1L << kTXNDontDrawCaretWhenInactiveBit -kTXNDontDrawSelectionWhenInactiveMask = 1L << kTXNDontDrawSelectionWhenInactiveBit -kTXNSingleLineOnlyMask = 1L << kTXNSingleLineOnlyBit -kTXNDisableDragAndDropMask = 1L << kTXNDisableDragAndDropBit -kTXNUseQDforImagingMask = 1L << kTXNUseQDforImagingBit -kTXNSetFlushnessBit = 0 -kTXNSetJustificationBit = 1 -kTXNUseFontFallBackBit = 2 -kTXNRotateTextBit = 3 -kTXNUseVerticalTextBit = 4 -kTXNDontUpdateBoxRectBit = 5 -kTXNDontDrawTextBit = 6 -kTXNUseCGContextRefBit = 7 -kTXNImageWithQDBit = 8 -kTXNDontWrapTextBit = 9 -kTXNSetFlushnessMask = 1L << kTXNSetFlushnessBit -kTXNSetJustificationMask = 1L << kTXNSetJustificationBit -kTXNUseFontFallBackMask = 1L << kTXNUseFontFallBackBit -kTXNRotateTextMask = 1L << kTXNRotateTextBit -kTXNUseVerticalTextMask = 1L << kTXNUseVerticalTextBit -kTXNDontUpdateBoxRectMask = 1L << kTXNDontUpdateBoxRectBit -kTXNDontDrawTextMask = 1L << kTXNDontDrawTextBit -kTXNUseCGContextRefMask = 1L << kTXNUseCGContextRefBit -kTXNImageWithQDMask = 1L << kTXNImageWithQDBit -kTXNDontWrapTextMask = 1L << kTXNDontWrapTextBit -kTXNFontContinuousBit = 0 -kTXNSizeContinuousBit = 1 -kTXNStyleContinuousBit = 2 -kTXNColorContinuousBit = 3 -kTXNFontContinuousMask = 1L << kTXNFontContinuousBit -kTXNSizeContinuousMask = 1L << kTXNSizeContinuousBit -kTXNStyleContinuousMask = 1L << kTXNStyleContinuousBit -kTXNColorContinuousMask = 1L << kTXNColorContinuousBit -kTXNIgnoreCaseBit = 0 -kTXNEntireWordBit = 1 -kTXNUseEncodingWordRulesBit = 31 -kTXNIgnoreCaseMask = 1L << kTXNIgnoreCaseBit -kTXNEntireWordMask = 1L << kTXNEntireWordBit -# kTXNUseEncodingWordRulesMask = (unsigned long)(1L << kTXNUseEncodingWordRulesBit) -kTXNTextensionFile = FOUR_CHAR_CODE('txtn') -kTXNTextFile = FOUR_CHAR_CODE('TEXT') -kTXNPictureFile = FOUR_CHAR_CODE('PICT') -kTXNMovieFile = FOUR_CHAR_CODE('MooV') -kTXNSoundFile = FOUR_CHAR_CODE('sfil') -kTXNAIFFFile = FOUR_CHAR_CODE('AIFF') -kTXNUnicodeTextFile = FOUR_CHAR_CODE('utxt') -kTXNTextEditStyleFrameType = 1 -kTXNPageFrameType = 2 -kTXNMultipleFrameType = 3 -kTXNTextData = FOUR_CHAR_CODE('TEXT') -kTXNPictureData = FOUR_CHAR_CODE('PICT') -kTXNMovieData = FOUR_CHAR_CODE('moov') -kTXNSoundData = FOUR_CHAR_CODE('snd ') -kTXNUnicodeTextData = FOUR_CHAR_CODE('utxt') -kTXNLineDirectionTag = FOUR_CHAR_CODE('lndr') -kTXNJustificationTag = FOUR_CHAR_CODE('just') -kTXNIOPrivilegesTag = FOUR_CHAR_CODE('iopv') -kTXNSelectionStateTag = FOUR_CHAR_CODE('slst') -kTXNInlineStateTag = FOUR_CHAR_CODE('inst') -kTXNWordWrapStateTag = FOUR_CHAR_CODE('wwrs') -kTXNKeyboardSyncStateTag = FOUR_CHAR_CODE('kbsy') -kTXNAutoIndentStateTag = FOUR_CHAR_CODE('auin') -kTXNTabSettingsTag = FOUR_CHAR_CODE('tabs') -kTXNRefConTag = FOUR_CHAR_CODE('rfcn') -kTXNMarginsTag = FOUR_CHAR_CODE('marg') -kTXNFlattenMoviesTag = FOUR_CHAR_CODE('flat') -kTXNDoFontSubstitution = FOUR_CHAR_CODE('fSub') -kTXNNoUserIOTag = FOUR_CHAR_CODE('nuio') -kTXNUseCarbonEvents = FOUR_CHAR_CODE('cbcb') -kTXNDrawCaretWhenInactiveTag = FOUR_CHAR_CODE('dcrt') -kTXNDrawSelectionWhenInactiveTag = FOUR_CHAR_CODE('dsln') -kTXNDisableDragAndDropTag = FOUR_CHAR_CODE('drag') -kTXNTypingAction = 0 -kTXNCutAction = 1 -kTXNPasteAction = 2 -kTXNClearAction = 3 -kTXNChangeFontAction = 4 -kTXNChangeFontColorAction = 5 -kTXNChangeFontSizeAction = 6 -kTXNChangeStyleAction = 7 -kTXNAlignLeftAction = 8 -kTXNAlignCenterAction = 9 -kTXNAlignRightAction = 10 -kTXNDropAction = 11 -kTXNMoveAction = 12 -kTXNFontFeatureAction = 13 -kTXNFontVariationAction = 14 -kTXNUndoLastAction = 1024 -# kTXNClearThisControl = (long)0xFFFFFFFF -# kTXNClearTheseFontFeatures = (long)0x80000000 -kTXNReadWrite = false -kTXNReadOnly = true -kTXNSelectionOn = true -kTXNSelectionOff = false -kTXNUseInline = false -kTXNUseBottomline = true -kTXNAutoWrap = false -kTXNNoAutoWrap = true -kTXNSyncKeyboard = false -kTXNNoSyncKeyboard = true -kTXNAutoIndentOff = false -kTXNAutoIndentOn = true -kTXNDontDrawCaretWhenInactive = false -kTXNDrawCaretWhenInactive = true -kTXNDontDrawSelectionWhenInactive = false -kTXNDrawSelectionWhenInactive = true -kTXNEnableDragAndDrop = false -kTXNDisableDragAndDrop = true -kTXNRightTab = -1 -kTXNLeftTab = 0 -kTXNCenterTab = 1 -kTXNLeftToRight = 0 -kTXNRightToLeft = 1 -kTXNFlushDefault = 0 -kTXNFlushLeft = 1 -kTXNFlushRight = 2 -kTXNCenter = 4 -kTXNFullJust = 8 -kTXNForceFullJust = 16 -kScrollBarsAlwaysActive = true -kScrollBarsSyncWithFocus = false -# kTXNDontCareTypeSize = (long)0xFFFFFFFF -kTXNDontCareTypeStyle = 0xFF -kTXNIncrementTypeSize = 0x00000001 -# kTXNDecrementTypeSize = (long)0x80000000 -kTXNUseScriptDefaultValue = -1 -kTXNNoFontVariations = 0x7FFF -# kTXNUseCurrentSelection = (unsigned long)0xFFFFFFFF -# kTXNStartOffset = 0 -# kTXNEndOffset = 0x7FFFFFFF -kTXNSingleStylePerTextDocumentResType = FOUR_CHAR_CODE('MPSR') -kTXNMultipleStylesPerTextDocumentResType = FOUR_CHAR_CODE('styl') -kTXNShowStart = false -kTXNShowEnd = true -kTXNDefaultFontName = 0 -kTXNDefaultFontSize = 0x000C0000 -kTXNDefaultFontStyle = normal -kTXNQDFontNameAttribute = FOUR_CHAR_CODE('fntn') -kTXNQDFontFamilyIDAttribute = FOUR_CHAR_CODE('font') -kTXNQDFontSizeAttribute = FOUR_CHAR_CODE('size') -kTXNQDFontStyleAttribute = FOUR_CHAR_CODE('face') -kTXNQDFontColorAttribute = FOUR_CHAR_CODE('klor') -kTXNTextEncodingAttribute = FOUR_CHAR_CODE('encd') -kTXNATSUIFontFeaturesAttribute = FOUR_CHAR_CODE('atfe') -kTXNATSUIFontVariationsAttribute = FOUR_CHAR_CODE('atva') -# kTXNQDFontNameAttributeSize = sizeof(Str255) -# kTXNQDFontFamilyIDAttributeSize = sizeof(SInt16) -# kTXNQDFontSizeAttributeSize = sizeof(SInt16) -# kTXNQDFontStyleAttributeSize = sizeof(Style) -# kTXNQDFontColorAttributeSize = sizeof(RGBColor) -# kTXNTextEncodingAttributeSize = sizeof(TextEncoding) -# kTXNFontSizeAttributeSize = sizeof(Fixed) -kTXNSystemDefaultEncoding = 0 -kTXNMacOSEncoding = 1 -kTXNUnicodeEncoding = 2 -kTXNBackgroundTypeRGB = 1 -kTXNTextInputCountBit = 0 -kTXNRunCountBit = 1 -kTXNTextInputCountMask = 1L << kTXNTextInputCountBit -kTXNRunCountMask = 1L << kTXNRunCountBit -kTXNAllCountMask = kTXNTextInputCountMask | kTXNRunCountMask -kTXNNoAppleEventHandlersBit = 0 -kTXNRestartAppleEventHandlersBit = 1 -kTXNNoAppleEventHandlersMask = 1 << kTXNNoAppleEventHandlersBit -kTXNRestartAppleEventHandlersMask = 1 << kTXNRestartAppleEventHandlersBit -# status = TXNInitTextension( &defaults diff --git a/sys/lib/python/plat-mac/Carbon/MediaDescr.py b/sys/lib/python/plat-mac/Carbon/MediaDescr.py deleted file mode 100644 index 254634bb2..000000000 --- a/sys/lib/python/plat-mac/Carbon/MediaDescr.py +++ /dev/null @@ -1,97 +0,0 @@ -# Parsers/generators for QuickTime media descriptions -import struct - -Error = 'MediaDescr.Error' - -class _MediaDescriptionCodec: - def __init__(self, trunc, size, names, fmt): - self.trunc = trunc - self.size = size - self.names = names - self.fmt = fmt - - def decode(self, data): - if self.trunc: - data = data[:self.size] - values = struct.unpack(self.fmt, data) - if len(values) != len(self.names): - raise Error, ('Format length does not match number of names', descr) - rv = {} - for i in range(len(values)): - name = self.names[i] - value = values[i] - if type(name) == type(()): - name, cod, dec = name - value = dec(value) - rv[name] = value - return rv - - def encode(dict): - list = [self.fmt] - for name in self.names: - if type(name) == type(()): - name, cod, dec = name - else: - cod = dec = None - value = dict[name] - if cod: - value = cod(value) - list.append(value) - rv = struct.pack(*list) - return rv - -# Helper functions -def _tofixed(float): - hi = int(float) - lo = int(float*0x10000) & 0xffff - return (hi<<16)|lo - -def _fromfixed(fixed): - hi = (fixed >> 16) & 0xffff - lo = (fixed & 0xffff) - return hi + (lo / float(0x10000)) - -def _tostr31(str): - return chr(len(str)) + str + '\0'*(31-len(str)) - -def _fromstr31(str31): - return str31[1:1+ord(str31[0])] - -SampleDescription = _MediaDescriptionCodec( - 1, # May be longer, truncate - 16, # size - ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex'), # Attributes - "l4slhh" # Format -) - -SoundDescription = _MediaDescriptionCodec( - 1, - 36, - ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', - 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', - 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed)), - "l4slhhhh4shhhhl" # Format -) - -SoundDescriptionV1 = _MediaDescriptionCodec( - 1, - 52, - ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', - 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', - 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed), 'samplesPerPacket', - 'bytesPerPacket', 'bytesPerFrame', 'bytesPerSample'), - "l4slhhhh4shhhhlllll" # Format -) - -ImageDescription = _MediaDescriptionCodec( - 1, # May be longer, truncate - 86, # size - ('idSize', 'cType', 'resvd1', 'resvd2', 'dataRefIndex', 'version', - 'revisionLevel', 'vendor', 'temporalQuality', 'spatialQuality', - 'width', 'height', ('hRes', _tofixed, _fromfixed), ('vRes', _tofixed, _fromfixed), - 'dataSize', 'frameCount', ('name', _tostr31, _fromstr31), - 'depth', 'clutID'), - 'l4slhhhh4sllhhlllh32shh', -) - -# XXXX Others, like TextDescription and such, remain to be done. diff --git a/sys/lib/python/plat-mac/Carbon/Menu.py b/sys/lib/python/plat-mac/Carbon/Menu.py deleted file mode 100644 index 075cb9d8a..000000000 --- a/sys/lib/python/plat-mac/Carbon/Menu.py +++ /dev/null @@ -1 +0,0 @@ -from _Menu import * diff --git a/sys/lib/python/plat-mac/Carbon/Menus.py b/sys/lib/python/plat-mac/Carbon/Menus.py deleted file mode 100644 index 01affb096..000000000 --- a/sys/lib/python/plat-mac/Carbon/Menus.py +++ /dev/null @@ -1,169 +0,0 @@ -# Generated from 'Menus.h' - -def FOUR_CHAR_CODE(x): return x -noMark = 0 -kMenuDrawMsg = 0 -kMenuSizeMsg = 2 -kMenuPopUpMsg = 3 -kMenuCalcItemMsg = 5 -kMenuThemeSavvyMsg = 7 -mDrawMsg = 0 -mSizeMsg = 2 -mPopUpMsg = 3 -mCalcItemMsg = 5 -mChooseMsg = 1 -mDrawItemMsg = 4 -kMenuChooseMsg = 1 -kMenuDrawItemMsg = 4 -kThemeSavvyMenuResponse = 0x7473 -kMenuInitMsg = 8 -kMenuDisposeMsg = 9 -kMenuFindItemMsg = 10 -kMenuHiliteItemMsg = 11 -kMenuDrawItemsMsg = 12 -textMenuProc = 0 -hMenuCmd = 27 -hierMenu = -1 -kInsertHierarchicalMenu = -1 -mctAllItems = -98 -mctLastIDIndic = -99 -kMenuStdMenuProc = 63 -kMenuStdMenuBarProc = 63 -kMenuNoModifiers = 0 -kMenuShiftModifier = (1 << 0) -kMenuOptionModifier = (1 << 1) -kMenuControlModifier = (1 << 2) -kMenuNoCommandModifier = (1 << 3) -kMenuNoIcon = 0 -kMenuIconType = 1 -kMenuShrinkIconType = 2 -kMenuSmallIconType = 3 -kMenuColorIconType = 4 -kMenuIconSuiteType = 5 -kMenuIconRefType = 6 -kMenuCGImageRefType = 7 -kMenuSystemIconSelectorType = 8 -kMenuIconResourceType = 9 -kMenuNullGlyph = 0x00 -kMenuTabRightGlyph = 0x02 -kMenuTabLeftGlyph = 0x03 -kMenuEnterGlyph = 0x04 -kMenuShiftGlyph = 0x05 -kMenuControlGlyph = 0x06 -kMenuOptionGlyph = 0x07 -kMenuSpaceGlyph = 0x09 -kMenuDeleteRightGlyph = 0x0A -kMenuReturnGlyph = 0x0B -kMenuReturnR2LGlyph = 0x0C -kMenuNonmarkingReturnGlyph = 0x0D -kMenuPencilGlyph = 0x0F -kMenuDownwardArrowDashedGlyph = 0x10 -kMenuCommandGlyph = 0x11 -kMenuCheckmarkGlyph = 0x12 -kMenuDiamondGlyph = 0x13 -kMenuAppleLogoFilledGlyph = 0x14 -kMenuParagraphKoreanGlyph = 0x15 -kMenuDeleteLeftGlyph = 0x17 -kMenuLeftArrowDashedGlyph = 0x18 -kMenuUpArrowDashedGlyph = 0x19 -kMenuRightArrowDashedGlyph = 0x1A -kMenuEscapeGlyph = 0x1B -kMenuClearGlyph = 0x1C -kMenuLeftDoubleQuotesJapaneseGlyph = 0x1D -kMenuRightDoubleQuotesJapaneseGlyph = 0x1E -kMenuTrademarkJapaneseGlyph = 0x1F -kMenuBlankGlyph = 0x61 -kMenuPageUpGlyph = 0x62 -kMenuCapsLockGlyph = 0x63 -kMenuLeftArrowGlyph = 0x64 -kMenuRightArrowGlyph = 0x65 -kMenuNorthwestArrowGlyph = 0x66 -kMenuHelpGlyph = 0x67 -kMenuUpArrowGlyph = 0x68 -kMenuSoutheastArrowGlyph = 0x69 -kMenuDownArrowGlyph = 0x6A -kMenuPageDownGlyph = 0x6B -kMenuAppleLogoOutlineGlyph = 0x6C -kMenuContextualMenuGlyph = 0x6D -kMenuPowerGlyph = 0x6E -kMenuF1Glyph = 0x6F -kMenuF2Glyph = 0x70 -kMenuF3Glyph = 0x71 -kMenuF4Glyph = 0x72 -kMenuF5Glyph = 0x73 -kMenuF6Glyph = 0x74 -kMenuF7Glyph = 0x75 -kMenuF8Glyph = 0x76 -kMenuF9Glyph = 0x77 -kMenuF10Glyph = 0x78 -kMenuF11Glyph = 0x79 -kMenuF12Glyph = 0x7A -kMenuF13Glyph = 0x87 -kMenuF14Glyph = 0x88 -kMenuF15Glyph = 0x89 -kMenuControlISOGlyph = 0x8A -kMenuAttrExcludesMarkColumn = (1 << 0) -kMenuAttrAutoDisable = (1 << 2) -kMenuAttrUsePencilGlyph = (1 << 3) -kMenuAttrHidden = (1 << 4) -kMenuItemAttrDisabled = (1 << 0) -kMenuItemAttrIconDisabled = (1 << 1) -kMenuItemAttrSubmenuParentChoosable = (1 << 2) -kMenuItemAttrDynamic = (1 << 3) -kMenuItemAttrNotPreviousAlternate = (1 << 4) -kMenuItemAttrHidden = (1 << 5) -kMenuItemAttrSeparator = (1 << 6) -kMenuItemAttrSectionHeader = (1 << 7) -kMenuItemAttrIgnoreMeta = (1 << 8) -kMenuItemAttrAutoRepeat = (1 << 9) -kMenuItemAttrUseVirtualKey = (1 << 10) -kMenuItemAttrCustomDraw = (1 << 11) -kMenuItemAttrIncludeInCmdKeyMatching = (1 << 12) -kMenuTrackingModeMouse = 1 -kMenuTrackingModeKeyboard = 2 -kMenuEventIncludeDisabledItems = 0x0001 -kMenuEventQueryOnly = 0x0002 -kMenuEventDontCheckSubmenus = 0x0004 -kMenuItemDataText = (1 << 0) -kMenuItemDataMark = (1 << 1) -kMenuItemDataCmdKey = (1 << 2) -kMenuItemDataCmdKeyGlyph = (1 << 3) -kMenuItemDataCmdKeyModifiers = (1 << 4) -kMenuItemDataStyle = (1 << 5) -kMenuItemDataEnabled = (1 << 6) -kMenuItemDataIconEnabled = (1 << 7) -kMenuItemDataIconID = (1 << 8) -kMenuItemDataIconHandle = (1 << 9) -kMenuItemDataCommandID = (1 << 10) -kMenuItemDataTextEncoding = (1 << 11) -kMenuItemDataSubmenuID = (1 << 12) -kMenuItemDataSubmenuHandle = (1 << 13) -kMenuItemDataFontID = (1 << 14) -kMenuItemDataRefcon = (1 << 15) -kMenuItemDataAttributes = (1 << 16) -kMenuItemDataCFString = (1 << 17) -kMenuItemDataProperties = (1 << 18) -kMenuItemDataIndent = (1 << 19) -kMenuItemDataCmdVirtualKey = (1 << 20) -kMenuItemDataAllDataVersionOne = 0x000FFFFF -kMenuItemDataAllDataVersionTwo = kMenuItemDataAllDataVersionOne | kMenuItemDataCmdVirtualKey -kMenuDefProcPtr = 0 -kMenuPropertyPersistent = 0x00000001 -kHierarchicalFontMenuOption = 0x00000001 -gestaltContextualMenuAttr = FOUR_CHAR_CODE('cmnu') -gestaltContextualMenuUnusedBit = 0 -gestaltContextualMenuTrapAvailable = 1 -gestaltContextualMenuHasAttributeAndModifierKeys = 2 -gestaltContextualMenuHasUnicodeSupport = 3 -kCMHelpItemNoHelp = 0 -kCMHelpItemAppleGuide = 1 -kCMHelpItemOtherHelp = 2 -kCMHelpItemRemoveHelp = 3 -kCMNothingSelected = 0 -kCMMenuItemSelected = 1 -kCMShowHelpSelected = 3 -keyContextualMenuName = FOUR_CHAR_CODE('pnam') -keyContextualMenuCommandID = FOUR_CHAR_CODE('cmcd') -keyContextualMenuSubmenu = FOUR_CHAR_CODE('cmsb') -keyContextualMenuAttributes = FOUR_CHAR_CODE('cmat') -keyContextualMenuModifiers = FOUR_CHAR_CODE('cmmd') diff --git a/sys/lib/python/plat-mac/Carbon/Mlte.py b/sys/lib/python/plat-mac/Carbon/Mlte.py deleted file mode 100644 index b81fbc528..000000000 --- a/sys/lib/python/plat-mac/Carbon/Mlte.py +++ /dev/null @@ -1 +0,0 @@ -from _Mlte import * diff --git a/sys/lib/python/plat-mac/Carbon/OSA.py b/sys/lib/python/plat-mac/Carbon/OSA.py deleted file mode 100644 index 8d6732c94..000000000 --- a/sys/lib/python/plat-mac/Carbon/OSA.py +++ /dev/null @@ -1 +0,0 @@ -from _OSA import * diff --git a/sys/lib/python/plat-mac/Carbon/OSAconst.py b/sys/lib/python/plat-mac/Carbon/OSAconst.py deleted file mode 100644 index 3b64c2481..000000000 --- a/sys/lib/python/plat-mac/Carbon/OSAconst.py +++ /dev/null @@ -1,133 +0,0 @@ -# Generated from 'OSA.h' - -def FOUR_CHAR_CODE(x): return x -from Carbon.AppleEvents import * -kAEUseStandardDispatch = -1 -kOSAComponentType = FOUR_CHAR_CODE('osa ') -kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt') -kOSAFileType = FOUR_CHAR_CODE('osas') -kOSASuite = FOUR_CHAR_CODE('ascr') -kOSARecordedText = FOUR_CHAR_CODE('recd') -kOSAScriptIsModified = FOUR_CHAR_CODE('modi') -kOSAScriptIsTypeCompiledScript = FOUR_CHAR_CODE('cscr') -kOSAScriptIsTypeScriptValue = FOUR_CHAR_CODE('valu') -kOSAScriptIsTypeScriptContext = FOUR_CHAR_CODE('cntx') -kOSAScriptBestType = FOUR_CHAR_CODE('best') -kOSACanGetSource = FOUR_CHAR_CODE('gsrc') -typeOSADialectInfo = FOUR_CHAR_CODE('difo') -keyOSADialectName = FOUR_CHAR_CODE('dnam') -keyOSADialectCode = FOUR_CHAR_CODE('dcod') -keyOSADialectLangCode = FOUR_CHAR_CODE('dlcd') -keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd') -kOSANullScript = 0L -kOSANullMode = 0 -kOSAModeNull = 0 -kOSASupportsCompiling = 0x0002 -kOSASupportsGetSource = 0x0004 -kOSASupportsAECoercion = 0x0008 -kOSASupportsAESending = 0x0010 -kOSASupportsRecording = 0x0020 -kOSASupportsConvenience = 0x0040 -kOSASupportsDialects = 0x0080 -kOSASupportsEventHandling = 0x0100 -kOSASelectLoad = 0x0001 -kOSASelectStore = 0x0002 -kOSASelectExecute = 0x0003 -kOSASelectDisplay = 0x0004 -kOSASelectScriptError = 0x0005 -kOSASelectDispose = 0x0006 -kOSASelectSetScriptInfo = 0x0007 -kOSASelectGetScriptInfo = 0x0008 -kOSASelectSetActiveProc = 0x0009 -kOSASelectGetActiveProc = 0x000A -kOSASelectScriptingComponentName = 0x0102 -kOSASelectCompile = 0x0103 -kOSASelectCopyID = 0x0104 -kOSASelectCopyScript = 0x0105 -kOSASelectGetSource = 0x0201 -kOSASelectCoerceFromDesc = 0x0301 -kOSASelectCoerceToDesc = 0x0302 -kOSASelectSetSendProc = 0x0401 -kOSASelectGetSendProc = 0x0402 -kOSASelectSetCreateProc = 0x0403 -kOSASelectGetCreateProc = 0x0404 -kOSASelectSetDefaultTarget = 0x0405 -kOSASelectStartRecording = 0x0501 -kOSASelectStopRecording = 0x0502 -kOSASelectLoadExecute = 0x0601 -kOSASelectCompileExecute = 0x0602 -kOSASelectDoScript = 0x0603 -kOSASelectSetCurrentDialect = 0x0701 -kOSASelectGetCurrentDialect = 0x0702 -kOSASelectAvailableDialects = 0x0703 -kOSASelectGetDialectInfo = 0x0704 -kOSASelectAvailableDialectCodeList = 0x0705 -kOSASelectSetResumeDispatchProc = 0x0801 -kOSASelectGetResumeDispatchProc = 0x0802 -kOSASelectExecuteEvent = 0x0803 -kOSASelectDoEvent = 0x0804 -kOSASelectMakeContext = 0x0805 -kOSADebuggerCreateSession = 0x0901 -kOSADebuggerGetSessionState = 0x0902 -kOSADebuggerSessionStep = 0x0903 -kOSADebuggerDisposeSession = 0x0904 -kOSADebuggerGetStatementRanges = 0x0905 -kOSADebuggerGetBreakpoint = 0x0910 -kOSADebuggerSetBreakpoint = 0x0911 -kOSADebuggerGetDefaultBreakpoint = 0x0912 -kOSADebuggerGetCurrentCallFrame = 0x0906 -kOSADebuggerGetCallFrameState = 0x0907 -kOSADebuggerGetVariable = 0x0908 -kOSADebuggerSetVariable = 0x0909 -kOSADebuggerGetPreviousCallFrame = 0x090A -kOSADebuggerDisposeCallFrame = 0x090B -kOSADebuggerCountVariables = 0x090C -kOSASelectComponentSpecificStart = 0x1001 -kOSAModePreventGetSource = 0x00000001 -kOSAModeNeverInteract = kAENeverInteract -kOSAModeCanInteract = kAECanInteract -kOSAModeAlwaysInteract = kAEAlwaysInteract -kOSAModeDontReconnect = kAEDontReconnect -kOSAModeCantSwitchLayer = 0x00000040 -kOSAModeDoRecord = 0x00001000 -kOSAModeCompileIntoContext = 0x00000002 -kOSAModeAugmentContext = 0x00000004 -kOSAModeDisplayForHumans = 0x00000008 -kOSAModeDontStoreParent = 0x00010000 -kOSAModeDispatchToDirectObject = 0x00020000 -kOSAModeDontGetDataForArguments = 0x00040000 -kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype -typeOSAGenericStorage = kOSAScriptResourceType -kOSAErrorNumber = keyErrorNumber -kOSAErrorMessage = keyErrorString -kOSAErrorBriefMessage = FOUR_CHAR_CODE('errb') -kOSAErrorApp = FOUR_CHAR_CODE('erap') -kOSAErrorPartialResult = FOUR_CHAR_CODE('ptlr') -kOSAErrorOffendingObject = FOUR_CHAR_CODE('erob') -kOSAErrorExpectedType = FOUR_CHAR_CODE('errt') -kOSAErrorRange = FOUR_CHAR_CODE('erng') -typeOSAErrorRange = FOUR_CHAR_CODE('erng') -keyOSASourceStart = FOUR_CHAR_CODE('srcs') -keyOSASourceEnd = FOUR_CHAR_CODE('srce') -kOSAUseStandardDispatch = kAEUseStandardDispatch -kOSANoDispatch = kAENoDispatch -kOSADontUsePhac = 0x0001 -eNotStarted = 0 -eRunnable = 1 -eRunning = 2 -eStopped = 3 -eTerminated = 4 -eStepOver = 0 -eStepIn = 1 -eStepOut = 2 -eRun = 3 -eLocal = 0 -eGlobal = 1 -eProperties = 2 -keyProgramState = FOUR_CHAR_CODE('dsps') -typeStatementRange = FOUR_CHAR_CODE('srng') -keyProcedureName = FOUR_CHAR_CODE('dfnm') -keyStatementRange = FOUR_CHAR_CODE('dfsr') -keyLocalsNames = FOUR_CHAR_CODE('dfln') -keyGlobalsNames = FOUR_CHAR_CODE('dfgn') -keyParamsNames = FOUR_CHAR_CODE('dfpn') diff --git a/sys/lib/python/plat-mac/Carbon/QDOffscreen.py b/sys/lib/python/plat-mac/Carbon/QDOffscreen.py deleted file mode 100644 index b3f557e43..000000000 --- a/sys/lib/python/plat-mac/Carbon/QDOffscreen.py +++ /dev/null @@ -1,47 +0,0 @@ -# Generated from 'QDOffscreen.h' - -def FOUR_CHAR_CODE(x): return x -pixPurgeBit = 0 -noNewDeviceBit = 1 -useTempMemBit = 2 -keepLocalBit = 3 -useDistantHdwrMemBit = 4 -useLocalHdwrMemBit = 5 -pixelsPurgeableBit = 6 -pixelsLockedBit = 7 -mapPixBit = 16 -newDepthBit = 17 -alignPixBit = 18 -newRowBytesBit = 19 -reallocPixBit = 20 -clipPixBit = 28 -stretchPixBit = 29 -ditherPixBit = 30 -gwFlagErrBit = 31 -pixPurge = 1L << pixPurgeBit -noNewDevice = 1L << noNewDeviceBit -useTempMem = 1L << useTempMemBit -keepLocal = 1L << keepLocalBit -useDistantHdwrMem = 1L << useDistantHdwrMemBit -useLocalHdwrMem = 1L << useLocalHdwrMemBit -pixelsPurgeable = 1L << pixelsPurgeableBit -pixelsLocked = 1L << pixelsLockedBit -kAllocDirectDrawSurface = 1L << 14 -mapPix = 1L << mapPixBit -newDepth = 1L << newDepthBit -alignPix = 1L << alignPixBit -newRowBytes = 1L << newRowBytesBit -reallocPix = 1L << reallocPixBit -clipPix = 1L << clipPixBit -stretchPix = 1L << stretchPixBit -ditherPix = 1L << ditherPixBit -gwFlagErr = 1L << gwFlagErrBit -deviceIsIndirect = (1L << 0) -deviceNeedsLock = (1L << 1) -deviceIsStatic = (1L << 2) -deviceIsExternalBuffer = (1L << 3) -deviceIsDDSurface = (1L << 4) -deviceIsDCISurface = (1L << 5) -deviceIsGDISurface = (1L << 6) -deviceIsAScreen = (1L << 7) -deviceIsOverlaySurface = (1L << 8) diff --git a/sys/lib/python/plat-mac/Carbon/Qd.py b/sys/lib/python/plat-mac/Carbon/Qd.py deleted file mode 100644 index 227fe9855..000000000 --- a/sys/lib/python/plat-mac/Carbon/Qd.py +++ /dev/null @@ -1 +0,0 @@ -from _Qd import * diff --git a/sys/lib/python/plat-mac/Carbon/Qdoffs.py b/sys/lib/python/plat-mac/Carbon/Qdoffs.py deleted file mode 100644 index 90a3d2cec..000000000 --- a/sys/lib/python/plat-mac/Carbon/Qdoffs.py +++ /dev/null @@ -1 +0,0 @@ -from _Qdoffs import * diff --git a/sys/lib/python/plat-mac/Carbon/Qt.py b/sys/lib/python/plat-mac/Carbon/Qt.py deleted file mode 100644 index 590a92ad1..000000000 --- a/sys/lib/python/plat-mac/Carbon/Qt.py +++ /dev/null @@ -1,5 +0,0 @@ -from _Qt import * -try: - _ = AddFilePreview -except: - raise ImportError, "Old (2.3) _Qt.so module loaded in stead of new (2.4) _Qt.so" diff --git a/sys/lib/python/plat-mac/Carbon/QuickDraw.py b/sys/lib/python/plat-mac/Carbon/QuickDraw.py deleted file mode 100644 index 65c2f9a94..000000000 --- a/sys/lib/python/plat-mac/Carbon/QuickDraw.py +++ /dev/null @@ -1,218 +0,0 @@ -# Generated from 'QuickDraw.h' - - -def FOUR_CHAR_CODE(x): return x -normal = 0 -bold = 1 -italic = 2 -underline = 4 -outline = 8 -shadow = 0x10 -condense = 0x20 -extend = 0x40 -invalColReq = -1 -srcCopy = 0 -srcOr = 1 -srcXor = 2 -srcBic = 3 -notSrcCopy = 4 -notSrcOr = 5 -notSrcXor = 6 -notSrcBic = 7 -patCopy = 8 -patOr = 9 -patXor = 10 -patBic = 11 -notPatCopy = 12 -notPatOr = 13 -notPatXor = 14 -notPatBic = 15 -grayishTextOr = 49 -hilitetransfermode = 50 -hilite = 50 -blend = 32 -addPin = 33 -addOver = 34 -subPin = 35 -addMax = 37 -adMax = 37 -subOver = 38 -adMin = 39 -ditherCopy = 64 -transparent = 36 -italicBit = 1 -ulineBit = 2 -outlineBit = 3 -shadowBit = 4 -condenseBit = 5 -extendBit = 6 -normalBit = 0 -inverseBit = 1 -redBit = 4 -greenBit = 3 -blueBit = 2 -cyanBit = 8 -magentaBit = 7 -yellowBit = 6 -blackBit = 5 -blackColor = 33 -whiteColor = 30 -redColor = 205 -greenColor = 341 -blueColor = 409 -cyanColor = 273 -magentaColor = 137 -yellowColor = 69 -picLParen = 0 -picRParen = 1 -clutType = 0 -fixedType = 1 -directType = 2 -gdDevType = 0 -interlacedDevice = 2 -hwMirroredDevice = 4 -roundedDevice = 5 -hasAuxMenuBar = 6 -burstDevice = 7 -ext32Device = 8 -ramInit = 10 -mainScreen = 11 -allInit = 12 -screenDevice = 13 -noDriver = 14 -screenActive = 15 -hiliteBit = 7 -pHiliteBit = 0 -defQDColors = 127 -RGBDirect = 16 -baseAddr32 = 4 -sysPatListID = 0 -iBeamCursor = 1 -crossCursor = 2 -plusCursor = 3 -watchCursor = 4 -kQDGrafVerbFrame = 0 -kQDGrafVerbPaint = 1 -kQDGrafVerbErase = 2 -kQDGrafVerbInvert = 3 -kQDGrafVerbFill = 4 -frame = kQDGrafVerbFrame -paint = kQDGrafVerbPaint -erase = kQDGrafVerbErase -invert = kQDGrafVerbInvert -fill = kQDGrafVerbFill -chunky = 0 -chunkyPlanar = 1 -planar = 2 -singleDevicesBit = 0 -dontMatchSeedsBit = 1 -allDevicesBit = 2 -singleDevices = 1 << singleDevicesBit -dontMatchSeeds = 1 << dontMatchSeedsBit -allDevices = 1 << allDevicesBit -kPrinterFontStatus = 0 -kPrinterScalingStatus = 1 -kNoConstraint = 0 -kVerticalConstraint = 1 -kHorizontalConstraint = 2 -k1MonochromePixelFormat = 0x00000001 -k2IndexedPixelFormat = 0x00000002 -k4IndexedPixelFormat = 0x00000004 -k8IndexedPixelFormat = 0x00000008 -k16BE555PixelFormat = 0x00000010 -k24RGBPixelFormat = 0x00000018 -k32ARGBPixelFormat = 0x00000020 -k1IndexedGrayPixelFormat = 0x00000021 -k2IndexedGrayPixelFormat = 0x00000022 -k4IndexedGrayPixelFormat = 0x00000024 -k8IndexedGrayPixelFormat = 0x00000028 -k16LE555PixelFormat = FOUR_CHAR_CODE('L555') -k16LE5551PixelFormat = FOUR_CHAR_CODE('5551') -k16BE565PixelFormat = FOUR_CHAR_CODE('B565') -k16LE565PixelFormat = FOUR_CHAR_CODE('L565') -k24BGRPixelFormat = FOUR_CHAR_CODE('24BG') -k32BGRAPixelFormat = FOUR_CHAR_CODE('BGRA') -k32ABGRPixelFormat = FOUR_CHAR_CODE('ABGR') -k32RGBAPixelFormat = FOUR_CHAR_CODE('RGBA') -kYUVSPixelFormat = FOUR_CHAR_CODE('yuvs') -kYUVUPixelFormat = FOUR_CHAR_CODE('yuvu') -kYVU9PixelFormat = FOUR_CHAR_CODE('YVU9') -kYUV411PixelFormat = FOUR_CHAR_CODE('Y411') -kYVYU422PixelFormat = FOUR_CHAR_CODE('YVYU') -kUYVY422PixelFormat = FOUR_CHAR_CODE('UYVY') -kYUV211PixelFormat = FOUR_CHAR_CODE('Y211') -k2vuyPixelFormat = FOUR_CHAR_CODE('2vuy') -kCursorImageMajorVersion = 0x0001 -kCursorImageMinorVersion = 0x0000 -kQDParseRegionFromTop = (1 << 0) -kQDParseRegionFromBottom = (1 << 1) -kQDParseRegionFromLeft = (1 << 2) -kQDParseRegionFromRight = (1 << 3) -kQDParseRegionFromTopLeft = kQDParseRegionFromTop | kQDParseRegionFromLeft -kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight -kQDRegionToRectsMsgInit = 1 -kQDRegionToRectsMsgParse = 2 -kQDRegionToRectsMsgTerminate = 3 -colorXorXFer = 52 -noiseXFer = 53 -customXFer = 54 -kXFer1PixelAtATime = 0x00000001 -kXFerConvertPixelToRGB32 = 0x00000002 -kCursorComponentsVersion = 0x00010001 -kCursorComponentType = FOUR_CHAR_CODE('curs') -cursorDoesAnimate = 1L << 0 -cursorDoesHardware = 1L << 1 -cursorDoesUnreadableScreenBits = 1L << 2 -kRenderCursorInHardware = 1L << 0 -kRenderCursorInSoftware = 1L << 1 -kCursorComponentInit = 0x0001 -kCursorComponentGetInfo = 0x0002 -kCursorComponentSetOutputMode = 0x0003 -kCursorComponentSetData = 0x0004 -kCursorComponentReconfigure = 0x0005 -kCursorComponentDraw = 0x0006 -kCursorComponentErase = 0x0007 -kCursorComponentMove = 0x0008 -kCursorComponentAnimate = 0x0009 -kCursorComponentLastReserved = 0x0050 -# Generated from 'QuickDrawText.h' - - -def FOUR_CHAR_CODE(x): return x -normal = 0 -bold = 1 -italic = 2 -underline = 4 -outline = 8 -shadow = 0x10 -condense = 0x20 -extend = 0x40 -leftCaret = 0 -rightCaret = -1 -kHilite = 1 -smLeftCaret = 0 -smRightCaret = -1 -smHilite = 1 -onlyStyleRun = 0 -leftStyleRun = 1 -rightStyleRun = 2 -middleStyleRun = 3 -smOnlyStyleRun = 0 -smLeftStyleRun = 1 -smRightStyleRun = 2 -smMiddleStyleRun = 3 -truncEnd = 0 -truncMiddle = 0x4000 -smTruncEnd = 0 -smTruncMiddle = 0x4000 -notTruncated = 0 -truncated = 1 -truncErr = -1 -smNotTruncated = 0 -smTruncated = 1 -smTruncErr = -1 -smBreakWord = 0 -smBreakChar = 1 -smBreakOverflow = 2 -tfAntiAlias = 1 << 0 -tfUnicode = 1 << 1 diff --git a/sys/lib/python/plat-mac/Carbon/QuickTime.py b/sys/lib/python/plat-mac/Carbon/QuickTime.py deleted file mode 100644 index 8fba58cb3..000000000 --- a/sys/lib/python/plat-mac/Carbon/QuickTime.py +++ /dev/null @@ -1,3468 +0,0 @@ -# Generated from 'Movies.h' - -def FOUR_CHAR_CODE(x): return x -xmlIdentifierUnrecognized = -1 -kControllerMinimum = -0xf777 -notImplementedMusicOSErr = -2071 -cantSendToSynthesizerOSErr = -2072 -cantReceiveFromSynthesizerOSErr = -2073 -illegalVoiceAllocationOSErr = -2074 -illegalPartOSErr = -2075 -illegalChannelOSErr = -2076 -illegalKnobOSErr = -2077 -illegalKnobValueOSErr = -2078 -illegalInstrumentOSErr = -2079 -illegalControllerOSErr = -2080 -midiManagerAbsentOSErr = -2081 -synthesizerNotRespondingOSErr = -2082 -synthesizerOSErr = -2083 -illegalNoteChannelOSErr = -2084 -noteChannelNotAllocatedOSErr = -2085 -tunePlayerFullOSErr = -2086 -tuneParseOSErr = -2087 -MovieFileType = FOUR_CHAR_CODE('MooV') -MovieScrapType = FOUR_CHAR_CODE('moov') -MovieResourceType = FOUR_CHAR_CODE('moov') -MovieForwardPointerResourceType = FOUR_CHAR_CODE('fore') -MovieBackwardPointerResourceType = FOUR_CHAR_CODE('back') -MovieResourceAtomType = FOUR_CHAR_CODE('moov') -MovieDataAtomType = FOUR_CHAR_CODE('mdat') -FreeAtomType = FOUR_CHAR_CODE('free') -SkipAtomType = FOUR_CHAR_CODE('skip') -WideAtomPlaceholderType = FOUR_CHAR_CODE('wide') -MediaHandlerType = FOUR_CHAR_CODE('mhlr') -DataHandlerType = FOUR_CHAR_CODE('dhlr') -VideoMediaType = FOUR_CHAR_CODE('vide') -SoundMediaType = FOUR_CHAR_CODE('soun') -TextMediaType = FOUR_CHAR_CODE('text') -BaseMediaType = FOUR_CHAR_CODE('gnrc') -MPEGMediaType = FOUR_CHAR_CODE('MPEG') -MusicMediaType = FOUR_CHAR_CODE('musi') -TimeCodeMediaType = FOUR_CHAR_CODE('tmcd') -SpriteMediaType = FOUR_CHAR_CODE('sprt') -FlashMediaType = FOUR_CHAR_CODE('flsh') -MovieMediaType = FOUR_CHAR_CODE('moov') -TweenMediaType = FOUR_CHAR_CODE('twen') -ThreeDeeMediaType = FOUR_CHAR_CODE('qd3d') -SkinMediaType = FOUR_CHAR_CODE('skin') -HandleDataHandlerSubType = FOUR_CHAR_CODE('hndl') -PointerDataHandlerSubType = FOUR_CHAR_CODE('ptr ') -NullDataHandlerSubType = FOUR_CHAR_CODE('null') -ResourceDataHandlerSubType = FOUR_CHAR_CODE('rsrc') -URLDataHandlerSubType = FOUR_CHAR_CODE('url ') -WiredActionHandlerType = FOUR_CHAR_CODE('wire') -VisualMediaCharacteristic = FOUR_CHAR_CODE('eyes') -AudioMediaCharacteristic = FOUR_CHAR_CODE('ears') -kCharacteristicCanSendVideo = FOUR_CHAR_CODE('vsnd') -kCharacteristicProvidesActions = FOUR_CHAR_CODE('actn') -kCharacteristicNonLinear = FOUR_CHAR_CODE('nonl') -kCharacteristicCanStep = FOUR_CHAR_CODE('step') -kCharacteristicHasNoDuration = FOUR_CHAR_CODE('noti') -kCharacteristicHasSkinData = FOUR_CHAR_CODE('skin') -kCharacteristicProvidesKeyFocus = FOUR_CHAR_CODE('keyf') -kUserDataMovieControllerType = FOUR_CHAR_CODE('ctyp') -kUserDataName = FOUR_CHAR_CODE('name') -kUserDataTextAlbum = FOUR_CHAR_CODE('\xa9alb') -kUserDataTextArtist = FOUR_CHAR_CODE('\xa9ART') -kUserDataTextAuthor = FOUR_CHAR_CODE('\xa9aut') -kUserDataTextChapter = FOUR_CHAR_CODE('\xa9chp') -kUserDataTextComment = FOUR_CHAR_CODE('\xa9cmt') -kUserDataTextComposer = FOUR_CHAR_CODE('\xa9com') -kUserDataTextCopyright = FOUR_CHAR_CODE('\xa9cpy') -kUserDataTextCreationDate = FOUR_CHAR_CODE('\xa9day') -kUserDataTextDescription = FOUR_CHAR_CODE('\xa9des') -kUserDataTextDirector = FOUR_CHAR_CODE('\xa9dir') -kUserDataTextDisclaimer = FOUR_CHAR_CODE('\xa9dis') -kUserDataTextEncodedBy = FOUR_CHAR_CODE('\xa9enc') -kUserDataTextFullName = FOUR_CHAR_CODE('\xa9nam') -kUserDataTextGenre = FOUR_CHAR_CODE('\xa9gen') -kUserDataTextHostComputer = FOUR_CHAR_CODE('\xa9hst') -kUserDataTextInformation = FOUR_CHAR_CODE('\xa9inf') -kUserDataTextKeywords = FOUR_CHAR_CODE('\xa9key') -kUserDataTextMake = FOUR_CHAR_CODE('\xa9mak') -kUserDataTextModel = FOUR_CHAR_CODE('\xa9mod') -kUserDataTextOriginalArtist = FOUR_CHAR_CODE('\xa9ope') -kUserDataTextOriginalFormat = FOUR_CHAR_CODE('\xa9fmt') -kUserDataTextOriginalSource = FOUR_CHAR_CODE('\xa9src') -kUserDataTextPerformers = FOUR_CHAR_CODE('\xa9prf') -kUserDataTextProducer = FOUR_CHAR_CODE('\xa9prd') -kUserDataTextProduct = FOUR_CHAR_CODE('\xa9PRD') -kUserDataTextSoftware = FOUR_CHAR_CODE('\xa9swr') -kUserDataTextSpecialPlaybackRequirements = FOUR_CHAR_CODE('\xa9req') -kUserDataTextTrack = FOUR_CHAR_CODE('\xa9trk') -kUserDataTextWarning = FOUR_CHAR_CODE('\xa9wrn') -kUserDataTextWriter = FOUR_CHAR_CODE('\xa9wrt') -kUserDataTextURLLink = FOUR_CHAR_CODE('\xa9url') -kUserDataTextEditDate1 = FOUR_CHAR_CODE('\xa9ed1') -kUserDataUnicodeBit = 1L << 7 -DoTheRightThing = 0 -kQTNetworkStatusNoNetwork = -2 -kQTNetworkStatusUncertain = -1 -kQTNetworkStatusNotConnected = 0 -kQTNetworkStatusConnected = 1 -kMusicFlagDontPlay2Soft = 1L << 0 -kMusicFlagDontSlaveToMovie = 1L << 1 -dfDontDisplay = 1 << 0 -dfDontAutoScale = 1 << 1 -dfClipToTextBox = 1 << 2 -dfUseMovieBGColor = 1 << 3 -dfShrinkTextBoxToFit = 1 << 4 -dfScrollIn = 1 << 5 -dfScrollOut = 1 << 6 -dfHorizScroll = 1 << 7 -dfReverseScroll = 1 << 8 -dfContinuousScroll = 1 << 9 -dfFlowHoriz = 1 << 10 -dfContinuousKaraoke = 1 << 11 -dfDropShadow = 1 << 12 -dfAntiAlias = 1 << 13 -dfKeyedText = 1 << 14 -dfInverseHilite = 1 << 15 -dfTextColorHilite = 1 << 16 -searchTextDontGoToFoundTime = 1L << 16 -searchTextDontHiliteFoundText = 1L << 17 -searchTextOneTrackOnly = 1L << 18 -searchTextEnabledTracksOnly = 1L << 19 -kTextTextHandle = 1 -kTextTextPtr = 2 -kTextTEStyle = 3 -kTextSelection = 4 -kTextBackColor = 5 -kTextForeColor = 6 -kTextFace = 7 -kTextFont = 8 -kTextSize = 9 -kTextAlignment = 10 -kTextHilite = 11 -kTextDropShadow = 12 -kTextDisplayFlags = 13 -kTextScroll = 14 -kTextRelativeScroll = 15 -kTextHyperTextFace = 16 -kTextHyperTextColor = 17 -kTextKeyEntry = 18 -kTextMouseDown = 19 -kTextTextBox = 20 -kTextEditState = 21 -kTextLength = 22 -k3DMediaRendererEntry = FOUR_CHAR_CODE('rend') -k3DMediaRendererName = FOUR_CHAR_CODE('name') -k3DMediaRendererCode = FOUR_CHAR_CODE('rcod') -movieProgressOpen = 0 -movieProgressUpdatePercent = 1 -movieProgressClose = 2 -progressOpFlatten = 1 -progressOpInsertTrackSegment = 2 -progressOpInsertMovieSegment = 3 -progressOpPaste = 4 -progressOpAddMovieSelection = 5 -progressOpCopy = 6 -progressOpCut = 7 -progressOpLoadMovieIntoRam = 8 -progressOpLoadTrackIntoRam = 9 -progressOpLoadMediaIntoRam = 10 -progressOpImportMovie = 11 -progressOpExportMovie = 12 -mediaQualityDraft = 0x0000 -mediaQualityNormal = 0x0040 -mediaQualityBetter = 0x0080 -mediaQualityBest = 0x00C0 -kQTEventPayloadIsQTList = 1L << 0 -kActionMovieSetVolume = 1024 -kActionMovieSetRate = 1025 -kActionMovieSetLoopingFlags = 1026 -kActionMovieGoToTime = 1027 -kActionMovieGoToTimeByName = 1028 -kActionMovieGoToBeginning = 1029 -kActionMovieGoToEnd = 1030 -kActionMovieStepForward = 1031 -kActionMovieStepBackward = 1032 -kActionMovieSetSelection = 1033 -kActionMovieSetSelectionByName = 1034 -kActionMoviePlaySelection = 1035 -kActionMovieSetLanguage = 1036 -kActionMovieChanged = 1037 -kActionMovieRestartAtTime = 1038 -kActionMovieGotoNextChapter = 1039 -kActionMovieGotoPreviousChapter = 1040 -kActionMovieGotoFirstChapter = 1041 -kActionMovieGotoLastChapter = 1042 -kActionMovieGotoChapterByIndex = 1043 -kActionMovieSetScale = 1044 -kActionTrackSetVolume = 2048 -kActionTrackSetBalance = 2049 -kActionTrackSetEnabled = 2050 -kActionTrackSetMatrix = 2051 -kActionTrackSetLayer = 2052 -kActionTrackSetClip = 2053 -kActionTrackSetCursor = 2054 -kActionTrackSetGraphicsMode = 2055 -kActionTrackSetIdleFrequency = 2056 -kActionTrackSetBassTreble = 2057 -kActionSpriteSetMatrix = 3072 -kActionSpriteSetImageIndex = 3073 -kActionSpriteSetVisible = 3074 -kActionSpriteSetLayer = 3075 -kActionSpriteSetGraphicsMode = 3076 -kActionSpritePassMouseToCodec = 3078 -kActionSpriteClickOnCodec = 3079 -kActionSpriteTranslate = 3080 -kActionSpriteScale = 3081 -kActionSpriteRotate = 3082 -kActionSpriteStretch = 3083 -kActionSpriteSetCanBeHitTested = 3094 -kActionQTVRSetPanAngle = 4096 -kActionQTVRSetTiltAngle = 4097 -kActionQTVRSetFieldOfView = 4098 -kActionQTVRShowDefaultView = 4099 -kActionQTVRGoToNodeID = 4100 -kActionQTVREnableHotSpot = 4101 -kActionQTVRShowHotSpots = 4102 -kActionQTVRTranslateObject = 4103 -kActionQTVRSetViewState = 4109 -kActionMusicPlayNote = 5120 -kActionMusicSetController = 5121 -kActionCase = 6144 -kActionWhile = 6145 -kActionGoToURL = 6146 -kActionSendQTEventToSprite = 6147 -kActionDebugStr = 6148 -kActionPushCurrentTime = 6149 -kActionPushCurrentTimeWithLabel = 6150 -kActionPopAndGotoTopTime = 6151 -kActionPopAndGotoLabeledTime = 6152 -kActionStatusString = 6153 -kActionSendQTEventToTrackObject = 6154 -kActionAddChannelSubscription = 6155 -kActionRemoveChannelSubscription = 6156 -kActionOpenCustomActionHandler = 6157 -kActionDoScript = 6158 -kActionDoCompressedActions = 6159 -kActionSendAppMessage = 6160 -kActionLoadComponent = 6161 -kActionSetFocus = 6162 -kActionDontPassKeyEvent = 6163 -kActionSetRandomSeed = 6164 -kActionSpriteTrackSetVariable = 7168 -kActionSpriteTrackNewSprite = 7169 -kActionSpriteTrackDisposeSprite = 7170 -kActionSpriteTrackSetVariableToString = 7171 -kActionSpriteTrackConcatVariables = 7172 -kActionSpriteTrackSetVariableToMovieURL = 7173 -kActionSpriteTrackSetVariableToMovieBaseURL = 7174 -kActionSpriteTrackSetAllSpritesHitTestingMode = 7181 -kActionSpriteTrackNewImage = 7182 -kActionSpriteTrackDisposeImage = 7183 -kActionApplicationNumberAndString = 8192 -kActionQD3DNamedObjectTranslateTo = 9216 -kActionQD3DNamedObjectScaleTo = 9217 -kActionQD3DNamedObjectRotateTo = 9218 -kActionFlashTrackSetPan = 10240 -kActionFlashTrackSetZoom = 10241 -kActionFlashTrackSetZoomRect = 10242 -kActionFlashTrackGotoFrameNumber = 10243 -kActionFlashTrackGotoFrameLabel = 10244 -kActionFlashTrackSetFlashVariable = 10245 -kActionFlashTrackDoButtonActions = 10246 -kActionMovieTrackAddChildMovie = 11264 -kActionMovieTrackLoadChildMovie = 11265 -kActionMovieTrackLoadChildMovieWithQTListParams = 11266 -kActionTextTrackPasteText = 12288 -kActionTextTrackSetTextBox = 12291 -kActionTextTrackSetTextStyle = 12292 -kActionTextTrackSetSelection = 12293 -kActionTextTrackSetBackgroundColor = 12294 -kActionTextTrackSetForegroundColor = 12295 -kActionTextTrackSetFace = 12296 -kActionTextTrackSetFont = 12297 -kActionTextTrackSetSize = 12298 -kActionTextTrackSetAlignment = 12299 -kActionTextTrackSetHilite = 12300 -kActionTextTrackSetDropShadow = 12301 -kActionTextTrackSetDisplayFlags = 12302 -kActionTextTrackSetScroll = 12303 -kActionTextTrackRelativeScroll = 12304 -kActionTextTrackFindText = 12305 -kActionTextTrackSetHyperTextFace = 12306 -kActionTextTrackSetHyperTextColor = 12307 -kActionTextTrackKeyEntry = 12308 -kActionTextTrackMouseDown = 12309 -kActionTextTrackSetEditable = 12310 -kActionListAddElement = 13312 -kActionListRemoveElements = 13313 -kActionListSetElementValue = 13314 -kActionListPasteFromXML = 13315 -kActionListSetMatchingFromXML = 13316 -kActionListSetFromURL = 13317 -kActionListExchangeLists = 13318 -kActionListServerQuery = 13319 -kOperandExpression = 1 -kOperandConstant = 2 -kOperandSubscribedToChannel = 3 -kOperandUniqueCustomActionHandlerID = 4 -kOperandCustomActionHandlerIDIsOpen = 5 -kOperandConnectionSpeed = 6 -kOperandGMTDay = 7 -kOperandGMTMonth = 8 -kOperandGMTYear = 9 -kOperandGMTHours = 10 -kOperandGMTMinutes = 11 -kOperandGMTSeconds = 12 -kOperandLocalDay = 13 -kOperandLocalMonth = 14 -kOperandLocalYear = 15 -kOperandLocalHours = 16 -kOperandLocalMinutes = 17 -kOperandLocalSeconds = 18 -kOperandRegisteredForQuickTimePro = 19 -kOperandPlatformRunningOn = 20 -kOperandQuickTimeVersion = 21 -kOperandComponentVersion = 22 -kOperandOriginalHandlerRefcon = 23 -kOperandTicks = 24 -kOperandMaxLoadedTimeInMovie = 25 -kOperandEventParameter = 26 -kOperandFreeMemory = 27 -kOperandNetworkStatus = 28 -kOperandQuickTimeVersionRegistered = 29 -kOperandSystemVersion = 30 -kOperandMovieVolume = 1024 -kOperandMovieRate = 1025 -kOperandMovieIsLooping = 1026 -kOperandMovieLoopIsPalindrome = 1027 -kOperandMovieTime = 1028 -kOperandMovieDuration = 1029 -kOperandMovieTimeScale = 1030 -kOperandMovieWidth = 1031 -kOperandMovieHeight = 1032 -kOperandMovieLoadState = 1033 -kOperandMovieTrackCount = 1034 -kOperandMovieIsActive = 1035 -kOperandMovieName = 1036 -kOperandMovieID = 1037 -kOperandMovieChapterCount = 1038 -kOperandMovieChapterIndex = 1039 -kOperandMovieChapterName = 1040 -kOperandMovieChapterNameByIndex = 1041 -kOperandMovieChapterIndexByName = 1042 -kOperandMovieAnnotation = 1043 -kOperandMovieConnectionFlags = 1044 -kOperandMovieConnectionString = 1045 -kOperandTrackVolume = 2048 -kOperandTrackBalance = 2049 -kOperandTrackEnabled = 2050 -kOperandTrackLayer = 2051 -kOperandTrackWidth = 2052 -kOperandTrackHeight = 2053 -kOperandTrackDuration = 2054 -kOperandTrackName = 2055 -kOperandTrackID = 2056 -kOperandTrackIdleFrequency = 2057 -kOperandTrackBass = 2058 -kOperandTrackTreble = 2059 -kOperandSpriteBoundsLeft = 3072 -kOperandSpriteBoundsTop = 3073 -kOperandSpriteBoundsRight = 3074 -kOperandSpriteBoundsBottom = 3075 -kOperandSpriteImageIndex = 3076 -kOperandSpriteVisible = 3077 -kOperandSpriteLayer = 3078 -kOperandSpriteTrackVariable = 3079 -kOperandSpriteTrackNumSprites = 3080 -kOperandSpriteTrackNumImages = 3081 -kOperandSpriteID = 3082 -kOperandSpriteIndex = 3083 -kOperandSpriteFirstCornerX = 3084 -kOperandSpriteFirstCornerY = 3085 -kOperandSpriteSecondCornerX = 3086 -kOperandSpriteSecondCornerY = 3087 -kOperandSpriteThirdCornerX = 3088 -kOperandSpriteThirdCornerY = 3089 -kOperandSpriteFourthCornerX = 3090 -kOperandSpriteFourthCornerY = 3091 -kOperandSpriteImageRegistrationPointX = 3092 -kOperandSpriteImageRegistrationPointY = 3093 -kOperandSpriteTrackSpriteIDAtPoint = 3094 -kOperandSpriteName = 3095 -kOperandSpriteCanBeHitTested = 3105 -kOperandSpriteTrackAllSpritesHitTestingMode = 3106 -kOperandSpriteTrackImageIDByIndex = 3107 -kOperandSpriteTrackImageIndexByID = 3108 -kOperandQTVRPanAngle = 4096 -kOperandQTVRTiltAngle = 4097 -kOperandQTVRFieldOfView = 4098 -kOperandQTVRNodeID = 4099 -kOperandQTVRHotSpotsVisible = 4100 -kOperandQTVRViewCenterH = 4101 -kOperandQTVRViewCenterV = 4102 -kOperandQTVRViewStateCount = 4103 -kOperandQTVRViewState = 4104 -kOperandMouseLocalHLoc = 5120 -kOperandMouseLocalVLoc = 5121 -kOperandKeyIsDown = 5122 -kOperandRandom = 5123 -kOperandCanHaveFocus = 5124 -kOperandHasFocus = 5125 -kOperandTextTrackEditable = 6144 -kOperandTextTrackCopyText = 6145 -kOperandTextTrackStartSelection = 6146 -kOperandTextTrackEndSelection = 6147 -kOperandTextTrackTextBoxLeft = 6148 -kOperandTextTrackTextBoxTop = 6149 -kOperandTextTrackTextBoxRight = 6150 -kOperandTextTrackTextBoxBottom = 6151 -kOperandTextTrackTextLength = 6152 -kOperandListCountElements = 7168 -kOperandListGetElementPathByIndex = 7169 -kOperandListGetElementValue = 7170 -kOperandListCopyToXML = 7171 -kOperandSin = 8192 -kOperandCos = 8193 -kOperandTan = 8194 -kOperandATan = 8195 -kOperandATan2 = 8196 -kOperandDegreesToRadians = 8197 -kOperandRadiansToDegrees = 8198 -kOperandSquareRoot = 8199 -kOperandExponent = 8200 -kOperandLog = 8201 -kOperandFlashTrackVariable = 9216 -kOperandStringLength = 10240 -kOperandStringCompare = 10241 -kOperandStringSubString = 10242 -kOperandStringConcat = 10243 -kFirstMovieAction = kActionMovieSetVolume -kLastMovieAction = kActionMovieSetScale -kFirstTrackAction = kActionTrackSetVolume -kLastTrackAction = kActionTrackSetBassTreble -kFirstSpriteAction = kActionSpriteSetMatrix -kLastSpriteAction = kActionSpriteSetCanBeHitTested -kFirstQTVRAction = kActionQTVRSetPanAngle -kLastQTVRAction = kActionQTVRSetViewState -kFirstMusicAction = kActionMusicPlayNote -kLastMusicAction = kActionMusicSetController -kFirstSystemAction = kActionCase -kLastSystemAction = kActionSetRandomSeed -kFirstSpriteTrackAction = kActionSpriteTrackSetVariable -kLastSpriteTrackAction = kActionSpriteTrackDisposeImage -kFirstApplicationAction = kActionApplicationNumberAndString -kLastApplicationAction = kActionApplicationNumberAndString -kFirstQD3DNamedObjectAction = kActionQD3DNamedObjectTranslateTo -kLastQD3DNamedObjectAction = kActionQD3DNamedObjectRotateTo -kFirstFlashTrackAction = kActionFlashTrackSetPan -kLastFlashTrackAction = kActionFlashTrackDoButtonActions -kFirstMovieTrackAction = kActionMovieTrackAddChildMovie -kLastMovieTrackAction = kActionMovieTrackLoadChildMovieWithQTListParams -kFirstTextTrackAction = kActionTextTrackPasteText -kLastTextTrackAction = kActionTextTrackSetEditable -kFirstMultiTargetAction = kActionListAddElement -kLastMultiTargetAction = kActionListServerQuery -kFirstAction = kFirstMovieAction -kLastAction = kLastMultiTargetAction -kTargetMovie = FOUR_CHAR_CODE('moov') -kTargetMovieName = FOUR_CHAR_CODE('mona') -kTargetMovieID = FOUR_CHAR_CODE('moid') -kTargetRootMovie = FOUR_CHAR_CODE('moro') -kTargetParentMovie = FOUR_CHAR_CODE('mopa') -kTargetChildMovieTrackName = FOUR_CHAR_CODE('motn') -kTargetChildMovieTrackID = FOUR_CHAR_CODE('moti') -kTargetChildMovieTrackIndex = FOUR_CHAR_CODE('motx') -kTargetChildMovieMovieName = FOUR_CHAR_CODE('momn') -kTargetChildMovieMovieID = FOUR_CHAR_CODE('momi') -kTargetTrackName = FOUR_CHAR_CODE('trna') -kTargetTrackID = FOUR_CHAR_CODE('trid') -kTargetTrackType = FOUR_CHAR_CODE('trty') -kTargetTrackIndex = FOUR_CHAR_CODE('trin') -kTargetSpriteName = FOUR_CHAR_CODE('spna') -kTargetSpriteID = FOUR_CHAR_CODE('spid') -kTargetSpriteIndex = FOUR_CHAR_CODE('spin') -kTargetQD3DNamedObjectName = FOUR_CHAR_CODE('nana') -kTargetCurrentQTEventParams = FOUR_CHAR_CODE('evpa') -kQTEventType = FOUR_CHAR_CODE('evnt') -kAction = FOUR_CHAR_CODE('actn') -kWhichAction = FOUR_CHAR_CODE('whic') -kActionParameter = FOUR_CHAR_CODE('parm') -kActionTarget = FOUR_CHAR_CODE('targ') -kActionFlags = FOUR_CHAR_CODE('flag') -kActionParameterMinValue = FOUR_CHAR_CODE('minv') -kActionParameterMaxValue = FOUR_CHAR_CODE('maxv') -kActionListAtomType = FOUR_CHAR_CODE('list') -kExpressionContainerAtomType = FOUR_CHAR_CODE('expr') -kConditionalAtomType = FOUR_CHAR_CODE('test') -kOperatorAtomType = FOUR_CHAR_CODE('oper') -kOperandAtomType = FOUR_CHAR_CODE('oprn') -kCommentAtomType = FOUR_CHAR_CODE('why ') -kCustomActionHandler = FOUR_CHAR_CODE('cust') -kCustomHandlerID = FOUR_CHAR_CODE('id ') -kCustomHandlerDesc = FOUR_CHAR_CODE('desc') -kQTEventRecordAtomType = FOUR_CHAR_CODE('erec') -kQTEventMouseClick = FOUR_CHAR_CODE('clik') -kQTEventMouseClickEnd = FOUR_CHAR_CODE('cend') -kQTEventMouseClickEndTriggerButton = FOUR_CHAR_CODE('trig') -kQTEventMouseEnter = FOUR_CHAR_CODE('entr') -kQTEventMouseExit = FOUR_CHAR_CODE('exit') -kQTEventMouseMoved = FOUR_CHAR_CODE('move') -kQTEventFrameLoaded = FOUR_CHAR_CODE('fram') -kQTEventIdle = FOUR_CHAR_CODE('idle') -kQTEventKey = FOUR_CHAR_CODE('key ') -kQTEventMovieLoaded = FOUR_CHAR_CODE('load') -kQTEventRequestToModifyMovie = FOUR_CHAR_CODE('reqm') -kQTEventListReceived = FOUR_CHAR_CODE('list') -kQTEventKeyUp = FOUR_CHAR_CODE('keyU') -kActionFlagActionIsDelta = 1L << 1 -kActionFlagParameterWrapsAround = 1L << 2 -kActionFlagActionIsToggle = 1L << 3 -kStatusStringIsURLLink = 1L << 1 -kStatusStringIsStreamingStatus = 1L << 2 -kStatusHasCodeNumber = 1L << 3 -kStatusIsError = 1L << 4 -kScriptIsUnknownType = 1L << 0 -kScriptIsJavaScript = 1L << 1 -kScriptIsLingoEvent = 1L << 2 -kScriptIsVBEvent = 1L << 3 -kScriptIsProjectorCommand = 1L << 4 -kScriptIsAppleScript = 1L << 5 -kQTRegistrationDialogTimeOutFlag = 1 << 0 -kQTRegistrationDialogShowDialog = 1 << 1 -kQTRegistrationDialogForceDialog = 1 << 2 -kOperatorAdd = FOUR_CHAR_CODE('add ') -kOperatorSubtract = FOUR_CHAR_CODE('sub ') -kOperatorMultiply = FOUR_CHAR_CODE('mult') -kOperatorDivide = FOUR_CHAR_CODE('div ') -kOperatorOr = FOUR_CHAR_CODE('or ') -kOperatorAnd = FOUR_CHAR_CODE('and ') -kOperatorNot = FOUR_CHAR_CODE('not ') -kOperatorLessThan = FOUR_CHAR_CODE('< ') -kOperatorLessThanEqualTo = FOUR_CHAR_CODE('<= ') -kOperatorEqualTo = FOUR_CHAR_CODE('= ') -kOperatorNotEqualTo = FOUR_CHAR_CODE('!= ') -kOperatorGreaterThan = FOUR_CHAR_CODE('> ') -kOperatorGreaterThanEqualTo = FOUR_CHAR_CODE('>= ') -kOperatorModulo = FOUR_CHAR_CODE('mod ') -kOperatorIntegerDivide = FOUR_CHAR_CODE('idiv') -kOperatorAbsoluteValue = FOUR_CHAR_CODE('abs ') -kOperatorNegate = FOUR_CHAR_CODE('neg ') -kPlatformMacintosh = 1 -kPlatformWindows = 2 -kSystemIsWindows9x = 0x00010000 -kSystemIsWindowsNT = 0x00020000 -kMediaPropertyNonLinearAtomType = FOUR_CHAR_CODE('nonl') -kMediaPropertyHasActions = 105 -loopTimeBase = 1 -palindromeLoopTimeBase = 2 -maintainTimeBaseZero = 4 -triggerTimeFwd = 0x0001 -triggerTimeBwd = 0x0002 -triggerTimeEither = 0x0003 -triggerRateLT = 0x0004 -triggerRateGT = 0x0008 -triggerRateEqual = 0x0010 -triggerRateLTE = triggerRateLT | triggerRateEqual -triggerRateGTE = triggerRateGT | triggerRateEqual -triggerRateNotEqual = triggerRateGT | triggerRateEqual | triggerRateLT -triggerRateChange = 0 -triggerAtStart = 0x0001 -triggerAtStop = 0x0002 -timeBaseBeforeStartTime = 1 -timeBaseAfterStopTime = 2 -callBackAtTime = 1 -callBackAtRate = 2 -callBackAtTimeJump = 3 -callBackAtExtremes = 4 -callBackAtTimeBaseDisposed = 5 -callBackAtInterrupt = 0x8000 -callBackAtDeferredTask = 0x4000 -qtcbNeedsRateChanges = 1 -qtcbNeedsTimeChanges = 2 -qtcbNeedsStartStopChanges = 4 -keepInRam = 1 << 0 -unkeepInRam = 1 << 1 -flushFromRam = 1 << 2 -loadForwardTrackEdits = 1 << 3 -loadBackwardTrackEdits = 1 << 4 -newMovieActive = 1 << 0 -newMovieDontResolveDataRefs = 1 << 1 -newMovieDontAskUnresolvedDataRefs = 1 << 2 -newMovieDontAutoAlternates = 1 << 3 -newMovieDontUpdateForeBackPointers = 1 << 4 -newMovieDontAutoUpdateClock = 1 << 5 -newMovieAsyncOK = 1 << 8 -newMovieIdleImportOK = 1 << 10 -newMovieDontInteractWithUser = 1 << 11 -trackUsageInMovie = 1 << 1 -trackUsageInPreview = 1 << 2 -trackUsageInPoster = 1 << 3 -mediaSampleNotSync = 1 << 0 -mediaSampleShadowSync = 1 << 1 -pasteInParallel = 1 << 0 -showUserSettingsDialog = 1 << 1 -movieToFileOnlyExport = 1 << 2 -movieFileSpecValid = 1 << 3 -nextTimeMediaSample = 1 << 0 -nextTimeMediaEdit = 1 << 1 -nextTimeTrackEdit = 1 << 2 -nextTimeSyncSample = 1 << 3 -nextTimeStep = 1 << 4 -nextTimeEdgeOK = 1 << 14 -nextTimeIgnoreActiveSegment = 1 << 15 -createMovieFileDeleteCurFile = 1L << 31 -createMovieFileDontCreateMovie = 1L << 30 -createMovieFileDontOpenFile = 1L << 29 -createMovieFileDontCreateResFile = 1L << 28 -flattenAddMovieToDataFork = 1L << 0 -flattenActiveTracksOnly = 1L << 2 -flattenDontInterleaveFlatten = 1L << 3 -flattenFSSpecPtrIsDataRefRecordPtr = 1L << 4 -flattenCompressMovieResource = 1L << 5 -flattenForceMovieResourceBeforeMovieData = 1L << 6 -movieInDataForkResID = -1 -mcTopLeftMovie = 1 << 0 -mcScaleMovieToFit = 1 << 1 -mcWithBadge = 1 << 2 -mcNotVisible = 1 << 3 -mcWithFrame = 1 << 4 -movieScrapDontZeroScrap = 1 << 0 -movieScrapOnlyPutMovie = 1 << 1 -dataRefSelfReference = 1 << 0 -dataRefWasNotResolved = 1 << 1 -kMovieAnchorDataRefIsDefault = 1 << 0 -hintsScrubMode = 1 << 0 -hintsLoop = 1 << 1 -hintsDontPurge = 1 << 2 -hintsUseScreenBuffer = 1 << 5 -hintsAllowInterlace = 1 << 6 -hintsUseSoundInterp = 1 << 7 -hintsHighQuality = 1 << 8 -hintsPalindrome = 1 << 9 -hintsInactive = 1 << 11 -hintsOffscreen = 1 << 12 -hintsDontDraw = 1 << 13 -hintsAllowBlacklining = 1 << 14 -hintsDontUseVideoOverlaySurface = 1 << 16 -hintsIgnoreBandwidthRestrictions = 1 << 17 -hintsPlayingEveryFrame = 1 << 18 -hintsAllowDynamicResize = 1 << 19 -hintsSingleField = 1 << 20 -hintsNoRenderingTimeOut = 1 << 21 -hintsFlushVideoInsteadOfDirtying = 1 << 22 -hintsEnableSubPixelPositioning = 1L << 23 -mediaHandlerFlagBaseClient = 1 -movieTrackMediaType = 1 << 0 -movieTrackCharacteristic = 1 << 1 -movieTrackEnabledOnly = 1 << 2 -kMovieControlOptionHideController = (1L << 0) -kMovieControlOptionLocateTopLeft = (1L << 1) -kMovieControlOptionEnableEditing = (1L << 2) -kMovieControlOptionHandleEditingHI = (1L << 3) -kMovieControlOptionSetKeysEnabled = (1L << 4) -kMovieControlOptionManuallyIdled = (1L << 5) -kMovieControlDataMovieController = FOUR_CHAR_CODE('mc ') -kMovieControlDataMovie = FOUR_CHAR_CODE('moov') -kMovieControlDataManualIdling = FOUR_CHAR_CODE('manu') -movieDrawingCallWhenChanged = 0 -movieDrawingCallAlways = 1 -kQTCloneShareSamples = 1 << 0 -kQTCloneDontCopyEdits = 1 << 1 -kGetMovieImporterValidateToFind = 1L << 0 -kGetMovieImporterAllowNewFile = 1L << 1 -kGetMovieImporterDontConsiderGraphicsImporters = 1L << 2 -kGetMovieImporterDontConsiderFileOnlyImporters = 1L << 6 -kGetMovieImporterAutoImportOnly = 1L << 10 -kQTGetMIMETypeInfoIsQuickTimeMovieType = FOUR_CHAR_CODE('moov') -kQTGetMIMETypeInfoIsUnhelpfulType = FOUR_CHAR_CODE('dumb') -kQTCopyUserDataReplace = FOUR_CHAR_CODE('rplc') -kQTCopyUserDataMerge = FOUR_CHAR_CODE('merg') -kMovieLoadStateError = -1L -kMovieLoadStateLoading = 1000 -kMovieLoadStateLoaded = 2000 -kMovieLoadStatePlayable = 10000 -kMovieLoadStatePlaythroughOK = 20000 -kMovieLoadStateComplete = 100000L -kQTDontUseDataToFindImporter = 1L << 0 -kQTDontLookForMovieImporterIfGraphicsImporterFound = 1L << 1 -kQTAllowOpeningStillImagesAsMovies = 1L << 2 -kQTAllowImportersThatWouldCreateNewFile = 1L << 3 -kQTAllowAggressiveImporters = 1L << 4 -preloadAlways = 1L << 0 -preloadOnlyIfEnabled = 1L << 1 -fullScreenHideCursor = 1L << 0 -fullScreenAllowEvents = 1L << 1 -fullScreenDontChangeMenuBar = 1L << 2 -fullScreenPreflightSize = 1L << 3 -movieExecuteWiredActionDontExecute = 1L << 0 -kRefConNavigationNext = 0 -kRefConNavigationPrevious = 1 -kRefConPropertyCanHaveFocus = 1 -kRefConPropertyHasFocus = 2 -kTrackFocusCanEditFlag = FOUR_CHAR_CODE('kedt') -kTrackDefaultFocusFlags = FOUR_CHAR_CODE('kfoc') -kTrackFocusDefaultRefcon = FOUR_CHAR_CODE('kref') -kTrackFocusOn = 1 -kTrackHandlesTabs = 2 -kFlashTrackPropertyAcceptAllClicks = FOUR_CHAR_CODE('clik') -kBackgroundSpriteLayerNum = 32767 -kSpritePropertyMatrix = 1 -kSpritePropertyImageDescription = 2 -kSpritePropertyImageDataPtr = 3 -kSpritePropertyVisible = 4 -kSpritePropertyLayer = 5 -kSpritePropertyGraphicsMode = 6 -kSpritePropertyImageDataSize = 7 -kSpritePropertyActionHandlingSpriteID = 8 -kSpritePropertyCanBeHitTested = 9 -kSpritePropertyImageIndex = 100 -kSpriteTrackPropertyBackgroundColor = 101 -kSpriteTrackPropertyOffscreenBitDepth = 102 -kSpriteTrackPropertySampleFormat = 103 -kSpriteTrackPropertyScaleSpritesToScaleWorld = 104 -kSpriteTrackPropertyHasActions = 105 -kSpriteTrackPropertyVisible = 106 -kSpriteTrackPropertyQTIdleEventsFrequency = 107 -kSpriteTrackPropertyAllSpritesHitTestingMode = 108 -kSpriteTrackPropertyPreferredDepthInterpretationMode = 109 -kSpriteImagePropertyRegistrationPoint = 1000 -kSpriteImagePropertyGroupID = 1001 -kSpriteTrackPreferredDepthCompatibilityMode = 0 -kSpriteTrackPreferredDepthModernMode = 1 -kSpriteHitTestUseSpritesOwnPropertiesMode = 0 -kSpriteHitTestTreatAllSpritesAsHitTestableMode = 1 -kSpriteHitTestTreatAllSpritesAsNotHitTestableMode = 2 -kNoQTIdleEvents = -1 -kGetSpriteWorldInvalidRegionAndLeaveIntact = -1L -kGetSpriteWorldInvalidRegionAndThenSetEmpty = -2L -kOnlyDrawToSpriteWorld = 1L << 0 -kSpriteWorldPreflight = 1L << 1 -kSpriteWorldDidDraw = 1L << 0 -kSpriteWorldNeedsToDraw = 1L << 1 -kKeyFrameAndSingleOverride = 1L << 1 -kKeyFrameAndAllOverrides = 1L << 2 -kScaleSpritesToScaleWorld = 1L << 1 -kSpriteWorldHighQuality = 1L << 2 -kSpriteWorldDontAutoInvalidate = 1L << 3 -kSpriteWorldInvisible = 1L << 4 -kSpriteWorldDirtyInsteadOfFlush = 1L << 5 -kParentAtomIsContainer = 0 -kTweenRecordNoFlags = 0 -kTweenRecordIsAtInterruptTime = 0x00000001 -kEffectNameAtom = FOUR_CHAR_CODE('name') -kEffectTypeAtom = FOUR_CHAR_CODE('type') -kEffectManufacturerAtom = FOUR_CHAR_CODE('manu') -pdActionConfirmDialog = 1 -pdActionSetAppleMenu = 2 -pdActionSetEditMenu = 3 -pdActionGetDialogValues = 4 -pdActionSetPreviewUserItem = 5 -pdActionSetPreviewPicture = 6 -pdActionSetColorPickerEventProc = 7 -pdActionSetDialogTitle = 8 -pdActionGetSubPanelMenu = 9 -pdActionActivateSubPanel = 10 -pdActionConductStopAlert = 11 -pdActionModelessCallback = 12 -pdActionFetchPreview = 13 -pdActionSetDialogSettings = 14 -pdActionGetDialogSettings = 15 -pdActionGetNextSample = 16 -pdActionGetPreviousSample = 17 -pdActionCompactSample = 18 -pdActionSetEditCallout = 19 -pdActionSetSampleTime = 20 -pdActionDoEditCommand = 21 -pdActionGetSubPanelMenuValue = 22 -pdActionCustomNewControl = 23 -pdActionCustomDisposeControl = 24 -pdActionCustomPositionControl = 25 -pdActionCustomShowHideControl = 26 -pdActionCustomHandleEvent = 27 -pdActionCustomSetFocus = 28 -pdActionCustomSetEditMenu = 29 -pdActionCustomSetPreviewPicture = 30 -pdActionCustomSetEditCallout = 31 -pdActionCustomGetEnableValue = 32 -pdActionCustomSetSampleTime = 33 -pdActionCustomGetValue = 34 -pdActionCustomDoEditCommand = 35 -pdSampleTimeDisplayOptionsNone = 0x00000000 -pdActionFocusOff = 0 -pdActionFocusFirst = 1 -pdActionFocusLast = 2 -pdActionFocusForward = 3 -pdActionFocusBackward = 4 -elOptionsIncludeNoneInList = 0x00000001 -pdOptionsCollectOneValue = 0x00000001 -pdOptionsAllowOptionalInterpolations = 0x00000002 -pdOptionsModalDialogBox = 0x00000004 -pdOptionsEditCurrentEffectOnly = 0x00000008 -pdOptionsHidePreview = 0x00000010 -effectIsRealtime = 0 -kAccessKeyAtomType = FOUR_CHAR_CODE('acky') -kAccessKeySystemFlag = 1L << 0 -ConnectionSpeedPrefsType = FOUR_CHAR_CODE('cspd') -BandwidthManagementPrefsType = FOUR_CHAR_CODE('bwmg') -kQTIdlePriority = 10 -kQTNonRealTimePriority = 20 -kQTRealTimeSharedPriority = 25 -kQTRealTimePriority = 30 -kQTBandwidthNotifyNeedToStop = 1L << 0 -kQTBandwidthNotifyGoodToGo = 1L << 1 -kQTBandwidthChangeRequest = 1L << 2 -kQTBandwidthQueueRequest = 1L << 3 -kQTBandwidthScheduledRequest = 1L << 4 -kQTBandwidthVoluntaryRelease = 1L << 5 -kITextRemoveEverythingBut = 0 << 1 -kITextRemoveLeaveSuggestedAlternate = 1 << 1 -kITextAtomType = FOUR_CHAR_CODE('itxt') -kITextStringAtomType = FOUR_CHAR_CODE('text') -kQTParseTextHREFText = FOUR_CHAR_CODE('text') -kQTParseTextHREFBaseURL = FOUR_CHAR_CODE('burl') -kQTParseTextHREFClickPoint = FOUR_CHAR_CODE('clik') -kQTParseTextHREFUseAltDelim = FOUR_CHAR_CODE('altd') -kQTParseTextHREFDelimiter = FOUR_CHAR_CODE('delm') -kQTParseTextHREFRecomposeHREF = FOUR_CHAR_CODE('rhrf') -kQTParseTextHREFURL = FOUR_CHAR_CODE('url ') -kQTParseTextHREFTarget = FOUR_CHAR_CODE('targ') -kQTParseTextHREFChapter = FOUR_CHAR_CODE('chap') -kQTParseTextHREFIsAutoHREF = FOUR_CHAR_CODE('auto') -kQTParseTextHREFIsServerMap = FOUR_CHAR_CODE('smap') -kQTParseTextHREFHREF = FOUR_CHAR_CODE('href') -kQTParseTextHREFEMBEDArgs = FOUR_CHAR_CODE('mbed') -kTrackReferenceChapterList = FOUR_CHAR_CODE('chap') -kTrackReferenceTimeCode = FOUR_CHAR_CODE('tmcd') -kTrackReferenceModifier = FOUR_CHAR_CODE('ssrc') -kTrackModifierInput = 0x696E -kTrackModifierType = 0x7479 -kTrackModifierReference = FOUR_CHAR_CODE('ssrc') -kTrackModifierObjectID = FOUR_CHAR_CODE('obid') -kTrackModifierInputName = FOUR_CHAR_CODE('name') -kInputMapSubInputID = FOUR_CHAR_CODE('subi') -kTrackModifierTypeMatrix = 1 -kTrackModifierTypeClip = 2 -kTrackModifierTypeGraphicsMode = 5 -kTrackModifierTypeVolume = 3 -kTrackModifierTypeBalance = 4 -kTrackModifierTypeImage = FOUR_CHAR_CODE('vide') -kTrackModifierObjectMatrix = 6 -kTrackModifierObjectGraphicsMode = 7 -kTrackModifierType3d4x4Matrix = 8 -kTrackModifierCameraData = 9 -kTrackModifierSoundLocalizationData = 10 -kTrackModifierObjectImageIndex = 11 -kTrackModifierObjectLayer = 12 -kTrackModifierObjectVisible = 13 -kTrackModifierAngleAspectCamera = 14 -kTrackModifierPanAngle = FOUR_CHAR_CODE('pan ') -kTrackModifierTiltAngle = FOUR_CHAR_CODE('tilt') -kTrackModifierVerticalFieldOfViewAngle = FOUR_CHAR_CODE('fov ') -kTrackModifierObjectQTEventSend = FOUR_CHAR_CODE('evnt') -kTrackModifierObjectCanBeHitTested = 15 -kTweenTypeShort = 1 -kTweenTypeLong = 2 -kTweenTypeFixed = 3 -kTweenTypePoint = 4 -kTweenTypeQDRect = 5 -kTweenTypeQDRegion = 6 -kTweenTypeMatrix = 7 -kTweenTypeRGBColor = 8 -kTweenTypeGraphicsModeWithRGBColor = 9 -kTweenTypeQTFloatSingle = 10 -kTweenTypeQTFloatDouble = 11 -kTweenTypeFixedPoint = 12 -kTweenType3dScale = FOUR_CHAR_CODE('3sca') -kTweenType3dTranslate = FOUR_CHAR_CODE('3tra') -kTweenType3dRotate = FOUR_CHAR_CODE('3rot') -kTweenType3dRotateAboutPoint = FOUR_CHAR_CODE('3rap') -kTweenType3dRotateAboutAxis = FOUR_CHAR_CODE('3rax') -kTweenType3dRotateAboutVector = FOUR_CHAR_CODE('3rvc') -kTweenType3dQuaternion = FOUR_CHAR_CODE('3qua') -kTweenType3dMatrix = FOUR_CHAR_CODE('3mat') -kTweenType3dCameraData = FOUR_CHAR_CODE('3cam') -kTweenType3dAngleAspectCameraData = FOUR_CHAR_CODE('3caa') -kTweenType3dSoundLocalizationData = FOUR_CHAR_CODE('3slc') -kTweenTypePathToMatrixTranslation = FOUR_CHAR_CODE('gxmt') -kTweenTypePathToMatrixRotation = FOUR_CHAR_CODE('gxpr') -kTweenTypePathToMatrixTranslationAndRotation = FOUR_CHAR_CODE('gxmr') -kTweenTypePathToFixedPoint = FOUR_CHAR_CODE('gxfp') -kTweenTypePathXtoY = FOUR_CHAR_CODE('gxxy') -kTweenTypePathYtoX = FOUR_CHAR_CODE('gxyx') -kTweenTypeAtomList = FOUR_CHAR_CODE('atom') -kTweenTypePolygon = FOUR_CHAR_CODE('poly') -kTweenTypeMultiMatrix = FOUR_CHAR_CODE('mulm') -kTweenTypeSpin = FOUR_CHAR_CODE('spin') -kTweenType3dMatrixNonLinear = FOUR_CHAR_CODE('3nlr') -kTweenType3dVRObject = FOUR_CHAR_CODE('3vro') -kTweenEntry = FOUR_CHAR_CODE('twen') -kTweenData = FOUR_CHAR_CODE('data') -kTweenType = FOUR_CHAR_CODE('twnt') -kTweenStartOffset = FOUR_CHAR_CODE('twst') -kTweenDuration = FOUR_CHAR_CODE('twdu') -kTweenFlags = FOUR_CHAR_CODE('flag') -kTweenOutputMin = FOUR_CHAR_CODE('omin') -kTweenOutputMax = FOUR_CHAR_CODE('omax') -kTweenSequenceElement = FOUR_CHAR_CODE('seqe') -kTween3dInitialCondition = FOUR_CHAR_CODE('icnd') -kTweenInterpolationID = FOUR_CHAR_CODE('intr') -kTweenRegionData = FOUR_CHAR_CODE('qdrg') -kTweenPictureData = FOUR_CHAR_CODE('PICT') -kListElementType = FOUR_CHAR_CODE('type') -kListElementDataType = FOUR_CHAR_CODE('daty') -kNameAtom = FOUR_CHAR_CODE('name') -kInitialRotationAtom = FOUR_CHAR_CODE('inro') -kNonLinearTweenHeader = FOUR_CHAR_CODE('nlth') -kTweenReturnDelta = 1L << 0 -kQTRestrictionClassSave = FOUR_CHAR_CODE('save') -kQTRestrictionSaveDontAddMovieResource = (1L << 0) -kQTRestrictionSaveDontFlatten = (1L << 1) -kQTRestrictionSaveDontExport = (1L << 2) -kQTRestrictionSaveDontExtract = (1L << 3) -kQTRestrictionClassEdit = FOUR_CHAR_CODE('edit') -kQTRestrictionEditDontCopy = (1L << 0) -kQTRestrictionEditDontCut = (1L << 1) -kQTRestrictionEditDontPaste = (1L << 2) -kQTRestrictionEditDontClear = (1L << 3) -kQTRestrictionEditDontModify = (1L << 4) -kQTRestrictionEditDontExtract = (1L << 5) -videoFlagDontLeanAhead = 1L << 0 -txtProcDefaultDisplay = 0 -txtProcDontDisplay = 1 -txtProcDoDisplay = 2 -findTextEdgeOK = 1 << 0 -findTextCaseSensitive = 1 << 1 -findTextReverseSearch = 1 << 2 -findTextWrapAround = 1 << 3 -findTextUseOffset = 1 << 4 -dropShadowOffsetType = FOUR_CHAR_CODE('drpo') -dropShadowTranslucencyType = FOUR_CHAR_CODE('drpt') -spriteHitTestBounds = 1L << 0 -spriteHitTestImage = 1L << 1 -spriteHitTestInvisibleSprites = 1L << 2 -spriteHitTestIsClick = 1L << 3 -spriteHitTestLocInDisplayCoordinates = 1L << 4 -spriteHitTestTreatAllSpritesAsHitTestable = 1L << 5 -kSpriteAtomType = FOUR_CHAR_CODE('sprt') -kSpriteImagesContainerAtomType = FOUR_CHAR_CODE('imct') -kSpriteImageAtomType = FOUR_CHAR_CODE('imag') -kSpriteImageDataAtomType = FOUR_CHAR_CODE('imda') -kSpriteImageDataRefAtomType = FOUR_CHAR_CODE('imre') -kSpriteImageDataRefTypeAtomType = FOUR_CHAR_CODE('imrt') -kSpriteImageGroupIDAtomType = FOUR_CHAR_CODE('imgr') -kSpriteImageRegistrationAtomType = FOUR_CHAR_CODE('imrg') -kSpriteImageDefaultImageIndexAtomType = FOUR_CHAR_CODE('defi') -kSpriteSharedDataAtomType = FOUR_CHAR_CODE('dflt') -kSpriteNameAtomType = FOUR_CHAR_CODE('name') -kSpriteImageNameAtomType = FOUR_CHAR_CODE('name') -kSpriteUsesImageIDsAtomType = FOUR_CHAR_CODE('uses') -kSpriteBehaviorsAtomType = FOUR_CHAR_CODE('beha') -kSpriteImageBehaviorAtomType = FOUR_CHAR_CODE('imag') -kSpriteCursorBehaviorAtomType = FOUR_CHAR_CODE('crsr') -kSpriteStatusStringsBehaviorAtomType = FOUR_CHAR_CODE('sstr') -kSpriteVariablesContainerAtomType = FOUR_CHAR_CODE('vars') -kSpriteStringVariableAtomType = FOUR_CHAR_CODE('strv') -kSpriteFloatingPointVariableAtomType = FOUR_CHAR_CODE('flov') -kMovieMediaDataReference = FOUR_CHAR_CODE('mmdr') -kMovieMediaDefaultDataReferenceID = FOUR_CHAR_CODE('ddri') -kMovieMediaSlaveTime = FOUR_CHAR_CODE('slti') -kMovieMediaSlaveAudio = FOUR_CHAR_CODE('slau') -kMovieMediaSlaveGraphicsMode = FOUR_CHAR_CODE('slgr') -kMovieMediaAutoPlay = FOUR_CHAR_CODE('play') -kMovieMediaLoop = FOUR_CHAR_CODE('loop') -kMovieMediaUseMIMEType = FOUR_CHAR_CODE('mime') -kMovieMediaTitle = FOUR_CHAR_CODE('titl') -kMovieMediaAltText = FOUR_CHAR_CODE('altt') -kMovieMediaClipBegin = FOUR_CHAR_CODE('clpb') -kMovieMediaClipDuration = FOUR_CHAR_CODE('clpd') -kMovieMediaRegionAtom = FOUR_CHAR_CODE('regi') -kMovieMediaSlaveTrackDuration = FOUR_CHAR_CODE('sltr') -kMovieMediaEnableFrameStepping = FOUR_CHAR_CODE('enfs') -kMovieMediaBackgroundColor = FOUR_CHAR_CODE('bkcl') -kMovieMediaPrerollTime = FOUR_CHAR_CODE('prer') -kMovieMediaFitNone = 0 -kMovieMediaFitScroll = FOUR_CHAR_CODE('scro') -kMovieMediaFitClipIfNecessary = FOUR_CHAR_CODE('hidd') -kMovieMediaFitFill = FOUR_CHAR_CODE('fill') -kMovieMediaFitMeet = FOUR_CHAR_CODE('meet') -kMovieMediaFitSlice = FOUR_CHAR_CODE('slic') -kMovieMediaSpatialAdjustment = FOUR_CHAR_CODE('fit ') -kMovieMediaRectangleAtom = FOUR_CHAR_CODE('rect') -kMovieMediaTop = FOUR_CHAR_CODE('top ') -kMovieMediaLeft = FOUR_CHAR_CODE('left') -kMovieMediaWidth = FOUR_CHAR_CODE('wd ') -kMovieMediaHeight = FOUR_CHAR_CODE('ht ') -kMoviePropertyDuration = FOUR_CHAR_CODE('dura') -kMoviePropertyTimeScale = FOUR_CHAR_CODE('tims') -kMoviePropertyTime = FOUR_CHAR_CODE('timv') -kMoviePropertyNaturalBounds = FOUR_CHAR_CODE('natb') -kMoviePropertyMatrix = FOUR_CHAR_CODE('mtrx') -kMoviePropertyTrackList = FOUR_CHAR_CODE('tlst') -kTrackPropertyMediaType = FOUR_CHAR_CODE('mtyp') -kTrackPropertyInstantiation = FOUR_CHAR_CODE('inst') -MovieControllerComponentType = FOUR_CHAR_CODE('play') -kMovieControllerQTVRFlag = 1 << 0 -kMovieControllerDontDisplayToUser = 1 << 1 -mcActionIdle = 1 -mcActionDraw = 2 -mcActionActivate = 3 -mcActionDeactivate = 4 -mcActionMouseDown = 5 -mcActionKey = 6 -mcActionPlay = 8 -mcActionGoToTime = 12 -mcActionSetVolume = 14 -mcActionGetVolume = 15 -mcActionStep = 18 -mcActionSetLooping = 21 -mcActionGetLooping = 22 -mcActionSetLoopIsPalindrome = 23 -mcActionGetLoopIsPalindrome = 24 -mcActionSetGrowBoxBounds = 25 -mcActionControllerSizeChanged = 26 -mcActionSetSelectionBegin = 29 -mcActionSetSelectionDuration = 30 -mcActionSetKeysEnabled = 32 -mcActionGetKeysEnabled = 33 -mcActionSetPlaySelection = 34 -mcActionGetPlaySelection = 35 -mcActionSetUseBadge = 36 -mcActionGetUseBadge = 37 -mcActionSetFlags = 38 -mcActionGetFlags = 39 -mcActionSetPlayEveryFrame = 40 -mcActionGetPlayEveryFrame = 41 -mcActionGetPlayRate = 42 -mcActionShowBalloon = 43 -mcActionBadgeClick = 44 -mcActionMovieClick = 45 -mcActionSuspend = 46 -mcActionResume = 47 -mcActionSetControllerKeysEnabled = 48 -mcActionGetTimeSliderRect = 49 -mcActionMovieEdited = 50 -mcActionGetDragEnabled = 51 -mcActionSetDragEnabled = 52 -mcActionGetSelectionBegin = 53 -mcActionGetSelectionDuration = 54 -mcActionPrerollAndPlay = 55 -mcActionGetCursorSettingEnabled = 56 -mcActionSetCursorSettingEnabled = 57 -mcActionSetColorTable = 58 -mcActionLinkToURL = 59 -mcActionCustomButtonClick = 60 -mcActionForceTimeTableUpdate = 61 -mcActionSetControllerTimeLimits = 62 -mcActionExecuteAllActionsForQTEvent = 63 -mcActionExecuteOneActionForQTEvent = 64 -mcActionAdjustCursor = 65 -mcActionUseTrackForTimeTable = 66 -mcActionClickAndHoldPoint = 67 -mcActionShowMessageString = 68 -mcActionShowStatusString = 69 -mcActionGetExternalMovie = 70 -mcActionGetChapterTime = 71 -mcActionPerformActionList = 72 -mcActionEvaluateExpression = 73 -mcActionFetchParameterAs = 74 -mcActionGetCursorByID = 75 -mcActionGetNextURL = 76 -mcActionMovieChanged = 77 -mcActionDoScript = 78 -mcActionRestartAtTime = 79 -mcActionGetIndChapter = 80 -mcActionLinkToURLExtended = 81 -mcActionSetVolumeStep = 82 -mcActionAutoPlay = 83 -mcActionPauseToBuffer = 84 -mcActionAppMessageReceived = 85 -mcActionEvaluateExpressionWithType = 89 -mcActionGetMovieName = 90 -mcActionGetMovieID = 91 -mcActionGetMovieActive = 92 -mcFlagSuppressMovieFrame = 1 << 0 -mcFlagSuppressStepButtons = 1 << 1 -mcFlagSuppressSpeakerButton = 1 << 2 -mcFlagsUseWindowPalette = 1 << 3 -mcFlagsDontInvalidate = 1 << 4 -mcFlagsUseCustomButton = 1 << 5 -mcPositionDontInvalidate = 1 << 5 -kMCIEEnabledButtonPicture = 1 -kMCIEDisabledButtonPicture = 2 -kMCIEDepressedButtonPicture = 3 -kMCIEEnabledSizeBoxPicture = 4 -kMCIEDisabledSizeBoxPicture = 5 -kMCIEEnabledUnavailableButtonPicture = 6 -kMCIEDisabledUnavailableButtonPicture = 7 -kMCIESoundSlider = 128 -kMCIESoundThumb = 129 -kMCIEColorTable = 256 -kMCIEIsFlatAppearance = 257 -kMCIEDoButtonIconsDropOnDepress = 258 -mcInfoUndoAvailable = 1 << 0 -mcInfoCutAvailable = 1 << 1 -mcInfoCopyAvailable = 1 << 2 -mcInfoPasteAvailable = 1 << 3 -mcInfoClearAvailable = 1 << 4 -mcInfoHasSound = 1 << 5 -mcInfoIsPlaying = 1 << 6 -mcInfoIsLooping = 1 << 7 -mcInfoIsInPalindrome = 1 << 8 -mcInfoEditingEnabled = 1 << 9 -mcInfoMovieIsInteractive = 1 << 10 -mcMenuUndo = 1 -mcMenuCut = 3 -mcMenuCopy = 4 -mcMenuPaste = 5 -mcMenuClear = 6 -kQTAppMessageSoftwareChanged = 1 -kQTAppMessageWindowCloseRequested = 3 -kQTAppMessageExitFullScreenRequested = 4 -kQTAppMessageDisplayChannels = 5 -kQTAppMessageEnterFullScreenRequested = 6 -kFetchAsBooleanPtr = 1 -kFetchAsShortPtr = 2 -kFetchAsLongPtr = 3 -kFetchAsMatrixRecordPtr = 4 -kFetchAsModifierTrackGraphicsModeRecord = 5 -kFetchAsHandle = 6 -kFetchAsStr255 = 7 -kFetchAsFloatPtr = 8 -kFetchAsPointPtr = 9 -kFetchAsNewAtomContainer = 10 -kFetchAsQTEventRecordPtr = 11 -kFetchAsFixedPtr = 12 -kFetchAsSetControllerValuePtr = 13 -kFetchAsRgnHandle = 14 -kFetchAsComponentDescriptionPtr = 15 -kFetchAsCString = 16 -kQTCursorOpenHand = -19183 -kQTCursorClosedHand = -19182 -kQTCursorPointingHand = -19181 -kQTCursorRightArrow = -19180 -kQTCursorLeftArrow = -19179 -kQTCursorDownArrow = -19178 -kQTCursorUpArrow = -19177 -kQTCursorIBeam = -19176 -kControllerUnderstandsIdleManagers = 1 << 0 -kVideoMediaResetStatisticsSelect = 0x0105 -kVideoMediaGetStatisticsSelect = 0x0106 -kVideoMediaGetStallCountSelect = 0x010E -kVideoMediaSetCodecParameterSelect = 0x010F -kVideoMediaGetCodecParameterSelect = 0x0110 -kTextMediaSetTextProcSelect = 0x0101 -kTextMediaAddTextSampleSelect = 0x0102 -kTextMediaAddTESampleSelect = 0x0103 -kTextMediaAddHiliteSampleSelect = 0x0104 -kTextMediaDrawRawSelect = 0x0109 -kTextMediaSetTextPropertySelect = 0x010A -kTextMediaRawSetupSelect = 0x010B -kTextMediaRawIdleSelect = 0x010C -kTextMediaGetTextPropertySelect = 0x010D -kTextMediaFindNextTextSelect = 0x0105 -kTextMediaHiliteTextSampleSelect = 0x0106 -kTextMediaSetTextSampleDataSelect = 0x0107 -kSpriteMediaSetPropertySelect = 0x0101 -kSpriteMediaGetPropertySelect = 0x0102 -kSpriteMediaHitTestSpritesSelect = 0x0103 -kSpriteMediaCountSpritesSelect = 0x0104 -kSpriteMediaCountImagesSelect = 0x0105 -kSpriteMediaGetIndImageDescriptionSelect = 0x0106 -kSpriteMediaGetDisplayedSampleNumberSelect = 0x0107 -kSpriteMediaGetSpriteNameSelect = 0x0108 -kSpriteMediaGetImageNameSelect = 0x0109 -kSpriteMediaSetSpritePropertySelect = 0x010A -kSpriteMediaGetSpritePropertySelect = 0x010B -kSpriteMediaHitTestAllSpritesSelect = 0x010C -kSpriteMediaHitTestOneSpriteSelect = 0x010D -kSpriteMediaSpriteIndexToIDSelect = 0x010E -kSpriteMediaSpriteIDToIndexSelect = 0x010F -kSpriteMediaGetSpriteActionsForQTEventSelect = 0x0110 -kSpriteMediaSetActionVariableSelect = 0x0111 -kSpriteMediaGetActionVariableSelect = 0x0112 -kSpriteMediaGetIndImagePropertySelect = 0x0113 -kSpriteMediaNewSpriteSelect = 0x0114 -kSpriteMediaDisposeSpriteSelect = 0x0115 -kSpriteMediaSetActionVariableToStringSelect = 0x0116 -kSpriteMediaGetActionVariableAsStringSelect = 0x0117 -kSpriteMediaNewImageSelect = 0x011B -kSpriteMediaDisposeImageSelect = 0x011C -kSpriteMediaImageIndexToIDSelect = 0x011D -kSpriteMediaImageIDToIndexSelect = 0x011E -kFlashMediaSetPanSelect = 0x0101 -kFlashMediaSetZoomSelect = 0x0102 -kFlashMediaSetZoomRectSelect = 0x0103 -kFlashMediaGetRefConBoundsSelect = 0x0104 -kFlashMediaGetRefConIDSelect = 0x0105 -kFlashMediaIDToRefConSelect = 0x0106 -kFlashMediaGetDisplayedFrameNumberSelect = 0x0107 -kFlashMediaFrameNumberToMovieTimeSelect = 0x0108 -kFlashMediaFrameLabelToMovieTimeSelect = 0x0109 -kFlashMediaGetFlashVariableSelect = 0x010A -kFlashMediaSetFlashVariableSelect = 0x010B -kFlashMediaDoButtonActionsSelect = 0x010C -kFlashMediaGetSupportedSwfVersionSelect = 0x010D -kMovieMediaGetChildDoMCActionCallbackSelect = 0x0102 -kMovieMediaGetDoMCActionCallbackSelect = 0x0103 -kMovieMediaGetCurrentMoviePropertySelect = 0x0104 -kMovieMediaGetCurrentTrackPropertySelect = 0x0105 -kMovieMediaGetChildMovieDataReferenceSelect = 0x0106 -kMovieMediaSetChildMovieDataReferenceSelect = 0x0107 -kMovieMediaLoadChildMovieFromDataReferenceSelect = 0x0108 -kMedia3DGetNamedObjectListSelect = 0x0101 -kMedia3DGetRendererListSelect = 0x0102 -kMedia3DGetCurrentGroupSelect = 0x0103 -kMedia3DTranslateNamedObjectToSelect = 0x0104 -kMedia3DScaleNamedObjectToSelect = 0x0105 -kMedia3DRotateNamedObjectToSelect = 0x0106 -kMedia3DSetCameraDataSelect = 0x0107 -kMedia3DGetCameraDataSelect = 0x0108 -kMedia3DSetCameraAngleAspectSelect = 0x0109 -kMedia3DGetCameraAngleAspectSelect = 0x010A -kMedia3DSetCameraRangeSelect = 0x010D -kMedia3DGetCameraRangeSelect = 0x010E -kMedia3DGetViewObjectSelect = 0x010F -kMCSetMovieSelect = 0x0002 -kMCGetIndMovieSelect = 0x0005 -kMCRemoveAllMoviesSelect = 0x0006 -kMCRemoveAMovieSelect = 0x0003 -kMCRemoveMovieSelect = 0x0006 -kMCIsPlayerEventSelect = 0x0007 -kMCSetActionFilterSelect = 0x0008 -kMCDoActionSelect = 0x0009 -kMCSetControllerAttachedSelect = 0x000A -kMCIsControllerAttachedSelect = 0x000B -kMCSetControllerPortSelect = 0x000C -kMCGetControllerPortSelect = 0x000D -kMCSetVisibleSelect = 0x000E -kMCGetVisibleSelect = 0x000F -kMCGetControllerBoundsRectSelect = 0x0010 -kMCSetControllerBoundsRectSelect = 0x0011 -kMCGetControllerBoundsRgnSelect = 0x0012 -kMCGetWindowRgnSelect = 0x0013 -kMCMovieChangedSelect = 0x0014 -kMCSetDurationSelect = 0x0015 -kMCGetCurrentTimeSelect = 0x0016 -kMCNewAttachedControllerSelect = 0x0017 -kMCDrawSelect = 0x0018 -kMCActivateSelect = 0x0019 -kMCIdleSelect = 0x001A -kMCKeySelect = 0x001B -kMCClickSelect = 0x001C -kMCEnableEditingSelect = 0x001D -kMCIsEditingEnabledSelect = 0x001E -kMCCopySelect = 0x001F -kMCCutSelect = 0x0020 -kMCPasteSelect = 0x0021 -kMCClearSelect = 0x0022 -kMCUndoSelect = 0x0023 -kMCPositionControllerSelect = 0x0024 -kMCGetControllerInfoSelect = 0x0025 -kMCSetClipSelect = 0x0028 -kMCGetClipSelect = 0x0029 -kMCDrawBadgeSelect = 0x002A -kMCSetUpEditMenuSelect = 0x002B -kMCGetMenuStringSelect = 0x002C -kMCSetActionFilterWithRefConSelect = 0x002D -kMCPtInControllerSelect = 0x002E -kMCInvalidateSelect = 0x002F -kMCAdjustCursorSelect = 0x0030 -kMCGetInterfaceElementSelect = 0x0031 -kMCGetDoActionsProcSelect = 0x0032 -kMCAddMovieSegmentSelect = 0x0033 -kMCTrimMovieSegmentSelect = 0x0034 -kMCSetIdleManagerSelect = 0x0035 -kMCSetControllerCapabilitiesSelect = 0x0036 -kMusicMediaGetIndexedTunePlayerSelect = 0x0101 -kRawCodecType = FOUR_CHAR_CODE('raw ') -kCinepakCodecType = FOUR_CHAR_CODE('cvid') -kGraphicsCodecType = FOUR_CHAR_CODE('smc ') -kAnimationCodecType = FOUR_CHAR_CODE('rle ') -kVideoCodecType = FOUR_CHAR_CODE('rpza') -kComponentVideoCodecType = FOUR_CHAR_CODE('yuv2') -kJPEGCodecType = FOUR_CHAR_CODE('jpeg') -kMotionJPEGACodecType = FOUR_CHAR_CODE('mjpa') -kMotionJPEGBCodecType = FOUR_CHAR_CODE('mjpb') -kSGICodecType = FOUR_CHAR_CODE('.SGI') -kPlanarRGBCodecType = FOUR_CHAR_CODE('8BPS') -kMacPaintCodecType = FOUR_CHAR_CODE('PNTG') -kGIFCodecType = FOUR_CHAR_CODE('gif ') -kPhotoCDCodecType = FOUR_CHAR_CODE('kpcd') -kQuickDrawGXCodecType = FOUR_CHAR_CODE('qdgx') -kAVRJPEGCodecType = FOUR_CHAR_CODE('avr ') -kOpenDMLJPEGCodecType = FOUR_CHAR_CODE('dmb1') -kBMPCodecType = FOUR_CHAR_CODE('WRLE') -kWindowsRawCodecType = FOUR_CHAR_CODE('WRAW') -kVectorCodecType = FOUR_CHAR_CODE('path') -kQuickDrawCodecType = FOUR_CHAR_CODE('qdrw') -kWaterRippleCodecType = FOUR_CHAR_CODE('ripl') -kFireCodecType = FOUR_CHAR_CODE('fire') -kCloudCodecType = FOUR_CHAR_CODE('clou') -kH261CodecType = FOUR_CHAR_CODE('h261') -kH263CodecType = FOUR_CHAR_CODE('h263') -kDVCNTSCCodecType = FOUR_CHAR_CODE('dvc ') -kDVCPALCodecType = FOUR_CHAR_CODE('dvcp') -kDVCProPALCodecType = FOUR_CHAR_CODE('dvpp') -kBaseCodecType = FOUR_CHAR_CODE('base') -kFLCCodecType = FOUR_CHAR_CODE('flic') -kTargaCodecType = FOUR_CHAR_CODE('tga ') -kPNGCodecType = FOUR_CHAR_CODE('png ') -kTIFFCodecType = FOUR_CHAR_CODE('tiff') -kComponentVideoSigned = FOUR_CHAR_CODE('yuvu') -kComponentVideoUnsigned = FOUR_CHAR_CODE('yuvs') -kCMYKCodecType = FOUR_CHAR_CODE('cmyk') -kMicrosoftVideo1CodecType = FOUR_CHAR_CODE('msvc') -kSorensonCodecType = FOUR_CHAR_CODE('SVQ1') -kSorenson3CodecType = FOUR_CHAR_CODE('SVQ3') -kIndeo4CodecType = FOUR_CHAR_CODE('IV41') -kMPEG4VisualCodecType = FOUR_CHAR_CODE('mp4v') -k64ARGBCodecType = FOUR_CHAR_CODE('b64a') -k48RGBCodecType = FOUR_CHAR_CODE('b48r') -k32AlphaGrayCodecType = FOUR_CHAR_CODE('b32a') -k16GrayCodecType = FOUR_CHAR_CODE('b16g') -kMpegYUV420CodecType = FOUR_CHAR_CODE('myuv') -kYUV420CodecType = FOUR_CHAR_CODE('y420') -kSorensonYUV9CodecType = FOUR_CHAR_CODE('syv9') -k422YpCbCr8CodecType = FOUR_CHAR_CODE('2vuy') -k444YpCbCr8CodecType = FOUR_CHAR_CODE('v308') -k4444YpCbCrA8CodecType = FOUR_CHAR_CODE('v408') -k422YpCbCr16CodecType = FOUR_CHAR_CODE('v216') -k422YpCbCr10CodecType = FOUR_CHAR_CODE('v210') -k444YpCbCr10CodecType = FOUR_CHAR_CODE('v410') -k4444YpCbCrA8RCodecType = FOUR_CHAR_CODE('r408') -kBlurImageFilterType = FOUR_CHAR_CODE('blur') -kSharpenImageFilterType = FOUR_CHAR_CODE('shrp') -kEdgeDetectImageFilterType = FOUR_CHAR_CODE('edge') -kEmbossImageFilterType = FOUR_CHAR_CODE('embs') -kConvolveImageFilterType = FOUR_CHAR_CODE('genk') -kAlphaGainImageFilterType = FOUR_CHAR_CODE('gain') -kRGBColorBalanceImageFilterType = FOUR_CHAR_CODE('rgbb') -kHSLColorBalanceImageFilterType = FOUR_CHAR_CODE('hslb') -kColorSyncImageFilterType = FOUR_CHAR_CODE('sync') -kFilmNoiseImageFilterType = FOUR_CHAR_CODE('fmns') -kSolarizeImageFilterType = FOUR_CHAR_CODE('solr') -kColorTintImageFilterType = FOUR_CHAR_CODE('tint') -kLensFlareImageFilterType = FOUR_CHAR_CODE('lens') -kBrightnessContrastImageFilterType = FOUR_CHAR_CODE('brco') -kAlphaCompositorTransitionType = FOUR_CHAR_CODE('blnd') -kCrossFadeTransitionType = FOUR_CHAR_CODE('dslv') -kChannelCompositeEffectType = FOUR_CHAR_CODE('chan') -kChromaKeyTransitionType = FOUR_CHAR_CODE('ckey') -kImplodeTransitionType = FOUR_CHAR_CODE('mplo') -kExplodeTransitionType = FOUR_CHAR_CODE('xplo') -kGradientTransitionType = FOUR_CHAR_CODE('matt') -kPushTransitionType = FOUR_CHAR_CODE('push') -kSlideTransitionType = FOUR_CHAR_CODE('slid') -kWipeTransitionType = FOUR_CHAR_CODE('smpt') -kIrisTransitionType = FOUR_CHAR_CODE('smp2') -kRadialTransitionType = FOUR_CHAR_CODE('smp3') -kMatrixTransitionType = FOUR_CHAR_CODE('smp4') -kZoomTransitionType = FOUR_CHAR_CODE('zoom') -kTravellingMatteEffectType = FOUR_CHAR_CODE('trav') -kCMYKPixelFormat = FOUR_CHAR_CODE('cmyk') -k64ARGBPixelFormat = FOUR_CHAR_CODE('b64a') -k48RGBPixelFormat = FOUR_CHAR_CODE('b48r') -k32AlphaGrayPixelFormat = FOUR_CHAR_CODE('b32a') -k16GrayPixelFormat = FOUR_CHAR_CODE('b16g') -k422YpCbCr8PixelFormat = FOUR_CHAR_CODE('2vuy') -k4444YpCbCrA8PixelFormat = FOUR_CHAR_CODE('v408') -k4444YpCbCrA8RPixelFormat = FOUR_CHAR_CODE('r408') -kYUV420PixelFormat = FOUR_CHAR_CODE('y420') -codecInfoDoes1 = (1L << 0) -codecInfoDoes2 = (1L << 1) -codecInfoDoes4 = (1L << 2) -codecInfoDoes8 = (1L << 3) -codecInfoDoes16 = (1L << 4) -codecInfoDoes32 = (1L << 5) -codecInfoDoesDither = (1L << 6) -codecInfoDoesStretch = (1L << 7) -codecInfoDoesShrink = (1L << 8) -codecInfoDoesMask = (1L << 9) -codecInfoDoesTemporal = (1L << 10) -codecInfoDoesDouble = (1L << 11) -codecInfoDoesQuad = (1L << 12) -codecInfoDoesHalf = (1L << 13) -codecInfoDoesQuarter = (1L << 14) -codecInfoDoesRotate = (1L << 15) -codecInfoDoesHorizFlip = (1L << 16) -codecInfoDoesVertFlip = (1L << 17) -codecInfoHasEffectParameterList = (1L << 18) -codecInfoDoesBlend = (1L << 19) -codecInfoDoesWarp = (1L << 20) -codecInfoDoesRecompress = (1L << 21) -codecInfoDoesSpool = (1L << 22) -codecInfoDoesRateConstrain = (1L << 23) -codecInfoDepth1 = (1L << 0) -codecInfoDepth2 = (1L << 1) -codecInfoDepth4 = (1L << 2) -codecInfoDepth8 = (1L << 3) -codecInfoDepth16 = (1L << 4) -codecInfoDepth32 = (1L << 5) -codecInfoDepth24 = (1L << 6) -codecInfoDepth33 = (1L << 7) -codecInfoDepth34 = (1L << 8) -codecInfoDepth36 = (1L << 9) -codecInfoDepth40 = (1L << 10) -codecInfoStoresClut = (1L << 11) -codecInfoDoesLossless = (1L << 12) -codecInfoSequenceSensitive = (1L << 13) -codecFlagUseImageBuffer = (1L << 0) -codecFlagUseScreenBuffer = (1L << 1) -codecFlagUpdatePrevious = (1L << 2) -codecFlagNoScreenUpdate = (1L << 3) -codecFlagWasCompressed = (1L << 4) -codecFlagDontOffscreen = (1L << 5) -codecFlagUpdatePreviousComp = (1L << 6) -codecFlagForceKeyFrame = (1L << 7) -codecFlagOnlyScreenUpdate = (1L << 8) -codecFlagLiveGrab = (1L << 9) -codecFlagDiffFrame = (1L << 9) -codecFlagDontUseNewImageBuffer = (1L << 10) -codecFlagInterlaceUpdate = (1L << 11) -codecFlagCatchUpDiff = (1L << 12) -codecFlagSupportDisable = (1L << 13) -codecFlagReenable = (1L << 14) -codecFlagOutUpdateOnNextIdle = (1L << 9) -codecFlagOutUpdateOnDataSourceChange = (1L << 10) -codecFlagSequenceSensitive = (1L << 11) -codecFlagOutUpdateOnTimeChange = (1L << 12) -codecFlagImageBufferNotSourceImage = (1L << 13) -codecFlagUsedNewImageBuffer = (1L << 14) -codecFlagUsedImageBuffer = (1L << 15) -codecMinimumDataSize = 32768L -compressorComponentType = FOUR_CHAR_CODE('imco') -decompressorComponentType = FOUR_CHAR_CODE('imdc') -codecLosslessQuality = 0x00000400 -codecMaxQuality = 0x000003FF -codecMinQuality = 0x00000000 -codecLowQuality = 0x00000100 -codecNormalQuality = 0x00000200 -codecHighQuality = 0x00000300 -codecLockBitsShieldCursor = (1 << 0) -codecCompletionSource = (1 << 0) -codecCompletionDest = (1 << 1) -codecCompletionDontUnshield = (1 << 2) -codecCompletionWentOffscreen = (1 << 3) -codecCompletionUnlockBits = (1 << 4) -codecCompletionForceChainFlush = (1 << 5) -codecCompletionDropped = (1 << 6) -codecProgressOpen = 0 -codecProgressUpdatePercent = 1 -codecProgressClose = 2 -defaultDither = 0 -forceDither = 1 -suppressDither = 2 -useColorMatching = 4 -callStdBits = 1 -callOldBits = 2 -noDefaultOpcodes = 4 -graphicsModeStraightAlpha = 256 -graphicsModePreWhiteAlpha = 257 -graphicsModePreBlackAlpha = 258 -graphicsModeComposition = 259 -graphicsModeStraightAlphaBlend = 260 -graphicsModePreMulColorAlpha = 261 -evenField1ToEvenFieldOut = 1 << 0 -evenField1ToOddFieldOut = 1 << 1 -oddField1ToEvenFieldOut = 1 << 2 -oddField1ToOddFieldOut = 1 << 3 -evenField2ToEvenFieldOut = 1 << 4 -evenField2ToOddFieldOut = 1 << 5 -oddField2ToEvenFieldOut = 1 << 6 -oddField2ToOddFieldOut = 1 << 7 -icmFrameTimeHasVirtualStartTimeAndDuration = 1 << 0 -codecDSequenceDisableOverlaySurface = (1L << 5) -codecDSequenceSingleField = (1L << 6) -codecDSequenceBidirectionalPrediction = (1L << 7) -codecDSequenceFlushInsteadOfDirtying = (1L << 8) -codecDSequenceEnableSubPixelPositioning = (1L << 9) -kICMSequenceTaskWeight = FOUR_CHAR_CODE('twei') -kICMSequenceTaskName = FOUR_CHAR_CODE('tnam') -kICMSequenceUserPreferredCodecs = FOUR_CHAR_CODE('punt') -kImageDescriptionSampleFormat = FOUR_CHAR_CODE('idfm') -kImageDescriptionClassicAtomFormat = FOUR_CHAR_CODE('atom') -kImageDescriptionQTAtomFormat = FOUR_CHAR_CODE('qtat') -kImageDescriptionEffectDataFormat = FOUR_CHAR_CODE('fxat') -kImageDescriptionPrivateDataFormat = FOUR_CHAR_CODE('priv') -kImageDescriptionAlternateCodec = FOUR_CHAR_CODE('subs') -kImageDescriptionColorSpace = FOUR_CHAR_CODE('cspc') -sfpItemPreviewAreaUser = 11 -sfpItemPreviewStaticText = 12 -sfpItemPreviewDividerUser = 13 -sfpItemCreatePreviewButton = 14 -sfpItemShowPreviewButton = 15 -kICMPixelFormatIsPlanarMask = 0x0F -kICMPixelFormatIsIndexed = (1L << 4) -kICMPixelFormatIsSupportedByQD = (1L << 5) -kICMPixelFormatIsMonochrome = (1L << 6) -kICMPixelFormatHasAlphaChannel = (1L << 7) -kICMGetChainUltimateParent = 0 -kICMGetChainParent = 1 -kICMGetChainChild = 2 -kICMGetChainUltimateChild = 3 -kDontUseValidateToFindGraphicsImporter = 1L << 0 -kICMTempThenAppMemory = 1L << 12 -kICMAppThenTempMemory = 1L << 13 -kQTUsePlatformDefaultGammaLevel = 0 -kQTUseSourceGammaLevel = -1L -kQTCCIR601VideoGammaLevel = 0x00023333 -identityMatrixType = 0x00 -translateMatrixType = 0x01 -scaleMatrixType = 0x02 -scaleTranslateMatrixType = 0x03 -linearMatrixType = 0x04 -linearTranslateMatrixType = 0x05 -perspectiveMatrixType = 0x06 -GraphicsImporterComponentType = FOUR_CHAR_CODE('grip') -graphicsImporterUsesImageDecompressor = 1L << 23 -quickTimeImageFileImageDescriptionAtom = FOUR_CHAR_CODE('idsc') -quickTimeImageFileImageDataAtom = FOUR_CHAR_CODE('idat') -quickTimeImageFileMetaDataAtom = FOUR_CHAR_CODE('meta') -quickTimeImageFileColorSyncProfileAtom = FOUR_CHAR_CODE('iicc') -graphicsImporterDrawsAllPixels = 0 -graphicsImporterDoesntDrawAllPixels = 1 -graphicsImporterDontKnowIfDrawAllPixels = 2 -kGraphicsImporterDontDoGammaCorrection = 1L << 0 -kGraphicsImporterTrustResolutionFromFile = 1L << 1 -kGraphicsImporterEnableSubPixelPositioning = 1L << 2 -kGraphicsExportGroup = FOUR_CHAR_CODE('expo') -kGraphicsExportFileType = FOUR_CHAR_CODE('ftyp') -kGraphicsExportMIMEType = FOUR_CHAR_CODE('mime') -kGraphicsExportExtension = FOUR_CHAR_CODE('ext ') -kGraphicsExportDescription = FOUR_CHAR_CODE('desc') -kQTPhotoshopLayerMode = FOUR_CHAR_CODE('lmod') -kQTPhotoshopLayerOpacity = FOUR_CHAR_CODE('lopa') -kQTPhotoshopLayerClipping = FOUR_CHAR_CODE('lclp') -kQTPhotoshopLayerFlags = FOUR_CHAR_CODE('lflg') -kQTPhotoshopLayerName = FOUR_CHAR_CODE('\xa9lnm') -kQTPhotoshopLayerUnicodeName = FOUR_CHAR_CODE('luni') -kQTIndexedImageType = FOUR_CHAR_CODE('nth?') -kQTIndexedImageIsThumbnail = FOUR_CHAR_CODE('n=th') -kQTIndexedImageIsLayer = FOUR_CHAR_CODE('n=ly') -kQTIndexedImageIsPage = FOUR_CHAR_CODE('n=pg') -kQTIndexedImageIsMultiResolution = FOUR_CHAR_CODE('n=rs') -kQTTIFFUserDataPrefix = 0x74690000 -kQTTIFFExifUserDataPrefix = 0x65780000 -kQTTIFFExifGPSUserDataPrefix = 0x67700000 -kQTAlphaMode = FOUR_CHAR_CODE('almo') -kQTAlphaModePreMulColor = FOUR_CHAR_CODE('almp') -kUserDataIPTC = FOUR_CHAR_CODE('iptc') -kQTTIFFUserDataOrientation = 0x74690112 -kQTTIFFUserDataTransferFunction = 0x7469012D -kQTTIFFUserDataWhitePoint = 0x7469013E -kQTTIFFUserDataPrimaryChromaticities = 0x7469013F -kQTTIFFUserDataTransferRange = 0x74690156 -kQTTIFFUserDataYCbCrPositioning = 0x74690213 -kQTTIFFUserDataReferenceBlackWhite = 0x74690214 -kQTTIFFUserDataModelPixelScale = 0x7469830E -kQTTIFFUserDataModelTransformation = 0x746985D8 -kQTTIFFUserDataModelTiepoint = 0x74698482 -kQTTIFFUserDataGeoKeyDirectory = 0x746987AF -kQTTIFFUserDataGeoDoubleParams = 0x746987B0 -kQTTIFFUserDataGeoAsciiParams = 0x746987B1 -kQTTIFFUserDataIntergraphMatrix = 0x74698480 -kQTExifUserDataExifVersion = 0x65789000 -kQTExifUserDataFlashPixVersion = 0x6578A000 -kQTExifUserDataColorSpace = 0x6578A001 -kQTExifUserDataComponentsConfiguration = 0x65789101 -kQTExifUserDataCompressedBitsPerPixel = 0x65789102 -kQTExifUserDataPixelXDimension = 0x6578A002 -kQTExifUserDataPixelYDimension = 0x6578A003 -kQTExifUserDataMakerNote = 0x6578927C -kQTExifUserDataUserComment = 0x6578928C -kQTExifUserDataRelatedSoundFile = 0x6578A004 -kQTExifUserDataDateTimeOriginal = 0x65789003 -kQTExifUserDataDateTimeDigitized = 0x65789004 -kQTExifUserDataSubSecTime = 0x65789290 -kQTExifUserDataSubSecTimeOriginal = 0x65789291 -kQTExifUserDataSubSecTimeDigitized = 0x65789292 -kQTExifUserDataExposureTime = 0x6578829A -kQTExifUserDataFNumber = 0x6578829D -kQTExifUserDataExposureProgram = 0x65788822 -kQTExifUserDataSpectralSensitivity = 0x65788824 -kQTExifUserDataISOSpeedRatings = 0x65788827 -kQTExifUserDataShutterSpeedValue = 0x65789201 -kQTExifUserDataApertureValue = 0x65789202 -kQTExifUserDataBrightnessValue = 0x65789203 -kQTExifUserDataExposureBiasValue = 0x65789204 -kQTExifUserDataMaxApertureValue = 0x65789205 -kQTExifUserDataSubjectDistance = 0x65789206 -kQTExifUserDataMeteringMode = 0x65789207 -kQTExifUserDataLightSource = 0x65789208 -kQTExifUserDataFlash = 0x65789209 -kQTExifUserDataFocalLength = 0x6578920A -kQTExifUserDataFlashEnergy = 0x6578A20B -kQTExifUserDataFocalPlaneXResolution = 0x6578A20E -kQTExifUserDataFocalPlaneYResolution = 0x6578A20F -kQTExifUserDataFocalPlaneResolutionUnit = 0x6578A210 -kQTExifUserDataSubjectLocation = 0x6578A214 -kQTExifUserDataExposureIndex = 0x6578A215 -kQTExifUserDataSensingMethod = 0x6578A217 -kQTExifUserDataFileSource = 0x6578A300 -kQTExifUserDataSceneType = 0x6578A301 -kQTExifUserDataGPSVersionID = 0x06770000 -kQTExifUserDataGPSLatitudeRef = 0x06770001 -kQTExifUserDataGPSLatitude = 0x06770002 -kQTExifUserDataGPSLongitudeRef = 0x06770003 -kQTExifUserDataGPSLongitude = 0x06770004 -kQTExifUserDataGPSAltitudeRef = 0x06770005 -kQTExifUserDataGPSAltitude = 0x06770006 -kQTExifUserDataGPSTimeStamp = 0x06770007 -kQTExifUserDataGPSSatellites = 0x06770008 -kQTExifUserDataGPSStatus = 0x06770009 -kQTExifUserDataGPSMeasureMode = 0x0677000A -kQTExifUserDataGPSDOP = 0x0677000B -kQTExifUserDataGPSSpeedRef = 0x0677000C -kQTExifUserDataGPSSpeed = 0x0677000D -kQTExifUserDataGPSTrackRef = 0x0677000E -kQTExifUserDataGPSTrack = 0x0677000F -kQTExifUserDataGPSImgDirectionRef = 0x06770010 -kQTExifUserDataGPSImgDirection = 0x06770011 -kQTExifUserDataGPSMapDatum = 0x06770012 -kQTExifUserDataGPSDestLatitudeRef = 0x06770013 -kQTExifUserDataGPSDestLatitude = 0x06770014 -kQTExifUserDataGPSDestLongitudeRef = 0x06770015 -kQTExifUserDataGPSDestLongitude = 0x06770016 -kQTExifUserDataGPSDestBearingRef = 0x06770017 -kQTExifUserDataGPSDestBearing = 0x06770018 -kQTExifUserDataGPSDestDistanceRef = 0x06770019 -kQTExifUserDataGPSDestDistance = 0x0677001A -GraphicsExporterComponentType = FOUR_CHAR_CODE('grex') -kBaseGraphicsExporterSubType = FOUR_CHAR_CODE('base') -graphicsExporterIsBaseExporter = 1L << 0 -graphicsExporterCanTranscode = 1L << 1 -graphicsExporterUsesImageCompressor = 1L << 2 -kQTResolutionSettings = FOUR_CHAR_CODE('reso') -kQTTargetDataSize = FOUR_CHAR_CODE('dasz') -kQTDontRecompress = FOUR_CHAR_CODE('dntr') -kQTInterlaceStyle = FOUR_CHAR_CODE('ilac') -kQTColorSyncProfile = FOUR_CHAR_CODE('iccp') -kQTThumbnailSettings = FOUR_CHAR_CODE('thum') -kQTEnableExif = FOUR_CHAR_CODE('exif') -kQTMetaData = FOUR_CHAR_CODE('meta') -kQTTIFFCompressionMethod = FOUR_CHAR_CODE('tifc') -kQTTIFFCompression_None = 1 -kQTTIFFCompression_PackBits = 32773L -kQTTIFFLittleEndian = FOUR_CHAR_CODE('tife') -kQTPNGFilterPreference = FOUR_CHAR_CODE('pngf') -kQTPNGFilterBestForColorType = FOUR_CHAR_CODE('bflt') -kQTPNGFilterNone = 0 -kQTPNGFilterSub = 1 -kQTPNGFilterUp = 2 -kQTPNGFilterAverage = 3 -kQTPNGFilterPaeth = 4 -kQTPNGFilterAdaptivePerRow = FOUR_CHAR_CODE('aflt') -kQTPNGInterlaceStyle = FOUR_CHAR_CODE('ilac') -kQTPNGInterlaceNone = 0 -kQTPNGInterlaceAdam7 = 1 -ImageTranscodererComponentType = FOUR_CHAR_CODE('imtc') -kGraphicsImportSetDataReferenceSelect = 0x0001 -kGraphicsImportGetDataReferenceSelect = 0x0002 -kGraphicsImportSetDataFileSelect = 0x0003 -kGraphicsImportGetDataFileSelect = 0x0004 -kGraphicsImportSetDataHandleSelect = 0x0005 -kGraphicsImportGetDataHandleSelect = 0x0006 -kGraphicsImportGetImageDescriptionSelect = 0x0007 -kGraphicsImportGetDataOffsetAndSizeSelect = 0x0008 -kGraphicsImportReadDataSelect = 0x0009 -kGraphicsImportSetClipSelect = 0x000A -kGraphicsImportGetClipSelect = 0x000B -kGraphicsImportSetSourceRectSelect = 0x000C -kGraphicsImportGetSourceRectSelect = 0x000D -kGraphicsImportGetNaturalBoundsSelect = 0x000E -kGraphicsImportDrawSelect = 0x000F -kGraphicsImportSetGWorldSelect = 0x0010 -kGraphicsImportGetGWorldSelect = 0x0011 -kGraphicsImportSetMatrixSelect = 0x0012 -kGraphicsImportGetMatrixSelect = 0x0013 -kGraphicsImportSetBoundsRectSelect = 0x0014 -kGraphicsImportGetBoundsRectSelect = 0x0015 -kGraphicsImportSaveAsPictureSelect = 0x0016 -kGraphicsImportSetGraphicsModeSelect = 0x0017 -kGraphicsImportGetGraphicsModeSelect = 0x0018 -kGraphicsImportSetQualitySelect = 0x0019 -kGraphicsImportGetQualitySelect = 0x001A -kGraphicsImportSaveAsQuickTimeImageFileSelect = 0x001B -kGraphicsImportSetDataReferenceOffsetAndLimitSelect = 0x001C -kGraphicsImportGetDataReferenceOffsetAndLimitSelect = 0x001D -kGraphicsImportGetAliasedDataReferenceSelect = 0x001E -kGraphicsImportValidateSelect = 0x001F -kGraphicsImportGetMetaDataSelect = 0x0020 -kGraphicsImportGetMIMETypeListSelect = 0x0021 -kGraphicsImportDoesDrawAllPixelsSelect = 0x0022 -kGraphicsImportGetAsPictureSelect = 0x0023 -kGraphicsImportExportImageFileSelect = 0x0024 -kGraphicsImportGetExportImageTypeListSelect = 0x0025 -kGraphicsImportDoExportImageFileDialogSelect = 0x0026 -kGraphicsImportGetExportSettingsAsAtomContainerSelect = 0x0027 -kGraphicsImportSetExportSettingsFromAtomContainerSelect = 0x0028 -kGraphicsImportSetProgressProcSelect = 0x0029 -kGraphicsImportGetProgressProcSelect = 0x002A -kGraphicsImportGetImageCountSelect = 0x002B -kGraphicsImportSetImageIndexSelect = 0x002C -kGraphicsImportGetImageIndexSelect = 0x002D -kGraphicsImportGetDataOffsetAndSize64Select = 0x002E -kGraphicsImportReadData64Select = 0x002F -kGraphicsImportSetDataReferenceOffsetAndLimit64Select = 0x0030 -kGraphicsImportGetDataReferenceOffsetAndLimit64Select = 0x0031 -kGraphicsImportGetDefaultMatrixSelect = 0x0032 -kGraphicsImportGetDefaultClipSelect = 0x0033 -kGraphicsImportGetDefaultGraphicsModeSelect = 0x0034 -kGraphicsImportGetDefaultSourceRectSelect = 0x0035 -kGraphicsImportGetColorSyncProfileSelect = 0x0036 -kGraphicsImportSetDestRectSelect = 0x0037 -kGraphicsImportGetDestRectSelect = 0x0038 -kGraphicsImportSetFlagsSelect = 0x0039 -kGraphicsImportGetFlagsSelect = 0x003A -kGraphicsImportGetBaseDataOffsetAndSize64Select = 0x003D -kGraphicsImportSetImageIndexToThumbnailSelect = 0x003E -kGraphicsExportDoExportSelect = 0x0001 -kGraphicsExportCanTranscodeSelect = 0x0002 -kGraphicsExportDoTranscodeSelect = 0x0003 -kGraphicsExportCanUseCompressorSelect = 0x0004 -kGraphicsExportDoUseCompressorSelect = 0x0005 -kGraphicsExportDoStandaloneExportSelect = 0x0006 -kGraphicsExportGetDefaultFileTypeAndCreatorSelect = 0x0007 -kGraphicsExportGetDefaultFileNameExtensionSelect = 0x0008 -kGraphicsExportGetMIMETypeListSelect = 0x0009 -kGraphicsExportRequestSettingsSelect = 0x000B -kGraphicsExportSetSettingsFromAtomContainerSelect = 0x000C -kGraphicsExportGetSettingsAsAtomContainerSelect = 0x000D -kGraphicsExportGetSettingsAsTextSelect = 0x000E -kGraphicsExportSetDontRecompressSelect = 0x000F -kGraphicsExportGetDontRecompressSelect = 0x0010 -kGraphicsExportSetInterlaceStyleSelect = 0x0011 -kGraphicsExportGetInterlaceStyleSelect = 0x0012 -kGraphicsExportSetMetaDataSelect = 0x0013 -kGraphicsExportGetMetaDataSelect = 0x0014 -kGraphicsExportSetTargetDataSizeSelect = 0x0015 -kGraphicsExportGetTargetDataSizeSelect = 0x0016 -kGraphicsExportSetCompressionMethodSelect = 0x0017 -kGraphicsExportGetCompressionMethodSelect = 0x0018 -kGraphicsExportSetCompressionQualitySelect = 0x0019 -kGraphicsExportGetCompressionQualitySelect = 0x001A -kGraphicsExportSetResolutionSelect = 0x001B -kGraphicsExportGetResolutionSelect = 0x001C -kGraphicsExportSetDepthSelect = 0x001D -kGraphicsExportGetDepthSelect = 0x001E -kGraphicsExportSetColorSyncProfileSelect = 0x0021 -kGraphicsExportGetColorSyncProfileSelect = 0x0022 -kGraphicsExportSetProgressProcSelect = 0x0023 -kGraphicsExportGetProgressProcSelect = 0x0024 -kGraphicsExportSetInputDataReferenceSelect = 0x0025 -kGraphicsExportGetInputDataReferenceSelect = 0x0026 -kGraphicsExportSetInputFileSelect = 0x0027 -kGraphicsExportGetInputFileSelect = 0x0028 -kGraphicsExportSetInputHandleSelect = 0x0029 -kGraphicsExportGetInputHandleSelect = 0x002A -kGraphicsExportSetInputPtrSelect = 0x002B -kGraphicsExportGetInputPtrSelect = 0x002C -kGraphicsExportSetInputGraphicsImporterSelect = 0x002D -kGraphicsExportGetInputGraphicsImporterSelect = 0x002E -kGraphicsExportSetInputPictureSelect = 0x002F -kGraphicsExportGetInputPictureSelect = 0x0030 -kGraphicsExportSetInputGWorldSelect = 0x0031 -kGraphicsExportGetInputGWorldSelect = 0x0032 -kGraphicsExportSetInputPixmapSelect = 0x0033 -kGraphicsExportGetInputPixmapSelect = 0x0034 -kGraphicsExportSetInputOffsetAndLimitSelect = 0x0035 -kGraphicsExportGetInputOffsetAndLimitSelect = 0x0036 -kGraphicsExportMayExporterReadInputDataSelect = 0x0037 -kGraphicsExportGetInputDataSizeSelect = 0x0038 -kGraphicsExportReadInputDataSelect = 0x0039 -kGraphicsExportGetInputImageDescriptionSelect = 0x003A -kGraphicsExportGetInputImageDimensionsSelect = 0x003B -kGraphicsExportGetInputImageDepthSelect = 0x003C -kGraphicsExportDrawInputImageSelect = 0x003D -kGraphicsExportSetOutputDataReferenceSelect = 0x003E -kGraphicsExportGetOutputDataReferenceSelect = 0x003F -kGraphicsExportSetOutputFileSelect = 0x0040 -kGraphicsExportGetOutputFileSelect = 0x0041 -kGraphicsExportSetOutputHandleSelect = 0x0042 -kGraphicsExportGetOutputHandleSelect = 0x0043 -kGraphicsExportSetOutputOffsetAndMaxSizeSelect = 0x0044 -kGraphicsExportGetOutputOffsetAndMaxSizeSelect = 0x0045 -kGraphicsExportSetOutputFileTypeAndCreatorSelect = 0x0046 -kGraphicsExportGetOutputFileTypeAndCreatorSelect = 0x0047 -kGraphicsExportWriteOutputDataSelect = 0x0048 -kGraphicsExportSetOutputMarkSelect = 0x0049 -kGraphicsExportGetOutputMarkSelect = 0x004A -kGraphicsExportReadOutputDataSelect = 0x004B -kGraphicsExportSetThumbnailEnabledSelect = 0x004C -kGraphicsExportGetThumbnailEnabledSelect = 0x004D -kGraphicsExportSetExifEnabledSelect = 0x004E -kGraphicsExportGetExifEnabledSelect = 0x004F -kImageTranscoderBeginSequenceSelect = 0x0001 -kImageTranscoderConvertSelect = 0x0002 -kImageTranscoderDisposeDataSelect = 0x0003 -kImageTranscoderEndSequenceSelect = 0x0004 -clockComponentType = FOUR_CHAR_CODE('clok') -systemTickClock = FOUR_CHAR_CODE('tick') -systemSecondClock = FOUR_CHAR_CODE('seco') -systemMillisecondClock = FOUR_CHAR_CODE('mill') -systemMicrosecondClock = FOUR_CHAR_CODE('micr') -kClockRateIsLinear = 1 -kClockImplementsCallBacks = 2 -kClockCanHandleIntermittentSound = 4 -StandardCompressionType = FOUR_CHAR_CODE('scdi') -StandardCompressionSubType = FOUR_CHAR_CODE('imag') -StandardCompressionSubTypeSound = FOUR_CHAR_CODE('soun') -scListEveryCodec = 1L << 1 -scAllowZeroFrameRate = 1L << 2 -scAllowZeroKeyFrameRate = 1L << 3 -scShowBestDepth = 1L << 4 -scUseMovableModal = 1L << 5 -scDisableFrameRateItem = 1L << 6 -scShowDataRateAsKilobits = 1L << 7 -scPreferCropping = 1 << 0 -scPreferScaling = 1 << 1 -scPreferScalingAndCropping = scPreferScaling | scPreferCropping -scDontDetermineSettingsFromTestImage = 1 << 2 -scTestImageWidth = 80 -scTestImageHeight = 80 -scOKItem = 1 -scCancelItem = 2 -scCustomItem = 3 -scUserCancelled = 1 -scPositionRect = 2 -scPositionDialog = 3 -scSetTestImagePictHandle = 4 -scSetTestImagePictFile = 5 -scSetTestImagePixMap = 6 -scGetBestDeviceRect = 7 -scRequestImageSettings = 10 -scCompressImage = 11 -scCompressPicture = 12 -scCompressPictureFile = 13 -scRequestSequenceSettings = 14 -scCompressSequenceBegin = 15 -scCompressSequenceFrame = 16 -scCompressSequenceEnd = 17 -scDefaultPictHandleSettings = 18 -scDefaultPictFileSettings = 19 -scDefaultPixMapSettings = 20 -scGetInfo = 21 -scSetInfo = 22 -scNewGWorld = 23 -scSpatialSettingsType = FOUR_CHAR_CODE('sptl') -scTemporalSettingsType = FOUR_CHAR_CODE('tprl') -scDataRateSettingsType = FOUR_CHAR_CODE('drat') -scColorTableType = FOUR_CHAR_CODE('clut') -scProgressProcType = FOUR_CHAR_CODE('prog') -scExtendedProcsType = FOUR_CHAR_CODE('xprc') -scPreferenceFlagsType = FOUR_CHAR_CODE('pref') -scSettingsStateType = FOUR_CHAR_CODE('ssta') -scSequenceIDType = FOUR_CHAR_CODE('sequ') -scWindowPositionType = FOUR_CHAR_CODE('wndw') -scCodecFlagsType = FOUR_CHAR_CODE('cflg') -scCodecSettingsType = FOUR_CHAR_CODE('cdec') -scForceKeyValueType = FOUR_CHAR_CODE('ksim') -scSoundSampleRateType = FOUR_CHAR_CODE('ssrt') -scSoundSampleSizeType = FOUR_CHAR_CODE('ssss') -scSoundChannelCountType = FOUR_CHAR_CODE('sscc') -scSoundCompressionType = FOUR_CHAR_CODE('ssct') -scCompressionListType = FOUR_CHAR_CODE('ctyl') -scCodecManufacturerType = FOUR_CHAR_CODE('cmfr') -scSoundVBRCompressionOK = FOUR_CHAR_CODE('cvbr') -scSoundInputSampleRateType = FOUR_CHAR_CODE('ssir') -scSoundSampleRateChangeOK = FOUR_CHAR_CODE('rcok') -scAvailableCompressionListType = FOUR_CHAR_CODE('avai') -scGetCompression = 1 -scShowMotionSettings = 1L << 0 -scSettingsChangedItem = -1 -scCompressFlagIgnoreIdenticalFrames = 1 -kQTSettingsVideo = FOUR_CHAR_CODE('vide') -kQTSettingsSound = FOUR_CHAR_CODE('soun') -kQTSettingsComponentVersion = FOUR_CHAR_CODE('vers') -TweenComponentType = FOUR_CHAR_CODE('twen') -TCSourceRefNameType = FOUR_CHAR_CODE('name') -tcDropFrame = 1 << 0 -tc24HourMax = 1 << 1 -tcNegTimesOK = 1 << 2 -tcCounter = 1 << 3 -tctNegFlag = 0x80 -tcdfShowTimeCode = 1 << 0 -MovieImportType = FOUR_CHAR_CODE('eat ') -MovieExportType = FOUR_CHAR_CODE('spit') -canMovieImportHandles = 1 << 0 -canMovieImportFiles = 1 << 1 -hasMovieImportUserInterface = 1 << 2 -canMovieExportHandles = 1 << 3 -canMovieExportFiles = 1 << 4 -hasMovieExportUserInterface = 1 << 5 -movieImporterIsXMLBased = 1 << 5 -dontAutoFileMovieImport = 1 << 6 -canMovieExportAuxDataHandle = 1 << 7 -canMovieImportValidateHandles = 1 << 8 -canMovieImportValidateFile = 1 << 9 -dontRegisterWithEasyOpen = 1 << 10 -canMovieImportInPlace = 1 << 11 -movieImportSubTypeIsFileExtension = 1 << 12 -canMovieImportPartial = 1 << 13 -hasMovieImportMIMEList = 1 << 14 -canMovieImportAvoidBlocking = 1 << 15 -canMovieExportFromProcedures = 1 << 15 -canMovieExportValidateMovie = 1L << 16 -movieImportMustGetDestinationMediaType = 1L << 16 -movieExportNeedsResourceFork = 1L << 17 -canMovieImportDataReferences = 1L << 18 -movieExportMustGetSourceMediaType = 1L << 19 -canMovieImportWithIdle = 1L << 20 -canMovieImportValidateDataReferences = 1L << 21 -reservedForUseByGraphicsImporters = 1L << 23 -movieImportCreateTrack = 1 -movieImportInParallel = 2 -movieImportMustUseTrack = 4 -movieImportWithIdle = 16 -movieImportResultUsedMultipleTracks = 8 -movieImportResultNeedIdles = 32 -movieImportResultComplete = 64 -kMovieExportTextOnly = 0 -kMovieExportAbsoluteTime = 1 -kMovieExportRelativeTime = 2 -kMIDIImportSilenceBefore = 1 << 0 -kMIDIImportSilenceAfter = 1 << 1 -kMIDIImport20Playable = 1 << 2 -kMIDIImportWantLyrics = 1 << 3 -kQTMediaConfigResourceType = FOUR_CHAR_CODE('mcfg') -kQTMediaConfigResourceVersion = 2 -kQTMediaGroupResourceType = FOUR_CHAR_CODE('mgrp') -kQTMediaGroupResourceVersion = 1 -kQTBrowserInfoResourceType = FOUR_CHAR_CODE('brws') -kQTBrowserInfoResourceVersion = 1 -kQTMediaMIMEInfoHasChanged = (1L << 1) -kQTMediaFileInfoHasChanged = (1L << 2) -kQTMediaConfigCanUseApp = (1L << 18) -kQTMediaConfigCanUsePlugin = (1L << 19) -kQTMediaConfigUNUSED = (1L << 20) -kQTMediaConfigBinaryFile = (1L << 23) -kQTMediaConfigTextFile = 0 -kQTMediaConfigMacintoshFile = (1L << 24) -kQTMediaConfigAssociateByDefault = (1L << 27) -kQTMediaConfigUseAppByDefault = (1L << 28) -kQTMediaConfigUsePluginByDefault = (1L << 29) -kQTMediaConfigDefaultsMask = (kQTMediaConfigUseAppByDefault | kQTMediaConfigUsePluginByDefault) -kQTMediaConfigDefaultsShift = 12 -kQTMediaConfigHasFileHasQTAtoms = (1L << 30) -kQTMediaConfigStreamGroupID = FOUR_CHAR_CODE('strm') -kQTMediaConfigInteractiveGroupID = FOUR_CHAR_CODE('intr') -kQTMediaConfigVideoGroupID = FOUR_CHAR_CODE('eyes') -kQTMediaConfigAudioGroupID = FOUR_CHAR_CODE('ears') -kQTMediaConfigMPEGGroupID = FOUR_CHAR_CODE('mpeg') -kQTMediaConfigMP3GroupID = FOUR_CHAR_CODE('mp3 ') -kQTMediaConfigImageGroupID = FOUR_CHAR_CODE('ogle') -kQTMediaConfigMiscGroupID = FOUR_CHAR_CODE('misc') -kQTMediaInfoNetGroup = FOUR_CHAR_CODE('net ') -kQTMediaInfoWinGroup = FOUR_CHAR_CODE('win ') -kQTMediaInfoMacGroup = FOUR_CHAR_CODE('mac ') -kQTMediaInfoMiscGroup = 0x3F3F3F3F -kMimeInfoMimeTypeTag = FOUR_CHAR_CODE('mime') -kMimeInfoFileExtensionTag = FOUR_CHAR_CODE('ext ') -kMimeInfoDescriptionTag = FOUR_CHAR_CODE('desc') -kMimeInfoGroupTag = FOUR_CHAR_CODE('grop') -kMimeInfoDoNotOverrideExistingFileTypeAssociation = FOUR_CHAR_CODE('nofa') -kQTFileTypeAIFF = FOUR_CHAR_CODE('AIFF') -kQTFileTypeAIFC = FOUR_CHAR_CODE('AIFC') -kQTFileTypeDVC = FOUR_CHAR_CODE('dvc!') -kQTFileTypeMIDI = FOUR_CHAR_CODE('Midi') -kQTFileTypePicture = FOUR_CHAR_CODE('PICT') -kQTFileTypeMovie = FOUR_CHAR_CODE('MooV') -kQTFileTypeText = FOUR_CHAR_CODE('TEXT') -kQTFileTypeWave = FOUR_CHAR_CODE('WAVE') -kQTFileTypeSystemSevenSound = FOUR_CHAR_CODE('sfil') -kQTFileTypeMuLaw = FOUR_CHAR_CODE('ULAW') -kQTFileTypeAVI = FOUR_CHAR_CODE('VfW ') -kQTFileTypeSoundDesignerII = FOUR_CHAR_CODE('Sd2f') -kQTFileTypeAudioCDTrack = FOUR_CHAR_CODE('trak') -kQTFileTypePICS = FOUR_CHAR_CODE('PICS') -kQTFileTypeGIF = FOUR_CHAR_CODE('GIFf') -kQTFileTypePNG = FOUR_CHAR_CODE('PNGf') -kQTFileTypeTIFF = FOUR_CHAR_CODE('TIFF') -kQTFileTypePhotoShop = FOUR_CHAR_CODE('8BPS') -kQTFileTypeSGIImage = FOUR_CHAR_CODE('.SGI') -kQTFileTypeBMP = FOUR_CHAR_CODE('BMPf') -kQTFileTypeJPEG = FOUR_CHAR_CODE('JPEG') -kQTFileTypeJFIF = FOUR_CHAR_CODE('JPEG') -kQTFileTypeMacPaint = FOUR_CHAR_CODE('PNTG') -kQTFileTypeTargaImage = FOUR_CHAR_CODE('TPIC') -kQTFileTypeQuickDrawGXPicture = FOUR_CHAR_CODE('qdgx') -kQTFileTypeQuickTimeImage = FOUR_CHAR_CODE('qtif') -kQTFileType3DMF = FOUR_CHAR_CODE('3DMF') -kQTFileTypeFLC = FOUR_CHAR_CODE('FLC ') -kQTFileTypeFlash = FOUR_CHAR_CODE('SWFL') -kQTFileTypeFlashPix = FOUR_CHAR_CODE('FPix') -kQTFileTypeMP4 = FOUR_CHAR_CODE('mpg4') -kQTSettingsDVExportNTSC = FOUR_CHAR_CODE('dvcv') -kQTSettingsDVExportLockedAudio = FOUR_CHAR_CODE('lock') -kQTSettingsEffect = FOUR_CHAR_CODE('effe') -kQTSettingsGraphicsFileImportSequence = FOUR_CHAR_CODE('sequ') -kQTSettingsGraphicsFileImportSequenceEnabled = FOUR_CHAR_CODE('enab') -kQTSettingsMovieExportEnableVideo = FOUR_CHAR_CODE('envi') -kQTSettingsMovieExportEnableSound = FOUR_CHAR_CODE('enso') -kQTSettingsMovieExportSaveOptions = FOUR_CHAR_CODE('save') -kQTSettingsMovieExportSaveForInternet = FOUR_CHAR_CODE('fast') -kQTSettingsMovieExportSaveCompressedMovie = FOUR_CHAR_CODE('cmpm') -kQTSettingsMIDI = FOUR_CHAR_CODE('MIDI') -kQTSettingsMIDISettingFlags = FOUR_CHAR_CODE('sttg') -kQTSettingsText = FOUR_CHAR_CODE('text') -kQTSettingsTextDescription = FOUR_CHAR_CODE('desc') -kQTSettingsTextSize = FOUR_CHAR_CODE('size') -kQTSettingsTextSettingFlags = FOUR_CHAR_CODE('sttg') -kQTSettingsTextTimeFraction = FOUR_CHAR_CODE('timf') -kQTSettingsTime = FOUR_CHAR_CODE('time') -kQTSettingsTimeDuration = FOUR_CHAR_CODE('dura') -kQTSettingsAudioCDTrack = FOUR_CHAR_CODE('trak') -kQTSettingsAudioCDTrackRateShift = FOUR_CHAR_CODE('rshf') -kQTSettingsDVExportDVFormat = FOUR_CHAR_CODE('dvcf') -kQTPresetsListResourceType = FOUR_CHAR_CODE('stg#') -kQTPresetsPlatformListResourceType = FOUR_CHAR_CODE('stgp') -kQTPresetInfoIsDivider = 1 -kQTMovieExportSourceInfoResourceType = FOUR_CHAR_CODE('src#') -kQTMovieExportSourceInfoIsMediaType = 1L << 0 -kQTMovieExportSourceInfoIsMediaCharacteristic = 1L << 1 -kQTMovieExportSourceInfoIsSourceType = 1L << 2 -movieExportUseConfiguredSettings = FOUR_CHAR_CODE('ucfg') -movieExportWidth = FOUR_CHAR_CODE('wdth') -movieExportHeight = FOUR_CHAR_CODE('hegt') -movieExportDuration = FOUR_CHAR_CODE('dura') -movieExportVideoFilter = FOUR_CHAR_CODE('iflt') -movieExportTimeScale = FOUR_CHAR_CODE('tmsc') -kQTBrowserInfoCanUseSystemFolderPlugin = (1L << 0) -kQTPreFlightOpenComponent = (1L << 1) -pnotComponentWantsEvents = 1 -pnotComponentNeedsNoCache = 2 -ShowFilePreviewComponentType = FOUR_CHAR_CODE('pnot') -CreateFilePreviewComponentType = FOUR_CHAR_CODE('pmak') -DataCompressorComponentType = FOUR_CHAR_CODE('dcom') -DataDecompressorComponentType = FOUR_CHAR_CODE('ddec') -AppleDataCompressorSubType = FOUR_CHAR_CODE('adec') -zlibDataCompressorSubType = FOUR_CHAR_CODE('zlib') -kDataHCanRead = 1L << 0 -kDataHSpecialRead = 1L << 1 -kDataHSpecialReadFile = 1L << 2 -kDataHCanWrite = 1L << 3 -kDataHSpecialWrite = 1 << 4 -kDataHSpecialWriteFile = 1 << 5 -kDataHCanStreamingWrite = 1 << 6 -kDataHMustCheckDataRef = 1 << 7 -kDataRefExtensionChokeSpeed = FOUR_CHAR_CODE('chok') -kDataRefExtensionFileName = FOUR_CHAR_CODE('fnam') -kDataRefExtensionMIMEType = FOUR_CHAR_CODE('mime') -kDataRefExtensionMacOSFileType = FOUR_CHAR_CODE('ftyp') -kDataRefExtensionInitializationData = FOUR_CHAR_CODE('data') -kDataRefExtensionQuickTimeMediaType = FOUR_CHAR_CODE('mtyp') -kDataHChokeToMovieDataRate = 1 << 0 -kDataHChokeToParam = 1 << 1 -kDataHExtendedSchedule = FOUR_CHAR_CODE('xtnd') -kDataHInfoFlagNeverStreams = 1 << 0 -kDataHInfoFlagCanUpdateDataRefs = 1 << 1 -kDataHInfoFlagNeedsNetworkBandwidth = 1 << 2 -kDataHFileTypeMacOSFileType = FOUR_CHAR_CODE('ftyp') -kDataHFileTypeExtension = FOUR_CHAR_CODE('fext') -kDataHFileTypeMIME = FOUR_CHAR_CODE('mime') -kDataHCreateFileButDontCreateResFile = (1L << 0) -kDataHMovieUsageDoAppendMDAT = 1L << 0 -kDataHTempUseSameDirectory = 1L << 0 -kDataHTempUseSameVolume = 1L << 1 -kDataHTempCreateFile = 1L << 2 -kDataHTempOpenFile = 1L << 3 -kDataHGetDataRateInfiniteRate = 0x7FFFFFFF -kDataHSetTimeHintsSkipBandwidthRequest = 1 << 0 -videoDigitizerComponentType = FOUR_CHAR_CODE('vdig') -vdigInterfaceRev = 2 -ntscIn = 0 -currentIn = 0 -palIn = 1 -secamIn = 2 -ntscReallyIn = 3 -compositeIn = 0 -sVideoIn = 1 -rgbComponentIn = 2 -rgbComponentSyncIn = 3 -yuvComponentIn = 4 -yuvComponentSyncIn = 5 -tvTunerIn = 6 -sdiIn = 7 -vdPlayThruOff = 0 -vdPlayThruOn = 1 -vdDigitizerBW = 0 -vdDigitizerRGB = 1 -vdBroadcastMode = 0 -vdVTRMode = 1 -vdUseAnyField = 0 -vdUseOddField = 1 -vdUseEvenField = 2 -vdTypeBasic = 0 -vdTypeAlpha = 1 -vdTypeMask = 2 -vdTypeKey = 3 -digiInDoesNTSC = 1L << 0 -digiInDoesPAL = 1L << 1 -digiInDoesSECAM = 1L << 2 -digiInDoesGenLock = 1L << 7 -digiInDoesComposite = 1L << 8 -digiInDoesSVideo = 1L << 9 -digiInDoesComponent = 1L << 10 -digiInVTR_Broadcast = 1L << 11 -digiInDoesColor = 1L << 12 -digiInDoesBW = 1L << 13 -digiInSignalLock = 1L << 31 -digiOutDoes1 = 1L << 0 -digiOutDoes2 = 1L << 1 -digiOutDoes4 = 1L << 2 -digiOutDoes8 = 1L << 3 -digiOutDoes16 = 1L << 4 -digiOutDoes32 = 1L << 5 -digiOutDoesDither = 1L << 6 -digiOutDoesStretch = 1L << 7 -digiOutDoesShrink = 1L << 8 -digiOutDoesMask = 1L << 9 -digiOutDoesDouble = 1L << 11 -digiOutDoesQuad = 1L << 12 -digiOutDoesQuarter = 1L << 13 -digiOutDoesSixteenth = 1L << 14 -digiOutDoesRotate = 1L << 15 -digiOutDoesHorizFlip = 1L << 16 -digiOutDoesVertFlip = 1L << 17 -digiOutDoesSkew = 1L << 18 -digiOutDoesBlend = 1L << 19 -digiOutDoesWarp = 1L << 20 -digiOutDoesHW_DMA = 1L << 21 -digiOutDoesHWPlayThru = 1L << 22 -digiOutDoesILUT = 1L << 23 -digiOutDoesKeyColor = 1L << 24 -digiOutDoesAsyncGrabs = 1L << 25 -digiOutDoesUnreadableScreenBits = 1L << 26 -digiOutDoesCompress = 1L << 27 -digiOutDoesCompressOnly = 1L << 28 -digiOutDoesPlayThruDuringCompress = 1L << 29 -digiOutDoesCompressPartiallyVisible = 1L << 30 -digiOutDoesNotNeedCopyOfCompressData = 1L << 31 -dmaDepth1 = 1 -dmaDepth2 = 2 -dmaDepth4 = 4 -dmaDepth8 = 8 -dmaDepth16 = 16 -dmaDepth32 = 32 -dmaDepth2Gray = 64 -dmaDepth4Gray = 128 -dmaDepth8Gray = 256 -kVDIGControlledFrameRate = -1 -vdDeviceFlagShowInputsAsDevices = (1 << 0) -vdDeviceFlagHideDevice = (1 << 1) -vdFlagCaptureStarting = (1 << 0) -vdFlagCaptureStopping = (1 << 1) -vdFlagCaptureIsForPreview = (1 << 2) -vdFlagCaptureIsForRecord = (1 << 3) -vdFlagCaptureLowLatency = (1 << 4) -vdFlagCaptureAlwaysUseTimeBase = (1 << 5) -vdFlagCaptureSetSettingsBegin = (1 << 6) -vdFlagCaptureSetSettingsEnd = (1 << 7) -xmlParseComponentType = FOUR_CHAR_CODE('pars') -xmlParseComponentSubType = FOUR_CHAR_CODE('xml ') -xmlIdentifierInvalid = 0 -# xmlIdentifierUnrecognized = (long)0xFFFFFFFF -xmlContentTypeInvalid = 0 -xmlContentTypeElement = 1 -xmlContentTypeCharData = 2 -elementFlagAlwaysSelfContained = 1L << 0 -elementFlagPreserveWhiteSpace = 1L << 1 -xmlParseFlagAllowUppercase = 1L << 0 -xmlParseFlagAllowUnquotedAttributeValues = 1L << 1 -xmlParseFlagEventParseOnly = 1L << 2 -attributeValueKindCharString = 0 -attributeValueKindInteger = 1L << 0 -attributeValueKindPercent = 1L << 1 -attributeValueKindBoolean = 1L << 2 -attributeValueKindOnOff = 1L << 3 -attributeValueKindColor = 1L << 4 -attributeValueKindEnum = 1L << 5 -attributeValueKindCaseSensEnum = 1L << 6 -MAX_ATTRIBUTE_VALUE_KIND = attributeValueKindCaseSensEnum -nameSpaceIDNone = 0 -element_xml = 1 -attr_src = 1 -SeqGrabComponentType = FOUR_CHAR_CODE('barg') -SeqGrabChannelType = FOUR_CHAR_CODE('sgch') -SeqGrabPanelType = FOUR_CHAR_CODE('sgpn') -SeqGrabCompressionPanelType = FOUR_CHAR_CODE('cmpr') -SeqGrabSourcePanelType = FOUR_CHAR_CODE('sour') -seqGrabToDisk = 1 -seqGrabToMemory = 2 -seqGrabDontUseTempMemory = 4 -seqGrabAppendToFile = 8 -seqGrabDontAddMovieResource = 16 -seqGrabDontMakeMovie = 32 -seqGrabPreExtendFile = 64 -seqGrabDataProcIsInterruptSafe = 128 -seqGrabDataProcDoesOverlappingReads = 256 -seqGrabRecord = 1 -seqGrabPreview = 2 -seqGrabPlayDuringRecord = 4 -seqGrabLowLatencyCapture = 8 -seqGrabAlwaysUseTimeBase = 16 -seqGrabHasBounds = 1 -seqGrabHasVolume = 2 -seqGrabHasDiscreteSamples = 4 -seqGrabDoNotBufferizeData = 8 -seqGrabCanMoveWindowWhileRecording = 16 -grabPictOffScreen = 1 -grabPictIgnoreClip = 2 -grabPictCurrentImage = 4 -sgFlagControlledGrab = (1 << 0) -sgFlagAllowNonRGBPixMaps = (1 << 1) -sgDeviceInputNameFlagInputUnavailable = (1 << 0) -sgDeviceNameFlagDeviceUnavailable = (1 << 0) -sgDeviceNameFlagShowInputsAsDevices = (1 << 1) -sgDeviceListWithIcons = (1 << 0) -sgDeviceListDontCheckAvailability = (1 << 1) -sgDeviceListIncludeInputs = (1 << 2) -seqGrabWriteAppend = 0 -seqGrabWriteReserve = 1 -seqGrabWriteFill = 2 -seqGrabUnpause = 0 -seqGrabPause = 1 -seqGrabPauseForMenu = 3 -channelFlagDontOpenResFile = 2 -channelFlagHasDependency = 4 -sgPanelFlagForPanel = 1 -seqGrabSettingsPreviewOnly = 1 -channelPlayNormal = 0 -channelPlayFast = 1 -channelPlayHighQuality = 2 -channelPlayAllData = 4 -sgSetSettingsBegin = (1 << 0) -sgSetSettingsEnd = (1 << 1) -kSGSmallestDITLSize = -1 -kSGLargestDITLSize = -2 -sgChannelAtom = FOUR_CHAR_CODE('chan') -sgChannelSettingsAtom = FOUR_CHAR_CODE('ctom') -sgChannelDescription = FOUR_CHAR_CODE('cdsc') -sgChannelSettings = FOUR_CHAR_CODE('cset') -sgDeviceNameType = FOUR_CHAR_CODE('name') -sgDeviceDisplayNameType = FOUR_CHAR_CODE('dnam') -sgDeviceUIDType = FOUR_CHAR_CODE('duid') -sgInputUIDType = FOUR_CHAR_CODE('iuid') -sgUsageType = FOUR_CHAR_CODE('use ') -sgPlayFlagsType = FOUR_CHAR_CODE('plyf') -sgClipType = FOUR_CHAR_CODE('clip') -sgMatrixType = FOUR_CHAR_CODE('mtrx') -sgVolumeType = FOUR_CHAR_CODE('volu') -sgPanelSettingsAtom = FOUR_CHAR_CODE('ptom') -sgPanelDescription = FOUR_CHAR_CODE('pdsc') -sgPanelSettings = FOUR_CHAR_CODE('pset') -sgcSoundCompressionType = FOUR_CHAR_CODE('scmp') -sgcSoundCodecSettingsType = FOUR_CHAR_CODE('cdec') -sgcSoundSampleRateType = FOUR_CHAR_CODE('srat') -sgcSoundChannelCountType = FOUR_CHAR_CODE('schn') -sgcSoundSampleSizeType = FOUR_CHAR_CODE('ssiz') -sgcSoundInputType = FOUR_CHAR_CODE('sinp') -sgcSoundGainType = FOUR_CHAR_CODE('gain') -sgcVideoHueType = FOUR_CHAR_CODE('hue ') -sgcVideoSaturationType = FOUR_CHAR_CODE('satr') -sgcVideoContrastType = FOUR_CHAR_CODE('trst') -sgcVideoSharpnessType = FOUR_CHAR_CODE('shrp') -sgcVideoBrigtnessType = FOUR_CHAR_CODE('brit') -sgcVideoBlackLevelType = FOUR_CHAR_CODE('blkl') -sgcVideoWhiteLevelType = FOUR_CHAR_CODE('whtl') -sgcVideoInputType = FOUR_CHAR_CODE('vinp') -sgcVideoFormatType = FOUR_CHAR_CODE('vstd') -sgcVideoFilterType = FOUR_CHAR_CODE('vflt') -sgcVideoRectType = FOUR_CHAR_CODE('vrct') -sgcVideoDigitizerType = FOUR_CHAR_CODE('vdig') -QTVideoOutputComponentType = FOUR_CHAR_CODE('vout') -QTVideoOutputComponentBaseSubType = FOUR_CHAR_CODE('base') -kQTVideoOutputDontDisplayToUser = 1L << 0 -kQTVODisplayModeItem = FOUR_CHAR_CODE('qdmi') -kQTVODimensions = FOUR_CHAR_CODE('dimn') -kQTVOResolution = FOUR_CHAR_CODE('resl') -kQTVORefreshRate = FOUR_CHAR_CODE('refr') -kQTVOPixelType = FOUR_CHAR_CODE('pixl') -kQTVOName = FOUR_CHAR_CODE('name') -kQTVODecompressors = FOUR_CHAR_CODE('deco') -kQTVODecompressorType = FOUR_CHAR_CODE('dety') -kQTVODecompressorContinuous = FOUR_CHAR_CODE('cont') -kQTVODecompressorComponent = FOUR_CHAR_CODE('cmpt') -kClockGetTimeSelect = 0x0001 -kClockNewCallBackSelect = 0x0002 -kClockDisposeCallBackSelect = 0x0003 -kClockCallMeWhenSelect = 0x0004 -kClockCancelCallBackSelect = 0x0005 -kClockRateChangedSelect = 0x0006 -kClockTimeChangedSelect = 0x0007 -kClockSetTimeBaseSelect = 0x0008 -kClockStartStopChangedSelect = 0x0009 -kClockGetRateSelect = 0x000A -kSCGetCompressionExtendedSelect = 0x0001 -kSCPositionRectSelect = 0x0002 -kSCPositionDialogSelect = 0x0003 -kSCSetTestImagePictHandleSelect = 0x0004 -kSCSetTestImagePictFileSelect = 0x0005 -kSCSetTestImagePixMapSelect = 0x0006 -kSCGetBestDeviceRectSelect = 0x0007 -kSCRequestImageSettingsSelect = 0x000A -kSCCompressImageSelect = 0x000B -kSCCompressPictureSelect = 0x000C -kSCCompressPictureFileSelect = 0x000D -kSCRequestSequenceSettingsSelect = 0x000E -kSCCompressSequenceBeginSelect = 0x000F -kSCCompressSequenceFrameSelect = 0x0010 -kSCCompressSequenceEndSelect = 0x0011 -kSCDefaultPictHandleSettingsSelect = 0x0012 -kSCDefaultPictFileSettingsSelect = 0x0013 -kSCDefaultPixMapSettingsSelect = 0x0014 -kSCGetInfoSelect = 0x0015 -kSCSetInfoSelect = 0x0016 -kSCNewGWorldSelect = 0x0017 -kSCSetCompressFlagsSelect = 0x0018 -kSCGetCompressFlagsSelect = 0x0019 -kSCGetSettingsAsTextSelect = 0x001A -kSCGetSettingsAsAtomContainerSelect = 0x001B -kSCSetSettingsFromAtomContainerSelect = 0x001C -kSCCompressSequenceFrameAsyncSelect = 0x001D -kSCAsyncIdleSelect = 0x001E -kTweenerInitializeSelect = 0x0001 -kTweenerDoTweenSelect = 0x0002 -kTweenerResetSelect = 0x0003 -kTCGetCurrentTimeCodeSelect = 0x0101 -kTCGetTimeCodeAtTimeSelect = 0x0102 -kTCTimeCodeToStringSelect = 0x0103 -kTCTimeCodeToFrameNumberSelect = 0x0104 -kTCFrameNumberToTimeCodeSelect = 0x0105 -kTCGetSourceRefSelect = 0x0106 -kTCSetSourceRefSelect = 0x0107 -kTCSetTimeCodeFlagsSelect = 0x0108 -kTCGetTimeCodeFlagsSelect = 0x0109 -kTCSetDisplayOptionsSelect = 0x010A -kTCGetDisplayOptionsSelect = 0x010B -kMovieImportHandleSelect = 0x0001 -kMovieImportFileSelect = 0x0002 -kMovieImportSetSampleDurationSelect = 0x0003 -kMovieImportSetSampleDescriptionSelect = 0x0004 -kMovieImportSetMediaFileSelect = 0x0005 -kMovieImportSetDimensionsSelect = 0x0006 -kMovieImportSetChunkSizeSelect = 0x0007 -kMovieImportSetProgressProcSelect = 0x0008 -kMovieImportSetAuxiliaryDataSelect = 0x0009 -kMovieImportSetFromScrapSelect = 0x000A -kMovieImportDoUserDialogSelect = 0x000B -kMovieImportSetDurationSelect = 0x000C -kMovieImportGetAuxiliaryDataTypeSelect = 0x000D -kMovieImportValidateSelect = 0x000E -kMovieImportGetFileTypeSelect = 0x000F -kMovieImportDataRefSelect = 0x0010 -kMovieImportGetSampleDescriptionSelect = 0x0011 -kMovieImportGetMIMETypeListSelect = 0x0012 -kMovieImportSetOffsetAndLimitSelect = 0x0013 -kMovieImportGetSettingsAsAtomContainerSelect = 0x0014 -kMovieImportSetSettingsFromAtomContainerSelect = 0x0015 -kMovieImportSetOffsetAndLimit64Select = 0x0016 -kMovieImportIdleSelect = 0x0017 -kMovieImportValidateDataRefSelect = 0x0018 -kMovieImportGetLoadStateSelect = 0x0019 -kMovieImportGetMaxLoadedTimeSelect = 0x001A -kMovieImportEstimateCompletionTimeSelect = 0x001B -kMovieImportSetDontBlockSelect = 0x001C -kMovieImportGetDontBlockSelect = 0x001D -kMovieImportSetIdleManagerSelect = 0x001E -kMovieImportSetNewMovieFlagsSelect = 0x001F -kMovieImportGetDestinationMediaTypeSelect = 0x0020 -kMovieExportToHandleSelect = 0x0080 -kMovieExportToFileSelect = 0x0081 -kMovieExportGetAuxiliaryDataSelect = 0x0083 -kMovieExportSetProgressProcSelect = 0x0084 -kMovieExportSetSampleDescriptionSelect = 0x0085 -kMovieExportDoUserDialogSelect = 0x0086 -kMovieExportGetCreatorTypeSelect = 0x0087 -kMovieExportToDataRefSelect = 0x0088 -kMovieExportFromProceduresToDataRefSelect = 0x0089 -kMovieExportAddDataSourceSelect = 0x008A -kMovieExportValidateSelect = 0x008B -kMovieExportGetSettingsAsAtomContainerSelect = 0x008C -kMovieExportSetSettingsFromAtomContainerSelect = 0x008D -kMovieExportGetFileNameExtensionSelect = 0x008E -kMovieExportGetShortFileTypeStringSelect = 0x008F -kMovieExportGetSourceMediaTypeSelect = 0x0090 -kMovieExportSetGetMoviePropertyProcSelect = 0x0091 -kTextExportGetDisplayDataSelect = 0x0100 -kTextExportGetTimeFractionSelect = 0x0101 -kTextExportSetTimeFractionSelect = 0x0102 -kTextExportGetSettingsSelect = 0x0103 -kTextExportSetSettingsSelect = 0x0104 -kMIDIImportGetSettingsSelect = 0x0100 -kMIDIImportSetSettingsSelect = 0x0101 -kMovieExportNewGetDataAndPropertiesProcsSelect = 0x0100 -kMovieExportDisposeGetDataAndPropertiesProcsSelect = 0x0101 -kGraphicsImageImportSetSequenceEnabledSelect = 0x0100 -kGraphicsImageImportGetSequenceEnabledSelect = 0x0101 -kPreviewShowDataSelect = 0x0001 -kPreviewMakePreviewSelect = 0x0002 -kPreviewMakePreviewReferenceSelect = 0x0003 -kPreviewEventSelect = 0x0004 -kDataCodecDecompressSelect = 0x0001 -kDataCodecGetCompressBufferSizeSelect = 0x0002 -kDataCodecCompressSelect = 0x0003 -kDataCodecBeginInterruptSafeSelect = 0x0004 -kDataCodecEndInterruptSafeSelect = 0x0005 -kDataCodecDecompressPartialSelect = 0x0006 -kDataCodecCompressPartialSelect = 0x0007 -kDataHGetDataSelect = 0x0002 -kDataHPutDataSelect = 0x0003 -kDataHFlushDataSelect = 0x0004 -kDataHOpenForWriteSelect = 0x0005 -kDataHCloseForWriteSelect = 0x0006 -kDataHOpenForReadSelect = 0x0008 -kDataHCloseForReadSelect = 0x0009 -kDataHSetDataRefSelect = 0x000A -kDataHGetDataRefSelect = 0x000B -kDataHCompareDataRefSelect = 0x000C -kDataHTaskSelect = 0x000D -kDataHScheduleDataSelect = 0x000E -kDataHFinishDataSelect = 0x000F -kDataHFlushCacheSelect = 0x0010 -kDataHResolveDataRefSelect = 0x0011 -kDataHGetFileSizeSelect = 0x0012 -kDataHCanUseDataRefSelect = 0x0013 -kDataHGetVolumeListSelect = 0x0014 -kDataHWriteSelect = 0x0015 -kDataHPreextendSelect = 0x0016 -kDataHSetFileSizeSelect = 0x0017 -kDataHGetFreeSpaceSelect = 0x0018 -kDataHCreateFileSelect = 0x0019 -kDataHGetPreferredBlockSizeSelect = 0x001A -kDataHGetDeviceIndexSelect = 0x001B -kDataHIsStreamingDataHandlerSelect = 0x001C -kDataHGetDataInBufferSelect = 0x001D -kDataHGetScheduleAheadTimeSelect = 0x001E -kDataHSetCacheSizeLimitSelect = 0x001F -kDataHGetCacheSizeLimitSelect = 0x0020 -kDataHGetMovieSelect = 0x0021 -kDataHAddMovieSelect = 0x0022 -kDataHUpdateMovieSelect = 0x0023 -kDataHDoesBufferSelect = 0x0024 -kDataHGetFileNameSelect = 0x0025 -kDataHGetAvailableFileSizeSelect = 0x0026 -kDataHGetMacOSFileTypeSelect = 0x0027 -kDataHGetMIMETypeSelect = 0x0028 -kDataHSetDataRefWithAnchorSelect = 0x0029 -kDataHGetDataRefWithAnchorSelect = 0x002A -kDataHSetMacOSFileTypeSelect = 0x002B -kDataHSetTimeBaseSelect = 0x002C -kDataHGetInfoFlagsSelect = 0x002D -kDataHScheduleData64Select = 0x002E -kDataHWrite64Select = 0x002F -kDataHGetFileSize64Select = 0x0030 -kDataHPreextend64Select = 0x0031 -kDataHSetFileSize64Select = 0x0032 -kDataHGetFreeSpace64Select = 0x0033 -kDataHAppend64Select = 0x0034 -kDataHReadAsyncSelect = 0x0035 -kDataHPollReadSelect = 0x0036 -kDataHGetDataAvailabilitySelect = 0x0037 -kDataHGetFileSizeAsyncSelect = 0x003A -kDataHGetDataRefAsTypeSelect = 0x003B -kDataHSetDataRefExtensionSelect = 0x003C -kDataHGetDataRefExtensionSelect = 0x003D -kDataHGetMovieWithFlagsSelect = 0x003E -kDataHGetFileTypeOrderingSelect = 0x0040 -kDataHCreateFileWithFlagsSelect = 0x0041 -kDataHGetMIMETypeAsyncSelect = 0x0042 -kDataHGetInfoSelect = 0x0043 -kDataHSetIdleManagerSelect = 0x0044 -kDataHDeleteFileSelect = 0x0045 -kDataHSetMovieUsageFlagsSelect = 0x0046 -kDataHUseTemporaryDataRefSelect = 0x0047 -kDataHGetTemporaryDataRefCapabilitiesSelect = 0x0048 -kDataHRenameFileSelect = 0x0049 -kDataHPlaybackHintsSelect = 0x0103 -kDataHPlaybackHints64Select = 0x010E -kDataHGetDataRateSelect = 0x0110 -kDataHSetTimeHintsSelect = 0x0111 -kVDGetMaxSrcRectSelect = 0x0001 -kVDGetActiveSrcRectSelect = 0x0002 -kVDSetDigitizerRectSelect = 0x0003 -kVDGetDigitizerRectSelect = 0x0004 -kVDGetVBlankRectSelect = 0x0005 -kVDGetMaskPixMapSelect = 0x0006 -kVDGetPlayThruDestinationSelect = 0x0008 -kVDUseThisCLUTSelect = 0x0009 -kVDSetInputGammaValueSelect = 0x000A -kVDGetInputGammaValueSelect = 0x000B -kVDSetBrightnessSelect = 0x000C -kVDGetBrightnessSelect = 0x000D -kVDSetContrastSelect = 0x000E -kVDSetHueSelect = 0x000F -kVDSetSharpnessSelect = 0x0010 -kVDSetSaturationSelect = 0x0011 -kVDGetContrastSelect = 0x0012 -kVDGetHueSelect = 0x0013 -kVDGetSharpnessSelect = 0x0014 -kVDGetSaturationSelect = 0x0015 -kVDGrabOneFrameSelect = 0x0016 -kVDGetMaxAuxBufferSelect = 0x0017 -kVDGetDigitizerInfoSelect = 0x0019 -kVDGetCurrentFlagsSelect = 0x001A -kVDSetKeyColorSelect = 0x001B -kVDGetKeyColorSelect = 0x001C -kVDAddKeyColorSelect = 0x001D -kVDGetNextKeyColorSelect = 0x001E -kVDSetKeyColorRangeSelect = 0x001F -kVDGetKeyColorRangeSelect = 0x0020 -kVDSetDigitizerUserInterruptSelect = 0x0021 -kVDSetInputColorSpaceModeSelect = 0x0022 -kVDGetInputColorSpaceModeSelect = 0x0023 -kVDSetClipStateSelect = 0x0024 -kVDGetClipStateSelect = 0x0025 -kVDSetClipRgnSelect = 0x0026 -kVDClearClipRgnSelect = 0x0027 -kVDGetCLUTInUseSelect = 0x0028 -kVDSetPLLFilterTypeSelect = 0x0029 -kVDGetPLLFilterTypeSelect = 0x002A -kVDGetMaskandValueSelect = 0x002B -kVDSetMasterBlendLevelSelect = 0x002C -kVDSetPlayThruDestinationSelect = 0x002D -kVDSetPlayThruOnOffSelect = 0x002E -kVDSetFieldPreferenceSelect = 0x002F -kVDGetFieldPreferenceSelect = 0x0030 -kVDPreflightDestinationSelect = 0x0032 -kVDPreflightGlobalRectSelect = 0x0033 -kVDSetPlayThruGlobalRectSelect = 0x0034 -kVDSetInputGammaRecordSelect = 0x0035 -kVDGetInputGammaRecordSelect = 0x0036 -kVDSetBlackLevelValueSelect = 0x0037 -kVDGetBlackLevelValueSelect = 0x0038 -kVDSetWhiteLevelValueSelect = 0x0039 -kVDGetWhiteLevelValueSelect = 0x003A -kVDGetVideoDefaultsSelect = 0x003B -kVDGetNumberOfInputsSelect = 0x003C -kVDGetInputFormatSelect = 0x003D -kVDSetInputSelect = 0x003E -kVDGetInputSelect = 0x003F -kVDSetInputStandardSelect = 0x0040 -kVDSetupBuffersSelect = 0x0041 -kVDGrabOneFrameAsyncSelect = 0x0042 -kVDDoneSelect = 0x0043 -kVDSetCompressionSelect = 0x0044 -kVDCompressOneFrameAsyncSelect = 0x0045 -kVDCompressDoneSelect = 0x0046 -kVDReleaseCompressBufferSelect = 0x0047 -kVDGetImageDescriptionSelect = 0x0048 -kVDResetCompressSequenceSelect = 0x0049 -kVDSetCompressionOnOffSelect = 0x004A -kVDGetCompressionTypesSelect = 0x004B -kVDSetTimeBaseSelect = 0x004C -kVDSetFrameRateSelect = 0x004D -kVDGetDataRateSelect = 0x004E -kVDGetSoundInputDriverSelect = 0x004F -kVDGetDMADepthsSelect = 0x0050 -kVDGetPreferredTimeScaleSelect = 0x0051 -kVDReleaseAsyncBuffersSelect = 0x0052 -kVDSetDataRateSelect = 0x0054 -kVDGetTimeCodeSelect = 0x0055 -kVDUseSafeBuffersSelect = 0x0056 -kVDGetSoundInputSourceSelect = 0x0057 -kVDGetCompressionTimeSelect = 0x0058 -kVDSetPreferredPacketSizeSelect = 0x0059 -kVDSetPreferredImageDimensionsSelect = 0x005A -kVDGetPreferredImageDimensionsSelect = 0x005B -kVDGetInputNameSelect = 0x005C -kVDSetDestinationPortSelect = 0x005D -kVDGetDeviceNameAndFlagsSelect = 0x005E -kVDCaptureStateChangingSelect = 0x005F -kVDGetUniqueIDsSelect = 0x0060 -kVDSelectUniqueIDsSelect = 0x0061 -kXMLParseDataRefSelect = 0x0001 -kXMLParseFileSelect = 0x0002 -kXMLParseDisposeXMLDocSelect = 0x0003 -kXMLParseGetDetailedParseErrorSelect = 0x0004 -kXMLParseAddElementSelect = 0x0005 -kXMLParseAddAttributeSelect = 0x0006 -kXMLParseAddMultipleAttributesSelect = 0x0007 -kXMLParseAddAttributeAndValueSelect = 0x0008 -kXMLParseAddMultipleAttributesAndValuesSelect = 0x0009 -kXMLParseAddAttributeValueKindSelect = 0x000A -kXMLParseAddNameSpaceSelect = 0x000B -kXMLParseSetOffsetAndLimitSelect = 0x000C -kXMLParseSetEventParseRefConSelect = 0x000D -kXMLParseSetStartDocumentHandlerSelect = 0x000E -kXMLParseSetEndDocumentHandlerSelect = 0x000F -kXMLParseSetStartElementHandlerSelect = 0x0010 -kXMLParseSetEndElementHandlerSelect = 0x0011 -kXMLParseSetCharDataHandlerSelect = 0x0012 -kXMLParseSetPreprocessInstructionHandlerSelect = 0x0013 -kXMLParseSetCommentHandlerSelect = 0x0014 -kXMLParseSetCDataHandlerSelect = 0x0015 -kSGInitializeSelect = 0x0001 -kSGSetDataOutputSelect = 0x0002 -kSGGetDataOutputSelect = 0x0003 -kSGSetGWorldSelect = 0x0004 -kSGGetGWorldSelect = 0x0005 -kSGNewChannelSelect = 0x0006 -kSGDisposeChannelSelect = 0x0007 -kSGStartPreviewSelect = 0x0010 -kSGStartRecordSelect = 0x0011 -kSGIdleSelect = 0x0012 -kSGStopSelect = 0x0013 -kSGPauseSelect = 0x0014 -kSGPrepareSelect = 0x0015 -kSGReleaseSelect = 0x0016 -kSGGetMovieSelect = 0x0017 -kSGSetMaximumRecordTimeSelect = 0x0018 -kSGGetMaximumRecordTimeSelect = 0x0019 -kSGGetStorageSpaceRemainingSelect = 0x001A -kSGGetTimeRemainingSelect = 0x001B -kSGGrabPictSelect = 0x001C -kSGGetLastMovieResIDSelect = 0x001D -kSGSetFlagsSelect = 0x001E -kSGGetFlagsSelect = 0x001F -kSGSetDataProcSelect = 0x0020 -kSGNewChannelFromComponentSelect = 0x0021 -kSGDisposeDeviceListSelect = 0x0022 -kSGAppendDeviceListToMenuSelect = 0x0023 -kSGSetSettingsSelect = 0x0024 -kSGGetSettingsSelect = 0x0025 -kSGGetIndChannelSelect = 0x0026 -kSGUpdateSelect = 0x0027 -kSGGetPauseSelect = 0x0028 -kSGSettingsDialogSelect = 0x0029 -kSGGetAlignmentProcSelect = 0x002A -kSGSetChannelSettingsSelect = 0x002B -kSGGetChannelSettingsSelect = 0x002C -kSGGetModeSelect = 0x002D -kSGSetDataRefSelect = 0x002E -kSGGetDataRefSelect = 0x002F -kSGNewOutputSelect = 0x0030 -kSGDisposeOutputSelect = 0x0031 -kSGSetOutputFlagsSelect = 0x0032 -kSGSetChannelOutputSelect = 0x0033 -kSGGetDataOutputStorageSpaceRemainingSelect = 0x0034 -kSGHandleUpdateEventSelect = 0x0035 -kSGSetOutputNextOutputSelect = 0x0036 -kSGGetOutputNextOutputSelect = 0x0037 -kSGSetOutputMaximumOffsetSelect = 0x0038 -kSGGetOutputMaximumOffsetSelect = 0x0039 -kSGGetOutputDataReferenceSelect = 0x003A -kSGWriteExtendedMovieDataSelect = 0x003B -kSGGetStorageSpaceRemaining64Select = 0x003C -kSGGetDataOutputStorageSpaceRemaining64Select = 0x003D -kSGWriteMovieDataSelect = 0x0100 -kSGAddFrameReferenceSelect = 0x0101 -kSGGetNextFrameReferenceSelect = 0x0102 -kSGGetTimeBaseSelect = 0x0103 -kSGSortDeviceListSelect = 0x0104 -kSGAddMovieDataSelect = 0x0105 -kSGChangedSourceSelect = 0x0106 -kSGAddExtendedFrameReferenceSelect = 0x0107 -kSGGetNextExtendedFrameReferenceSelect = 0x0108 -kSGAddExtendedMovieDataSelect = 0x0109 -kSGAddOutputDataRefToMediaSelect = 0x010A -kSGSetSettingsSummarySelect = 0x010B -kSGSetChannelUsageSelect = 0x0080 -kSGGetChannelUsageSelect = 0x0081 -kSGSetChannelBoundsSelect = 0x0082 -kSGGetChannelBoundsSelect = 0x0083 -kSGSetChannelVolumeSelect = 0x0084 -kSGGetChannelVolumeSelect = 0x0085 -kSGGetChannelInfoSelect = 0x0086 -kSGSetChannelPlayFlagsSelect = 0x0087 -kSGGetChannelPlayFlagsSelect = 0x0088 -kSGSetChannelMaxFramesSelect = 0x0089 -kSGGetChannelMaxFramesSelect = 0x008A -kSGSetChannelRefConSelect = 0x008B -kSGSetChannelClipSelect = 0x008C -kSGGetChannelClipSelect = 0x008D -kSGGetChannelSampleDescriptionSelect = 0x008E -kSGGetChannelDeviceListSelect = 0x008F -kSGSetChannelDeviceSelect = 0x0090 -kSGSetChannelMatrixSelect = 0x0091 -kSGGetChannelMatrixSelect = 0x0092 -kSGGetChannelTimeScaleSelect = 0x0093 -kSGChannelPutPictureSelect = 0x0094 -kSGChannelSetRequestedDataRateSelect = 0x0095 -kSGChannelGetRequestedDataRateSelect = 0x0096 -kSGChannelSetDataSourceNameSelect = 0x0097 -kSGChannelGetDataSourceNameSelect = 0x0098 -kSGChannelSetCodecSettingsSelect = 0x0099 -kSGChannelGetCodecSettingsSelect = 0x009A -kSGGetChannelTimeBaseSelect = 0x009B -kSGGetChannelRefConSelect = 0x009C -kSGGetChannelDeviceAndInputNamesSelect = 0x009D -kSGSetChannelDeviceInputSelect = 0x009E -kSGSetChannelSettingsStateChangingSelect = 0x009F -kSGInitChannelSelect = 0x0180 -kSGWriteSamplesSelect = 0x0181 -kSGGetDataRateSelect = 0x0182 -kSGAlignChannelRectSelect = 0x0183 -kSGPanelGetDitlSelect = 0x0200 -kSGPanelGetTitleSelect = 0x0201 -kSGPanelCanRunSelect = 0x0202 -kSGPanelInstallSelect = 0x0203 -kSGPanelEventSelect = 0x0204 -kSGPanelItemSelect = 0x0205 -kSGPanelRemoveSelect = 0x0206 -kSGPanelSetGrabberSelect = 0x0207 -kSGPanelSetResFileSelect = 0x0208 -kSGPanelGetSettingsSelect = 0x0209 -kSGPanelSetSettingsSelect = 0x020A -kSGPanelValidateInputSelect = 0x020B -kSGPanelSetEventFilterSelect = 0x020C -kSGPanelGetDITLForSizeSelect = 0x020D -kSGGetSrcVideoBoundsSelect = 0x0100 -kSGSetVideoRectSelect = 0x0101 -kSGGetVideoRectSelect = 0x0102 -kSGGetVideoCompressorTypeSelect = 0x0103 -kSGSetVideoCompressorTypeSelect = 0x0104 -kSGSetVideoCompressorSelect = 0x0105 -kSGGetVideoCompressorSelect = 0x0106 -kSGGetVideoDigitizerComponentSelect = 0x0107 -kSGSetVideoDigitizerComponentSelect = 0x0108 -kSGVideoDigitizerChangedSelect = 0x0109 -kSGSetVideoBottlenecksSelect = 0x010A -kSGGetVideoBottlenecksSelect = 0x010B -kSGGrabFrameSelect = 0x010C -kSGGrabFrameCompleteSelect = 0x010D -kSGDisplayFrameSelect = 0x010E -kSGCompressFrameSelect = 0x010F -kSGCompressFrameCompleteSelect = 0x0110 -kSGAddFrameSelect = 0x0111 -kSGTransferFrameForCompressSelect = 0x0112 -kSGSetCompressBufferSelect = 0x0113 -kSGGetCompressBufferSelect = 0x0114 -kSGGetBufferInfoSelect = 0x0115 -kSGSetUseScreenBufferSelect = 0x0116 -kSGGetUseScreenBufferSelect = 0x0117 -kSGGrabCompressCompleteSelect = 0x0118 -kSGDisplayCompressSelect = 0x0119 -kSGSetFrameRateSelect = 0x011A -kSGGetFrameRateSelect = 0x011B -kSGSetPreferredPacketSizeSelect = 0x0121 -kSGGetPreferredPacketSizeSelect = 0x0122 -kSGSetUserVideoCompressorListSelect = 0x0123 -kSGGetUserVideoCompressorListSelect = 0x0124 -kSGSetSoundInputDriverSelect = 0x0100 -kSGGetSoundInputDriverSelect = 0x0101 -kSGSoundInputDriverChangedSelect = 0x0102 -kSGSetSoundRecordChunkSizeSelect = 0x0103 -kSGGetSoundRecordChunkSizeSelect = 0x0104 -kSGSetSoundInputRateSelect = 0x0105 -kSGGetSoundInputRateSelect = 0x0106 -kSGSetSoundInputParametersSelect = 0x0107 -kSGGetSoundInputParametersSelect = 0x0108 -kSGSetAdditionalSoundRatesSelect = 0x0109 -kSGGetAdditionalSoundRatesSelect = 0x010A -kSGSetFontNameSelect = 0x0100 -kSGSetFontSizeSelect = 0x0101 -kSGSetTextForeColorSelect = 0x0102 -kSGSetTextBackColorSelect = 0x0103 -kSGSetJustificationSelect = 0x0104 -kSGGetTextReturnToSpaceValueSelect = 0x0105 -kSGSetTextReturnToSpaceValueSelect = 0x0106 -kSGGetInstrumentSelect = 0x0100 -kSGSetInstrumentSelect = 0x0101 -kQTVideoOutputGetDisplayModeListSelect = 0x0001 -kQTVideoOutputGetCurrentClientNameSelect = 0x0002 -kQTVideoOutputSetClientNameSelect = 0x0003 -kQTVideoOutputGetClientNameSelect = 0x0004 -kQTVideoOutputBeginSelect = 0x0005 -kQTVideoOutputEndSelect = 0x0006 -kQTVideoOutputSetDisplayModeSelect = 0x0007 -kQTVideoOutputGetDisplayModeSelect = 0x0008 -kQTVideoOutputCustomConfigureDisplaySelect = 0x0009 -kQTVideoOutputSaveStateSelect = 0x000A -kQTVideoOutputRestoreStateSelect = 0x000B -kQTVideoOutputGetGWorldSelect = 0x000C -kQTVideoOutputGetGWorldParametersSelect = 0x000D -kQTVideoOutputGetIndSoundOutputSelect = 0x000E -kQTVideoOutputGetClockSelect = 0x000F -kQTVideoOutputSetEchoPortSelect = 0x0010 -kQTVideoOutputGetIndImageDecompressorSelect = 0x0011 -kQTVideoOutputBaseSetEchoPortSelect = 0x0012 -handlerHasSpatial = 1 << 0 -handlerCanClip = 1 << 1 -handlerCanMatte = 1 << 2 -handlerCanTransferMode = 1 << 3 -handlerNeedsBuffer = 1 << 4 -handlerNoIdle = 1 << 5 -handlerNoScheduler = 1 << 6 -handlerWantsTime = 1 << 7 -handlerCGrafPortOnly = 1 << 8 -handlerCanSend = 1 << 9 -handlerCanHandleComplexMatrix = 1 << 10 -handlerWantsDestinationPixels = 1 << 11 -handlerCanSendImageData = 1 << 12 -handlerCanPicSave = 1 << 13 -mMustDraw = 1 << 3 -mAtEnd = 1 << 4 -mPreflightDraw = 1 << 5 -mSyncDrawing = 1 << 6 -mPrecompositeOnly = 1 << 9 -mSoundOnly = 1 << 10 -mDoIdleActionsBeforeDraws = 1 << 11 -mDisableIdleActions = 1 << 12 -mDidDraw = 1 << 0 -mNeedsToDraw = 1 << 2 -mDrawAgain = 1 << 3 -mPartialDraw = 1 << 4 -mWantIdleActions = 1 << 5 -forceUpdateRedraw = 1 << 0 -forceUpdateNewBuffer = 1 << 1 -mHitTestBounds = 1L << 0 -mHitTestImage = 1L << 1 -mHitTestInvisible = 1L << 2 -mHitTestIsClick = 1L << 3 -mOpaque = 1L << 0 -mInvisible = 1L << 1 -kMediaQTIdleFrequencySelector = FOUR_CHAR_CODE('idfq') -kMediaVideoParamBrightness = 1 -kMediaVideoParamContrast = 2 -kMediaVideoParamHue = 3 -kMediaVideoParamSharpness = 4 -kMediaVideoParamSaturation = 5 -kMediaVideoParamBlackLevel = 6 -kMediaVideoParamWhiteLevel = 7 -kMHInfoEncodedFrameRate = FOUR_CHAR_CODE('orat') -kEmptyPurgableChunksOverAllowance = 1 -kCallComponentExecuteWiredActionSelect = -9 -kMediaSetChunkManagementFlagsSelect = 0x0415 -kMediaGetChunkManagementFlagsSelect = 0x0416 -kMediaSetPurgeableChunkMemoryAllowanceSelect = 0x0417 -kMediaGetPurgeableChunkMemoryAllowanceSelect = 0x0418 -kMediaEmptyAllPurgeableChunksSelect = 0x0419 -kMediaInitializeSelect = 0x0501 -kMediaSetHandlerCapabilitiesSelect = 0x0502 -kMediaIdleSelect = 0x0503 -kMediaGetMediaInfoSelect = 0x0504 -kMediaPutMediaInfoSelect = 0x0505 -kMediaSetActiveSelect = 0x0506 -kMediaSetRateSelect = 0x0507 -kMediaGGetStatusSelect = 0x0508 -kMediaTrackEditedSelect = 0x0509 -kMediaSetMediaTimeScaleSelect = 0x050A -kMediaSetMovieTimeScaleSelect = 0x050B -kMediaSetGWorldSelect = 0x050C -kMediaSetDimensionsSelect = 0x050D -kMediaSetClipSelect = 0x050E -kMediaSetMatrixSelect = 0x050F -kMediaGetTrackOpaqueSelect = 0x0510 -kMediaSetGraphicsModeSelect = 0x0511 -kMediaGetGraphicsModeSelect = 0x0512 -kMediaGSetVolumeSelect = 0x0513 -kMediaSetSoundBalanceSelect = 0x0514 -kMediaGetSoundBalanceSelect = 0x0515 -kMediaGetNextBoundsChangeSelect = 0x0516 -kMediaGetSrcRgnSelect = 0x0517 -kMediaPrerollSelect = 0x0518 -kMediaSampleDescriptionChangedSelect = 0x0519 -kMediaHasCharacteristicSelect = 0x051A -kMediaGetOffscreenBufferSizeSelect = 0x051B -kMediaSetHintsSelect = 0x051C -kMediaGetNameSelect = 0x051D -kMediaForceUpdateSelect = 0x051E -kMediaGetDrawingRgnSelect = 0x051F -kMediaGSetActiveSegmentSelect = 0x0520 -kMediaInvalidateRegionSelect = 0x0521 -kMediaGetNextStepTimeSelect = 0x0522 -kMediaSetNonPrimarySourceDataSelect = 0x0523 -kMediaChangedNonPrimarySourceSelect = 0x0524 -kMediaTrackReferencesChangedSelect = 0x0525 -kMediaGetSampleDataPointerSelect = 0x0526 -kMediaReleaseSampleDataPointerSelect = 0x0527 -kMediaTrackPropertyAtomChangedSelect = 0x0528 -kMediaSetTrackInputMapReferenceSelect = 0x0529 -kMediaSetVideoParamSelect = 0x052B -kMediaGetVideoParamSelect = 0x052C -kMediaCompareSelect = 0x052D -kMediaGetClockSelect = 0x052E -kMediaSetSoundOutputComponentSelect = 0x052F -kMediaGetSoundOutputComponentSelect = 0x0530 -kMediaSetSoundLocalizationDataSelect = 0x0531 -kMediaGetInvalidRegionSelect = 0x053C -kMediaSampleDescriptionB2NSelect = 0x053E -kMediaSampleDescriptionN2BSelect = 0x053F -kMediaQueueNonPrimarySourceDataSelect = 0x0540 -kMediaFlushNonPrimarySourceDataSelect = 0x0541 -kMediaGetURLLinkSelect = 0x0543 -kMediaMakeMediaTimeTableSelect = 0x0545 -kMediaHitTestForTargetRefConSelect = 0x0546 -kMediaHitTestTargetRefConSelect = 0x0547 -kMediaGetActionsForQTEventSelect = 0x0548 -kMediaDisposeTargetRefConSelect = 0x0549 -kMediaTargetRefConsEqualSelect = 0x054A -kMediaSetActionsCallbackSelect = 0x054B -kMediaPrePrerollBeginSelect = 0x054C -kMediaPrePrerollCancelSelect = 0x054D -kMediaEnterEmptyEditSelect = 0x054F -kMediaCurrentMediaQueuedDataSelect = 0x0550 -kMediaGetEffectiveVolumeSelect = 0x0551 -kMediaResolveTargetRefConSelect = 0x0552 -kMediaGetSoundLevelMeteringEnabledSelect = 0x0553 -kMediaSetSoundLevelMeteringEnabledSelect = 0x0554 -kMediaGetSoundLevelMeterInfoSelect = 0x0555 -kMediaGetEffectiveSoundBalanceSelect = 0x0556 -kMediaSetScreenLockSelect = 0x0557 -kMediaSetDoMCActionCallbackSelect = 0x0558 -kMediaGetErrorStringSelect = 0x0559 -kMediaGetSoundEqualizerBandsSelect = 0x055A -kMediaSetSoundEqualizerBandsSelect = 0x055B -kMediaGetSoundEqualizerBandLevelsSelect = 0x055C -kMediaDoIdleActionsSelect = 0x055D -kMediaSetSoundBassAndTrebleSelect = 0x055E -kMediaGetSoundBassAndTrebleSelect = 0x055F -kMediaTimeBaseChangedSelect = 0x0560 -kMediaMCIsPlayerEventSelect = 0x0561 -kMediaGetMediaLoadStateSelect = 0x0562 -kMediaVideoOutputChangedSelect = 0x0563 -kMediaEmptySampleCacheSelect = 0x0564 -kMediaGetPublicInfoSelect = 0x0565 -kMediaSetPublicInfoSelect = 0x0566 -kMediaGetUserPreferredCodecsSelect = 0x0567 -kMediaSetUserPreferredCodecsSelect = 0x0568 -kMediaRefConSetPropertySelect = 0x0569 -kMediaRefConGetPropertySelect = 0x056A -kMediaNavigateTargetRefConSelect = 0x056B -kMediaGGetIdleManagerSelect = 0x056C -kMediaGSetIdleManagerSelect = 0x056D -kaiToneDescType = FOUR_CHAR_CODE('tone') -kaiNoteRequestInfoType = FOUR_CHAR_CODE('ntrq') -kaiKnobListType = FOUR_CHAR_CODE('knbl') -kaiKeyRangeInfoType = FOUR_CHAR_CODE('sinf') -kaiSampleDescType = FOUR_CHAR_CODE('sdsc') -kaiSampleInfoType = FOUR_CHAR_CODE('smin') -kaiSampleDataType = FOUR_CHAR_CODE('sdat') -kaiSampleDataQUIDType = FOUR_CHAR_CODE('quid') -kaiInstInfoType = FOUR_CHAR_CODE('iinf') -kaiPictType = FOUR_CHAR_CODE('pict') -kaiWriterType = FOUR_CHAR_CODE('\xa9wrt') -kaiCopyrightType = FOUR_CHAR_CODE('\xa9cpy') -kaiOtherStrType = FOUR_CHAR_CODE('str ') -kaiInstrumentRefType = FOUR_CHAR_CODE('iref') -kaiInstGMQualityType = FOUR_CHAR_CODE('qual') -kaiLibraryInfoType = FOUR_CHAR_CODE('linf') -kaiLibraryDescType = FOUR_CHAR_CODE('ldsc') -kInstKnobMissingUnknown = 0 -kInstKnobMissingDefault = (1 << 0) -kMusicLoopTypeNormal = 0 -kMusicLoopTypePalindrome = 1 -instSamplePreProcessFlag = 1 << 0 -kQTMIDIComponentType = FOUR_CHAR_CODE('midi') -kOMSComponentSubType = FOUR_CHAR_CODE('OMS ') -kFMSComponentSubType = FOUR_CHAR_CODE('FMS ') -kMIDIManagerComponentSubType = FOUR_CHAR_CODE('mmgr') -kOSXMIDIComponentSubType = FOUR_CHAR_CODE('osxm') -kMusicPacketPortLost = 1 -kMusicPacketPortFound = 2 -kMusicPacketTimeGap = 3 -kAppleSysexID = 0x11 -kAppleSysexCmdSampleSize = 0x0001 -kAppleSysexCmdSampleBreak = 0x0002 -kAppleSysexCmdAtomicInstrument = 0x0010 -kAppleSysexCmdDeveloper = 0x7F00 -kSynthesizerConnectionFMS = 1 -kSynthesizerConnectionMMgr = 2 -kSynthesizerConnectionOMS = 4 -kSynthesizerConnectionQT = 8 -kSynthesizerConnectionOSXMIDI = 16 -kSynthesizerConnectionUnavailable = 256 -kMusicComponentType = FOUR_CHAR_CODE('musi') -kInstrumentComponentType = FOUR_CHAR_CODE('inst') -kSoftSynthComponentSubType = FOUR_CHAR_CODE('ss ') -kGMSynthComponentSubType = FOUR_CHAR_CODE('gm ') -kSynthesizerDynamicVoice = 1 << 0 -kSynthesizerUsesMIDIPort = 1 << 1 -kSynthesizerMicrotone = 1 << 2 -kSynthesizerHasSamples = 1 << 3 -kSynthesizerMixedDrums = 1 << 4 -kSynthesizerSoftware = 1 << 5 -kSynthesizerHardware = 1 << 6 -kSynthesizerDynamicChannel = 1 << 7 -kSynthesizerHogsSystemChannel = 1 << 8 -kSynthesizerHasSystemChannel = 1 << 9 -kSynthesizerSlowSetPart = 1 << 10 -kSynthesizerOffline = 1 << 12 -kSynthesizerGM = 1 << 14 -kSynthesizerDLS = 1 << 15 -kSynthesizerSoundLocalization = 1 << 16 -kControllerModulationWheel = 1 -kControllerBreath = 2 -kControllerFoot = 4 -kControllerPortamentoTime = 5 -kControllerVolume = 7 -kControllerBalance = 8 -kControllerPan = 10 -kControllerExpression = 11 -kControllerLever1 = 16 -kControllerLever2 = 17 -kControllerLever3 = 18 -kControllerLever4 = 19 -kControllerLever5 = 80 -kControllerLever6 = 81 -kControllerLever7 = 82 -kControllerLever8 = 83 -kControllerPitchBend = 32 -kControllerAfterTouch = 33 -kControllerPartTranspose = 40 -kControllerTuneTranspose = 41 -kControllerPartVolume = 42 -kControllerTuneVolume = 43 -kControllerSustain = 64 -kControllerPortamento = 65 -kControllerSostenuto = 66 -kControllerSoftPedal = 67 -kControllerReverb = 91 -kControllerTremolo = 92 -kControllerChorus = 93 -kControllerCeleste = 94 -kControllerPhaser = 95 -kControllerEditPart = 113 -kControllerMasterTune = 114 -kControllerMasterTranspose = 114 -kControllerMasterVolume = 115 -kControllerMasterCPULoad = 116 -kControllerMasterPolyphony = 117 -kControllerMasterFeatures = 118 -kQTMSKnobStartID = 0x02000000 -kQTMSKnobVolumeAttackTimeID = 0x02000001 -kQTMSKnobVolumeDecayTimeID = 0x02000002 -kQTMSKnobVolumeSustainLevelID = 0x02000003 -kQTMSKnobVolumeRelease1RateID = 0x02000004 -kQTMSKnobVolumeDecayKeyScalingID = 0x02000005 -kQTMSKnobVolumeReleaseTimeID = 0x02000006 -kQTMSKnobVolumeLFODelayID = 0x02000007 -kQTMSKnobVolumeLFORampTimeID = 0x02000008 -kQTMSKnobVolumeLFOPeriodID = 0x02000009 -kQTMSKnobVolumeLFOShapeID = 0x0200000A -kQTMSKnobVolumeLFODepthID = 0x0200000B -kQTMSKnobVolumeOverallID = 0x0200000C -kQTMSKnobVolumeVelocity127ID = 0x0200000D -kQTMSKnobVolumeVelocity96ID = 0x0200000E -kQTMSKnobVolumeVelocity64ID = 0x0200000F -kQTMSKnobVolumeVelocity32ID = 0x02000010 -kQTMSKnobVolumeVelocity16ID = 0x02000011 -kQTMSKnobPitchTransposeID = 0x02000012 -kQTMSKnobPitchLFODelayID = 0x02000013 -kQTMSKnobPitchLFORampTimeID = 0x02000014 -kQTMSKnobPitchLFOPeriodID = 0x02000015 -kQTMSKnobPitchLFOShapeID = 0x02000016 -kQTMSKnobPitchLFODepthID = 0x02000017 -kQTMSKnobPitchLFOQuantizeID = 0x02000018 -kQTMSKnobStereoDefaultPanID = 0x02000019 -kQTMSKnobStereoPositionKeyScalingID = 0x0200001A -kQTMSKnobPitchLFOOffsetID = 0x0200001B -kQTMSKnobExclusionGroupID = 0x0200001C -kQTMSKnobSustainTimeID = 0x0200001D -kQTMSKnobSustainInfiniteID = 0x0200001E -kQTMSKnobVolumeLFOStereoID = 0x0200001F -kQTMSKnobVelocityLowID = 0x02000020 -kQTMSKnobVelocityHighID = 0x02000021 -kQTMSKnobVelocitySensitivityID = 0x02000022 -kQTMSKnobPitchSensitivityID = 0x02000023 -kQTMSKnobVolumeLFODepthFromWheelID = 0x02000024 -kQTMSKnobPitchLFODepthFromWheelID = 0x02000025 -kQTMSKnobVolumeExpOptionsID = 0x02000026 -kQTMSKnobEnv1AttackTimeID = 0x02000027 -kQTMSKnobEnv1DecayTimeID = 0x02000028 -kQTMSKnobEnv1SustainLevelID = 0x02000029 -kQTMSKnobEnv1SustainTimeID = 0x0200002A -kQTMSKnobEnv1SustainInfiniteID = 0x0200002B -kQTMSKnobEnv1ReleaseTimeID = 0x0200002C -kQTMSKnobEnv1ExpOptionsID = 0x0200002D -kQTMSKnobEnv2AttackTimeID = 0x0200002E -kQTMSKnobEnv2DecayTimeID = 0x0200002F -kQTMSKnobEnv2SustainLevelID = 0x02000030 -kQTMSKnobEnv2SustainTimeID = 0x02000031 -kQTMSKnobEnv2SustainInfiniteID = 0x02000032 -kQTMSKnobEnv2ReleaseTimeID = 0x02000033 -kQTMSKnobEnv2ExpOptionsID = 0x02000034 -kQTMSKnobPitchEnvelopeID = 0x02000035 -kQTMSKnobPitchEnvelopeDepthID = 0x02000036 -kQTMSKnobFilterKeyFollowID = 0x02000037 -kQTMSKnobFilterTransposeID = 0x02000038 -kQTMSKnobFilterQID = 0x02000039 -kQTMSKnobFilterFrequencyEnvelopeID = 0x0200003A -kQTMSKnobFilterFrequencyEnvelopeDepthID = 0x0200003B -kQTMSKnobFilterQEnvelopeID = 0x0200003C -kQTMSKnobFilterQEnvelopeDepthID = 0x0200003D -kQTMSKnobReverbThresholdID = 0x0200003E -kQTMSKnobVolumeAttackVelScalingID = 0x0200003F -kQTMSKnobLastIDPlus1 = 0x02000040 -kControllerMaximum = 0x00007FFF -# kControllerMinimum = (long)0xFFFF8000 -kVoiceCountDynamic = -1 -kFirstGMInstrument = 0x00000001 -kLastGMInstrument = 0x00000080 -kFirstGSInstrument = 0x00000081 -kLastGSInstrument = 0x00003FFF -kFirstDrumkit = 0x00004000 -kLastDrumkit = 0x00004080 -kFirstROMInstrument = 0x00008000 -kLastROMInstrument = 0x0000FFFF -kFirstUserInstrument = 0x00010000 -kLastUserInstrument = 0x0001FFFF -kInstrumentMatchSynthesizerType = 1 -kInstrumentMatchSynthesizerName = 2 -kInstrumentMatchName = 4 -kInstrumentMatchNumber = 8 -kInstrumentMatchGMNumber = 16 -kInstrumentMatchGSNumber = 32 -kKnobBasic = 8 -kKnobReadOnly = 16 -kKnobInterruptUnsafe = 32 -kKnobKeyrangeOverride = 64 -kKnobGroupStart = 128 -kKnobFixedPoint8 = 1024 -kKnobFixedPoint16 = 2048 -kKnobTypeNumber = 0 << 12 -kKnobTypeGroupName = 1 << 12 -kKnobTypeBoolean = 2 << 12 -kKnobTypeNote = 3 << 12 -kKnobTypePan = 4 << 12 -kKnobTypeInstrument = 5 << 12 -kKnobTypeSetting = 6 << 12 -kKnobTypeMilliseconds = 7 << 12 -kKnobTypePercentage = 8 << 12 -kKnobTypeHertz = 9 << 12 -kKnobTypeButton = 10 << 12 -kUnknownKnobValue = 0x7FFFFFFF -kDefaultKnobValue = 0x7FFFFFFE -notImplementedMusicErr = (0x80000000 | (0xFFFF & (notImplementedMusicOSErr))) -cantSendToSynthesizerErr = (0x80000000 | (0xFFFF & (cantSendToSynthesizerOSErr))) -cantReceiveFromSynthesizerErr = (0x80000000 | (0xFFFF & (cantReceiveFromSynthesizerOSErr))) -illegalVoiceAllocationErr = (0x80000000 | (0xFFFF & (illegalVoiceAllocationOSErr))) -illegalPartErr = (0x80000000 | (0xFFFF & (illegalPartOSErr))) -illegalChannelErr = (0x80000000 | (0xFFFF & (illegalChannelOSErr))) -illegalKnobErr = (0x80000000 | (0xFFFF & (illegalKnobOSErr))) -illegalKnobValueErr = (0x80000000 | (0xFFFF & (illegalKnobValueOSErr))) -illegalInstrumentErr = (0x80000000 | (0xFFFF & (illegalInstrumentOSErr))) -illegalControllerErr = (0x80000000 | (0xFFFF & (illegalControllerOSErr))) -midiManagerAbsentErr = (0x80000000 | (0xFFFF & (midiManagerAbsentOSErr))) -synthesizerNotRespondingErr = (0x80000000 | (0xFFFF & (synthesizerNotRespondingOSErr))) -synthesizerErr = (0x80000000 | (0xFFFF & (synthesizerOSErr))) -illegalNoteChannelErr = (0x80000000 | (0xFFFF & (illegalNoteChannelOSErr))) -noteChannelNotAllocatedErr = (0x80000000 | (0xFFFF & (noteChannelNotAllocatedOSErr))) -tunePlayerFullErr = (0x80000000 | (0xFFFF & (tunePlayerFullOSErr))) -tuneParseErr = (0x80000000 | (0xFFFF & (tuneParseOSErr))) -kGetAtomicInstNoExpandedSamples = 1 << 0 -kGetAtomicInstNoOriginalSamples = 1 << 1 -kGetAtomicInstNoSamples = kGetAtomicInstNoExpandedSamples | kGetAtomicInstNoOriginalSamples -kGetAtomicInstNoKnobList = 1 << 2 -kGetAtomicInstNoInstrumentInfo = 1 << 3 -kGetAtomicInstOriginalKnobList = 1 << 4 -kGetAtomicInstAllKnobs = 1 << 5 -kSetAtomicInstKeepOriginalInstrument = 1 << 0 -kSetAtomicInstShareAcrossParts = 1 << 1 -kSetAtomicInstCallerTosses = 1 << 2 -kSetAtomicInstCallerGuarantees = 1 << 3 -kSetAtomicInstInterruptSafe = 1 << 4 -kSetAtomicInstDontPreprocess = 1 << 7 -kInstrumentNamesModifiable = 1 -kInstrumentNamesBoth = 2 -kGenericMusicComponentSubtype = FOUR_CHAR_CODE('gene') -kGenericMusicKnob = 1 -kGenericMusicInstrumentKnob = 2 -kGenericMusicDrumKnob = 3 -kGenericMusicGlobalController = 4 -kGenericMusicResFirst = 0 -kGenericMusicResMiscStringList = 1 -kGenericMusicResMiscLongList = 2 -kGenericMusicResInstrumentList = 3 -kGenericMusicResDrumList = 4 -kGenericMusicResInstrumentKnobDescriptionList = 5 -kGenericMusicResDrumKnobDescriptionList = 6 -kGenericMusicResKnobDescriptionList = 7 -kGenericMusicResBitsLongList = 8 -kGenericMusicResModifiableInstrumentHW = 9 -kGenericMusicResGMTranslation = 10 -kGenericMusicResROMInstrumentData = 11 -kGenericMusicResAboutPICT = 12 -kGenericMusicResLast = 13 -kGenericMusicMiscLongFirst = 0 -kGenericMusicMiscLongVoiceCount = 1 -kGenericMusicMiscLongPartCount = 2 -kGenericMusicMiscLongModifiableInstrumentCount = 3 -kGenericMusicMiscLongChannelMask = 4 -kGenericMusicMiscLongDrumPartCount = 5 -kGenericMusicMiscLongModifiableDrumCount = 6 -kGenericMusicMiscLongDrumChannelMask = 7 -kGenericMusicMiscLongOutputCount = 8 -kGenericMusicMiscLongLatency = 9 -kGenericMusicMiscLongFlags = 10 -kGenericMusicMiscLongFirstGMHW = 11 -kGenericMusicMiscLongFirstGMDrumHW = 12 -kGenericMusicMiscLongFirstUserHW = 13 -kGenericMusicMiscLongLast = 14 -kMusicGenericRange = 0x0100 -kMusicDerivedRange = 0x0200 -kGenericMusicDoMIDI = 1 << 0 -kGenericMusicBank0 = 1 << 1 -kGenericMusicBank32 = 1 << 2 -kGenericMusicErsatzMIDI = 1 << 3 -kGenericMusicCallKnobs = 1 << 4 -kGenericMusicCallParts = 1 << 5 -kGenericMusicCallInstrument = 1 << 6 -kGenericMusicCallNumber = 1 << 7 -kGenericMusicCallROMInstrument = 1 << 8 -kGenericMusicAllDefaults = 1 << 9 -kGetInstrumentInfoNoBuiltIn = 1 << 0 -kGetInstrumentInfoMidiUserInst = 1 << 1 -kGetInstrumentInfoNoIText = 1 << 2 -kNoteRequestNoGM = 1 -kNoteRequestNoSynthType = 2 -kNoteRequestSynthMustMatch = 4 -kNoteRequestSpecifyMIDIChannel = 0x80 -kPickDontMix = 1 -kPickSameSynth = 2 -kPickUserInsts = 4 -kPickEditAllowEdit = 8 -kPickEditAllowPick = 16 -kPickEditSynthGlobal = 32 -kPickEditControllers = 64 -kNoteAllocatorComponentType = FOUR_CHAR_CODE('nota') -kNADummyOneSelect = 29 -kNADummyTwoSelect = 30 -kTuneQueueDepth = 8 -kTunePlayerComponentType = FOUR_CHAR_CODE('tune') -kTuneStartNow = 1 -kTuneDontClipNotes = 2 -kTuneExcludeEdgeNotes = 4 -kTuneQuickStart = 8 -kTuneLoopUntil = 16 -kTunePlayDifference = 32 -kTunePlayConcurrent = 64 -kTuneStartNewMaster = 16384 -kTuneStopFade = 1 -kTuneStopSustain = 2 -kTuneStopInstant = 4 -kTuneStopReleaseChannels = 8 -kTuneMixMute = 1 -kTuneMixSolo = 2 -kRestEventType = 0x00000000 -kNoteEventType = 0x00000001 -kControlEventType = 0x00000002 -kMarkerEventType = 0x00000003 -kUndefined1EventType = 0x00000008 -kXNoteEventType = 0x00000009 -kXControlEventType = 0x0000000A -kKnobEventType = 0x0000000B -kUndefined2EventType = 0x0000000C -kUndefined3EventType = 0x0000000D -kUndefined4EventType = 0x0000000E -kGeneralEventType = 0x0000000F -kXEventLengthBits = 0x00000002 -kGeneralEventLengthBits = 0x00000003 -kEventLen = 1L -kXEventLen = 2L -kRestEventLen = kEventLen -kNoteEventLen = kEventLen -kControlEventLen = kEventLen -kMarkerEventLen = kEventLen -kXNoteEventLen = kXEventLen -kXControlEventLen = kXEventLen -kGeneralEventLen = kXEventLen -kEventLengthFieldPos = 30 -kEventLengthFieldWidth = 2 -kEventTypeFieldPos = 29 -kEventTypeFieldWidth = 3 -kXEventTypeFieldPos = 28 -kXEventTypeFieldWidth = 4 -kEventPartFieldPos = 24 -kEventPartFieldWidth = 5 -kXEventPartFieldPos = 16 -kXEventPartFieldWidth = 12 -kRestEventDurationFieldPos = 0 -kRestEventDurationFieldWidth = 24 -kRestEventDurationMax = ((1L << kRestEventDurationFieldWidth) - 1) -kNoteEventPitchFieldPos = 18 -kNoteEventPitchFieldWidth = 6 -kNoteEventPitchOffset = 32 -kNoteEventVolumeFieldPos = 11 -kNoteEventVolumeFieldWidth = 7 -kNoteEventVolumeOffset = 0 -kNoteEventDurationFieldPos = 0 -kNoteEventDurationFieldWidth = 11 -kNoteEventDurationMax = ((1L << kNoteEventDurationFieldWidth) - 1) -kXNoteEventPitchFieldPos = 0 -kXNoteEventPitchFieldWidth = 16 -kXNoteEventDurationFieldPos = 0 -kXNoteEventDurationFieldWidth = 22 -kXNoteEventDurationMax = ((1L << kXNoteEventDurationFieldWidth) - 1) -kXNoteEventVolumeFieldPos = 22 -kXNoteEventVolumeFieldWidth = 7 -kControlEventControllerFieldPos = 16 -kControlEventControllerFieldWidth = 8 -kControlEventValueFieldPos = 0 -kControlEventValueFieldWidth = 16 -kXControlEventControllerFieldPos = 0 -kXControlEventControllerFieldWidth = 16 -kXControlEventValueFieldPos = 0 -kXControlEventValueFieldWidth = 16 -kKnobEventValueHighFieldPos = 0 -kKnobEventValueHighFieldWidth = 16 -kKnobEventKnobFieldPos = 16 -kKnobEventKnobFieldWidth = 14 -kKnobEventValueLowFieldPos = 0 -kKnobEventValueLowFieldWidth = 16 -kMarkerEventSubtypeFieldPos = 16 -kMarkerEventSubtypeFieldWidth = 8 -kMarkerEventValueFieldPos = 0 -kMarkerEventValueFieldWidth = 16 -kGeneralEventSubtypeFieldPos = 16 -kGeneralEventSubtypeFieldWidth = 14 -kGeneralEventLengthFieldPos = 0 -kGeneralEventLengthFieldWidth = 16 -kEndMarkerValue = 0x00000060 -kEndMarkerValue = 0x60000000 -# _ext = qtma_EXT(*lP -# ulen = (_ext < 2) ? 1 : 2 -# ulen = (unsigned short)qtma_EXT(*lP -# ulen = lP[1] -# _ext = qtma_EXT(*lP -# ulen = (_ext < 2) ? 1 : 2 -# ulen = (unsigned short)qtma_EXT(*lP -# ulen = lP[-1] -# x = (kRestEventType << kEventTypeFieldPos) \ -# x = EndianU32_NtoB(x) ) -# x = (kNoteEventType << kEventTypeFieldPos) \ -# x = EndianU32_NtoB(x) ) -# x = (kControlEventType << kEventTypeFieldPos) \ -# x = EndianU32_NtoB(x) ) -# x = (kMarkerEventType << kEventTypeFieldPos) \ -# x = EndianU32_NtoB(x) ) -# w1 = (kXNoteEventType << kXEventTypeFieldPos) \ -# w1 = EndianU32_NtoB(w1) -# w2 = (kXEventLengthBits << kEventLengthFieldPos) \ -# w2 = EndianU32_NtoB(w2) ) -# w1 = (kXControlEventType << kXEventTypeFieldPos) \ -# w1 = EndianU32_NtoB(w1) -# w2 = (kXEventLengthBits << kEventLengthFieldPos) \ -# w2 = EndianU32_NtoB(w2) ) -# w1 = (kKnobEventType << kXEventTypeFieldPos) \ -# w1 = EndianU32_NtoB(w1) -# w2 = (kXEventLengthBits << kEventLengthFieldPos) \ -# w2 = EndianU32_NtoB(w2) ) -# w1 = (kGeneralEventType << kXEventTypeFieldPos) \ -# w1 = EndianU32_NtoB(w1) -# w2 = (kGeneralEventLengthBits << kEventLengthFieldPos) \ -# w2 = EndianU32_NtoB(w2) ) -kGeneralEventNoteRequest = 1 -kGeneralEventPartKey = 4 -kGeneralEventTuneDifference = 5 -kGeneralEventAtomicInstrument = 6 -kGeneralEventKnob = 7 -kGeneralEventMIDIChannel = 8 -kGeneralEventPartChange = 9 -kGeneralEventNoOp = 10 -kGeneralEventUsedNotes = 11 -kGeneralEventPartMix = 12 -kMarkerEventEnd = 0 -kMarkerEventBeat = 1 -kMarkerEventTempo = 2 -kCurrentlyNativeEndian = 1 -kCurrentlyNotNativeEndian = 2 -kQTMIDIGetMIDIPortsSelect = 0x0001 -kQTMIDIUseSendPortSelect = 0x0002 -kQTMIDISendMIDISelect = 0x0003 -kMusicGetDescriptionSelect = 0x0001 -kMusicGetPartSelect = 0x0002 -kMusicSetPartSelect = 0x0003 -kMusicSetPartInstrumentNumberSelect = 0x0004 -kMusicGetPartInstrumentNumberSelect = 0x0005 -kMusicStorePartInstrumentSelect = 0x0006 -kMusicGetPartAtomicInstrumentSelect = 0x0009 -kMusicSetPartAtomicInstrumentSelect = 0x000A -kMusicGetPartKnobSelect = 0x0010 -kMusicSetPartKnobSelect = 0x0011 -kMusicGetKnobSelect = 0x0012 -kMusicSetKnobSelect = 0x0013 -kMusicGetPartNameSelect = 0x0014 -kMusicSetPartNameSelect = 0x0015 -kMusicFindToneSelect = 0x0016 -kMusicPlayNoteSelect = 0x0017 -kMusicResetPartSelect = 0x0018 -kMusicSetPartControllerSelect = 0x0019 -kMusicGetPartControllerSelect = 0x001A -kMusicGetMIDIProcSelect = 0x001B -kMusicSetMIDIProcSelect = 0x001C -kMusicGetInstrumentNamesSelect = 0x001D -kMusicGetDrumNamesSelect = 0x001E -kMusicGetMasterTuneSelect = 0x001F -kMusicSetMasterTuneSelect = 0x0020 -kMusicGetInstrumentAboutInfoSelect = 0x0022 -kMusicGetDeviceConnectionSelect = 0x0023 -kMusicUseDeviceConnectionSelect = 0x0024 -kMusicGetKnobSettingStringsSelect = 0x0025 -kMusicGetMIDIPortsSelect = 0x0026 -kMusicSendMIDISelect = 0x0027 -kMusicStartOfflineSelect = 0x0029 -kMusicSetOfflineTimeToSelect = 0x002A -kMusicGetInstrumentKnobDescriptionSelect = 0x002B -kMusicGetDrumKnobDescriptionSelect = 0x002C -kMusicGetKnobDescriptionSelect = 0x002D -kMusicGetInfoTextSelect = 0x002E -kMusicGetInstrumentInfoSelect = 0x002F -kMusicTaskSelect = 0x0031 -kMusicSetPartInstrumentNumberInterruptSafeSelect = 0x0032 -kMusicSetPartSoundLocalizationSelect = 0x0033 -kMusicGenericConfigureSelect = 0x0100 -kMusicGenericGetPartSelect = 0x0101 -kMusicGenericGetKnobListSelect = 0x0102 -kMusicGenericSetResourceNumbersSelect = 0x0103 -kMusicDerivedMIDISendSelect = 0x0200 -kMusicDerivedSetKnobSelect = 0x0201 -kMusicDerivedSetPartSelect = 0x0202 -kMusicDerivedSetInstrumentSelect = 0x0203 -kMusicDerivedSetPartInstrumentNumberSelect = 0x0204 -kMusicDerivedSetMIDISelect = 0x0205 -kMusicDerivedStorePartInstrumentSelect = 0x0206 -kMusicDerivedOpenResFileSelect = 0x0207 -kMusicDerivedCloseResFileSelect = 0x0208 -kNARegisterMusicDeviceSelect = 0x0000 -kNAUnregisterMusicDeviceSelect = 0x0001 -kNAGetRegisteredMusicDeviceSelect = 0x0002 -kNASaveMusicConfigurationSelect = 0x0003 -kNANewNoteChannelSelect = 0x0004 -kNADisposeNoteChannelSelect = 0x0005 -kNAGetNoteChannelInfoSelect = 0x0006 -kNAPrerollNoteChannelSelect = 0x0007 -kNAUnrollNoteChannelSelect = 0x0008 -kNASetNoteChannelVolumeSelect = 0x000B -kNAResetNoteChannelSelect = 0x000C -kNAPlayNoteSelect = 0x000D -kNASetControllerSelect = 0x000E -kNASetKnobSelect = 0x000F -kNAFindNoteChannelToneSelect = 0x0010 -kNASetInstrumentNumberSelect = 0x0011 -kNAPickInstrumentSelect = 0x0012 -kNAPickArrangementSelect = 0x0013 -kNAStuffToneDescriptionSelect = 0x001B -kNACopyrightDialogSelect = 0x001C -kNAGetIndNoteChannelSelect = 0x001F -kNAGetMIDIPortsSelect = 0x0021 -kNAGetNoteRequestSelect = 0x0022 -kNASendMIDISelect = 0x0023 -kNAPickEditInstrumentSelect = 0x0024 -kNANewNoteChannelFromAtomicInstrumentSelect = 0x0025 -kNASetAtomicInstrumentSelect = 0x0026 -kNAGetKnobSelect = 0x0028 -kNATaskSelect = 0x0029 -kNASetNoteChannelBalanceSelect = 0x002A -kNASetInstrumentNumberInterruptSafeSelect = 0x002B -kNASetNoteChannelSoundLocalizationSelect = 0x002C -kNAGetControllerSelect = 0x002D -kTuneSetHeaderSelect = 0x0004 -kTuneGetTimeBaseSelect = 0x0005 -kTuneSetTimeScaleSelect = 0x0006 -kTuneGetTimeScaleSelect = 0x0007 -kTuneGetIndexedNoteChannelSelect = 0x0008 -kTuneQueueSelect = 0x000A -kTuneInstantSelect = 0x000B -kTuneGetStatusSelect = 0x000C -kTuneStopSelect = 0x000D -kTuneSetVolumeSelect = 0x0010 -kTuneGetVolumeSelect = 0x0011 -kTunePrerollSelect = 0x0012 -kTuneUnrollSelect = 0x0013 -kTuneSetNoteChannelsSelect = 0x0014 -kTuneSetPartTransposeSelect = 0x0015 -kTuneGetNoteAllocatorSelect = 0x0017 -kTuneSetSofterSelect = 0x0018 -kTuneTaskSelect = 0x0019 -kTuneSetBalanceSelect = 0x001A -kTuneSetSoundLocalizationSelect = 0x001B -kTuneSetHeaderWithSizeSelect = 0x001C -kTuneSetPartMixSelect = 0x001D -kTuneGetPartMixSelect = 0x001E diff --git a/sys/lib/python/plat-mac/Carbon/Res.py b/sys/lib/python/plat-mac/Carbon/Res.py deleted file mode 100644 index 8f45d0946..000000000 --- a/sys/lib/python/plat-mac/Carbon/Res.py +++ /dev/null @@ -1,4 +0,0 @@ -try: - from OverrideFrom23._Res import * -except ImportError: - from _Res import * diff --git a/sys/lib/python/plat-mac/Carbon/Resources.py b/sys/lib/python/plat-mac/Carbon/Resources.py deleted file mode 100644 index 2cd876168..000000000 --- a/sys/lib/python/plat-mac/Carbon/Resources.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated from 'Resources.h' - -resSysHeap = 64 -resPurgeable = 32 -resLocked = 16 -resProtected = 8 -resPreload = 4 -resChanged = 2 -mapReadOnly = 128 -mapCompact = 64 -mapChanged = 32 -resSysRefBit = 7 -resSysHeapBit = 6 -resPurgeableBit = 5 -resLockedBit = 4 -resProtectedBit = 3 -resPreloadBit = 2 -resChangedBit = 1 -mapReadOnlyBit = 7 -mapCompactBit = 6 -mapChangedBit = 5 -kResFileNotOpened = -1 -kSystemResFile = 0 -kRsrcChainBelowSystemMap = 0 -kRsrcChainBelowApplicationMap = 1 -kRsrcChainAboveApplicationMap = 2 -kRsrcChainAboveAllMaps = 4 diff --git a/sys/lib/python/plat-mac/Carbon/Scrap.py b/sys/lib/python/plat-mac/Carbon/Scrap.py deleted file mode 100644 index 0dcbd3748..000000000 --- a/sys/lib/python/plat-mac/Carbon/Scrap.py +++ /dev/null @@ -1 +0,0 @@ -from _Scrap import * diff --git a/sys/lib/python/plat-mac/Carbon/Snd.py b/sys/lib/python/plat-mac/Carbon/Snd.py deleted file mode 100644 index 679f10b9c..000000000 --- a/sys/lib/python/plat-mac/Carbon/Snd.py +++ /dev/null @@ -1 +0,0 @@ -from _Snd import * diff --git a/sys/lib/python/plat-mac/Carbon/Sndihooks.py b/sys/lib/python/plat-mac/Carbon/Sndihooks.py deleted file mode 100644 index 73a3d284c..000000000 --- a/sys/lib/python/plat-mac/Carbon/Sndihooks.py +++ /dev/null @@ -1 +0,0 @@ -from _Sndihooks import * diff --git a/sys/lib/python/plat-mac/Carbon/Sound.py b/sys/lib/python/plat-mac/Carbon/Sound.py deleted file mode 100644 index 0e7b2fb64..000000000 --- a/sys/lib/python/plat-mac/Carbon/Sound.py +++ /dev/null @@ -1,400 +0,0 @@ -# Generated from 'Sound.h' - -def FOUR_CHAR_CODE(x): return x -soundListRsrc = FOUR_CHAR_CODE('snd ') -kSimpleBeepID = 1 -# rate48khz = (long)0xBB800000 -# rate44khz = (long)0xAC440000 -rate32khz = 0x7D000000 -rate22050hz = 0x56220000 -rate22khz = 0x56EE8BA3 -rate16khz = 0x3E800000 -rate11khz = 0x2B7745D1 -rate11025hz = 0x2B110000 -rate8khz = 0x1F400000 -sampledSynth = 5 -squareWaveSynth = 1 -waveTableSynth = 3 -MACE3snthID = 11 -MACE6snthID = 13 -kMiddleC = 60 -kNoVolume = 0 -kFullVolume = 0x0100 -stdQLength = 128 -dataOffsetFlag = 0x8000 -kUseOptionalOutputDevice = -1 -notCompressed = 0 -fixedCompression = -1 -variableCompression = -2 -twoToOne = 1 -eightToThree = 2 -threeToOne = 3 -sixToOne = 4 -sixToOnePacketSize = 8 -threeToOnePacketSize = 16 -stateBlockSize = 64 -leftOverBlockSize = 32 -firstSoundFormat = 0x0001 -secondSoundFormat = 0x0002 -dbBufferReady = 0x00000001 -dbLastBuffer = 0x00000004 -sysBeepDisable = 0x0000 -sysBeepEnable = (1 << 0) -sysBeepSynchronous = (1 << 1) -unitTypeNoSelection = 0xFFFF -unitTypeSeconds = 0x0000 -stdSH = 0x00 -extSH = 0xFF -cmpSH = 0xFE -nullCmd = 0 -quietCmd = 3 -flushCmd = 4 -reInitCmd = 5 -waitCmd = 10 -pauseCmd = 11 -resumeCmd = 12 -callBackCmd = 13 -syncCmd = 14 -availableCmd = 24 -versionCmd = 25 -volumeCmd = 46 -getVolumeCmd = 47 -clockComponentCmd = 50 -getClockComponentCmd = 51 -scheduledSoundCmd = 52 -linkSoundComponentsCmd = 53 -soundCmd = 80 -bufferCmd = 81 -rateMultiplierCmd = 86 -getRateMultiplierCmd = 87 -initCmd = 1 -freeCmd = 2 -totalLoadCmd = 26 -loadCmd = 27 -freqDurationCmd = 40 -restCmd = 41 -freqCmd = 42 -ampCmd = 43 -timbreCmd = 44 -getAmpCmd = 45 -waveTableCmd = 60 -phaseCmd = 61 -rateCmd = 82 -continueCmd = 83 -doubleBufferCmd = 84 -getRateCmd = 85 -sizeCmd = 90 -convertCmd = 91 -waveInitChannelMask = 0x07 -waveInitChannel0 = 0x04 -waveInitChannel1 = 0x05 -waveInitChannel2 = 0x06 -waveInitChannel3 = 0x07 -initChan0 = waveInitChannel0 -initChan1 = waveInitChannel1 -initChan2 = waveInitChannel2 -initChan3 = waveInitChannel3 -outsideCmpSH = 0 -insideCmpSH = 1 -aceSuccess = 0 -aceMemFull = 1 -aceNilBlock = 2 -aceBadComp = 3 -aceBadEncode = 4 -aceBadDest = 5 -aceBadCmd = 6 -initChanLeft = 0x0002 -initChanRight = 0x0003 -initNoInterp = 0x0004 -initNoDrop = 0x0008 -initMono = 0x0080 -initStereo = 0x00C0 -initMACE3 = 0x0300 -initMACE6 = 0x0400 -initPanMask = 0x0003 -initSRateMask = 0x0030 -initStereoMask = 0x00C0 -initCompMask = 0xFF00 -siActiveChannels = FOUR_CHAR_CODE('chac') -siActiveLevels = FOUR_CHAR_CODE('lmac') -siAGCOnOff = FOUR_CHAR_CODE('agc ') -siAsync = FOUR_CHAR_CODE('asyn') -siAVDisplayBehavior = FOUR_CHAR_CODE('avdb') -siChannelAvailable = FOUR_CHAR_CODE('chav') -siCompressionAvailable = FOUR_CHAR_CODE('cmav') -siCompressionChannels = FOUR_CHAR_CODE('cpct') -siCompressionFactor = FOUR_CHAR_CODE('cmfa') -siCompressionHeader = FOUR_CHAR_CODE('cmhd') -siCompressionNames = FOUR_CHAR_CODE('cnam') -siCompressionParams = FOUR_CHAR_CODE('evaw') -siCompressionSampleRate = FOUR_CHAR_CODE('cprt') -siCompressionType = FOUR_CHAR_CODE('comp') -siContinuous = FOUR_CHAR_CODE('cont') -siDecompressionParams = FOUR_CHAR_CODE('wave') -siDeviceBufferInfo = FOUR_CHAR_CODE('dbin') -siDeviceConnected = FOUR_CHAR_CODE('dcon') -siDeviceIcon = FOUR_CHAR_CODE('icon') -siDeviceName = FOUR_CHAR_CODE('name') -siEQSpectrumBands = FOUR_CHAR_CODE('eqsb') -siEQSpectrumLevels = FOUR_CHAR_CODE('eqlv') -siEQSpectrumOnOff = FOUR_CHAR_CODE('eqlo') -siEQSpectrumResolution = FOUR_CHAR_CODE('eqrs') -siEQToneControlGain = FOUR_CHAR_CODE('eqtg') -siEQToneControlOnOff = FOUR_CHAR_CODE('eqtc') -siHardwareBalance = FOUR_CHAR_CODE('hbal') -siHardwareBalanceSteps = FOUR_CHAR_CODE('hbls') -siHardwareBass = FOUR_CHAR_CODE('hbas') -siHardwareBassSteps = FOUR_CHAR_CODE('hbst') -siHardwareBusy = FOUR_CHAR_CODE('hwbs') -siHardwareFormat = FOUR_CHAR_CODE('hwfm') -siHardwareMute = FOUR_CHAR_CODE('hmut') -siHardwareMuteNoPrefs = FOUR_CHAR_CODE('hmnp') -siHardwareTreble = FOUR_CHAR_CODE('htrb') -siHardwareTrebleSteps = FOUR_CHAR_CODE('hwts') -siHardwareVolume = FOUR_CHAR_CODE('hvol') -siHardwareVolumeSteps = FOUR_CHAR_CODE('hstp') -siHeadphoneMute = FOUR_CHAR_CODE('pmut') -siHeadphoneVolume = FOUR_CHAR_CODE('pvol') -siHeadphoneVolumeSteps = FOUR_CHAR_CODE('hdst') -siInputAvailable = FOUR_CHAR_CODE('inav') -siInputGain = FOUR_CHAR_CODE('gain') -siInputSource = FOUR_CHAR_CODE('sour') -siInputSourceNames = FOUR_CHAR_CODE('snam') -siLevelMeterOnOff = FOUR_CHAR_CODE('lmet') -siModemGain = FOUR_CHAR_CODE('mgai') -siMonitorAvailable = FOUR_CHAR_CODE('mnav') -siMonitorSource = FOUR_CHAR_CODE('mons') -siNumberChannels = FOUR_CHAR_CODE('chan') -siOptionsDialog = FOUR_CHAR_CODE('optd') -siOSTypeInputSource = FOUR_CHAR_CODE('inpt') -siOSTypeInputAvailable = FOUR_CHAR_CODE('inav') -siOutputDeviceName = FOUR_CHAR_CODE('onam') -siPlayThruOnOff = FOUR_CHAR_CODE('plth') -siPostMixerSoundComponent = FOUR_CHAR_CODE('psmx') -siPreMixerSoundComponent = FOUR_CHAR_CODE('prmx') -siQuality = FOUR_CHAR_CODE('qual') -siRateMultiplier = FOUR_CHAR_CODE('rmul') -siRecordingQuality = FOUR_CHAR_CODE('qual') -siSampleRate = FOUR_CHAR_CODE('srat') -siSampleRateAvailable = FOUR_CHAR_CODE('srav') -siSampleSize = FOUR_CHAR_CODE('ssiz') -siSampleSizeAvailable = FOUR_CHAR_CODE('ssav') -siSetupCDAudio = FOUR_CHAR_CODE('sucd') -siSetupModemAudio = FOUR_CHAR_CODE('sumd') -siSlopeAndIntercept = FOUR_CHAR_CODE('flap') -siSoundClock = FOUR_CHAR_CODE('sclk') -siUseThisSoundClock = FOUR_CHAR_CODE('sclc') -siSpeakerMute = FOUR_CHAR_CODE('smut') -siSpeakerVolume = FOUR_CHAR_CODE('svol') -siSSpCPULoadLimit = FOUR_CHAR_CODE('3dll') -siSSpLocalization = FOUR_CHAR_CODE('3dif') -siSSpSpeakerSetup = FOUR_CHAR_CODE('3dst') -siStereoInputGain = FOUR_CHAR_CODE('sgai') -siSubwooferMute = FOUR_CHAR_CODE('bmut') -siTerminalType = FOUR_CHAR_CODE('ttyp') -siTwosComplementOnOff = FOUR_CHAR_CODE('twos') -siVendorProduct = FOUR_CHAR_CODE('vpro') -siVolume = FOUR_CHAR_CODE('volu') -siVoxRecordInfo = FOUR_CHAR_CODE('voxr') -siVoxStopInfo = FOUR_CHAR_CODE('voxs') -siWideStereo = FOUR_CHAR_CODE('wide') -siSupportedExtendedFlags = FOUR_CHAR_CODE('exfl') -siRateConverterRollOffSlope = FOUR_CHAR_CODE('rcdb') -siOutputLatency = FOUR_CHAR_CODE('olte') -siCloseDriver = FOUR_CHAR_CODE('clos') -siInitializeDriver = FOUR_CHAR_CODE('init') -siPauseRecording = FOUR_CHAR_CODE('paus') -siUserInterruptProc = FOUR_CHAR_CODE('user') -# kInvalidSource = (long)0xFFFFFFFF -kNoSource = FOUR_CHAR_CODE('none') -kCDSource = FOUR_CHAR_CODE('cd ') -kExtMicSource = FOUR_CHAR_CODE('emic') -kSoundInSource = FOUR_CHAR_CODE('sinj') -kRCAInSource = FOUR_CHAR_CODE('irca') -kTVFMTunerSource = FOUR_CHAR_CODE('tvfm') -kDAVInSource = FOUR_CHAR_CODE('idav') -kIntMicSource = FOUR_CHAR_CODE('imic') -kMediaBaySource = FOUR_CHAR_CODE('mbay') -kModemSource = FOUR_CHAR_CODE('modm') -kPCCardSource = FOUR_CHAR_CODE('pcm ') -kZoomVideoSource = FOUR_CHAR_CODE('zvpc') -kDVDSource = FOUR_CHAR_CODE('dvda') -kMicrophoneArray = FOUR_CHAR_CODE('mica') -kNoSoundComponentType = FOUR_CHAR_CODE('****') -kSoundComponentType = FOUR_CHAR_CODE('sift') -kSoundComponentPPCType = FOUR_CHAR_CODE('nift') -kRate8SubType = FOUR_CHAR_CODE('ratb') -kRate16SubType = FOUR_CHAR_CODE('ratw') -kConverterSubType = FOUR_CHAR_CODE('conv') -kSndSourceSubType = FOUR_CHAR_CODE('sour') -kMixerType = FOUR_CHAR_CODE('mixr') -kMixer8SubType = FOUR_CHAR_CODE('mixb') -kMixer16SubType = FOUR_CHAR_CODE('mixw') -kSoundInputDeviceType = FOUR_CHAR_CODE('sinp') -kWaveInSubType = FOUR_CHAR_CODE('wavi') -kWaveInSnifferSubType = FOUR_CHAR_CODE('wisn') -kSoundOutputDeviceType = FOUR_CHAR_CODE('sdev') -kClassicSubType = FOUR_CHAR_CODE('clas') -kASCSubType = FOUR_CHAR_CODE('asc ') -kDSPSubType = FOUR_CHAR_CODE('dsp ') -kAwacsSubType = FOUR_CHAR_CODE('awac') -kGCAwacsSubType = FOUR_CHAR_CODE('awgc') -kSingerSubType = FOUR_CHAR_CODE('sing') -kSinger2SubType = FOUR_CHAR_CODE('sng2') -kWhitSubType = FOUR_CHAR_CODE('whit') -kSoundBlasterSubType = FOUR_CHAR_CODE('sbls') -kWaveOutSubType = FOUR_CHAR_CODE('wavo') -kWaveOutSnifferSubType = FOUR_CHAR_CODE('wosn') -kDirectSoundSubType = FOUR_CHAR_CODE('dsnd') -kDirectSoundSnifferSubType = FOUR_CHAR_CODE('dssn') -kUNIXsdevSubType = FOUR_CHAR_CODE('un1x') -kUSBSubType = FOUR_CHAR_CODE('usb ') -kBlueBoxSubType = FOUR_CHAR_CODE('bsnd') -kSoundCompressor = FOUR_CHAR_CODE('scom') -kSoundDecompressor = FOUR_CHAR_CODE('sdec') -kAudioComponentType = FOUR_CHAR_CODE('adio') -kAwacsPhoneSubType = FOUR_CHAR_CODE('hphn') -kAudioVisionSpeakerSubType = FOUR_CHAR_CODE('telc') -kAudioVisionHeadphoneSubType = FOUR_CHAR_CODE('telh') -kPhilipsFaderSubType = FOUR_CHAR_CODE('tvav') -kSGSToneSubType = FOUR_CHAR_CODE('sgs0') -kSoundEffectsType = FOUR_CHAR_CODE('snfx') -kEqualizerSubType = FOUR_CHAR_CODE('eqal') -kSSpLocalizationSubType = FOUR_CHAR_CODE('snd3') -kSoundNotCompressed = FOUR_CHAR_CODE('NONE') -k8BitOffsetBinaryFormat = FOUR_CHAR_CODE('raw ') -k16BitBigEndianFormat = FOUR_CHAR_CODE('twos') -k16BitLittleEndianFormat = FOUR_CHAR_CODE('sowt') -kFloat32Format = FOUR_CHAR_CODE('fl32') -kFloat64Format = FOUR_CHAR_CODE('fl64') -k24BitFormat = FOUR_CHAR_CODE('in24') -k32BitFormat = FOUR_CHAR_CODE('in32') -k32BitLittleEndianFormat = FOUR_CHAR_CODE('23ni') -kMACE3Compression = FOUR_CHAR_CODE('MAC3') -kMACE6Compression = FOUR_CHAR_CODE('MAC6') -kCDXA4Compression = FOUR_CHAR_CODE('cdx4') -kCDXA2Compression = FOUR_CHAR_CODE('cdx2') -kIMACompression = FOUR_CHAR_CODE('ima4') -kULawCompression = FOUR_CHAR_CODE('ulaw') -kALawCompression = FOUR_CHAR_CODE('alaw') -kMicrosoftADPCMFormat = 0x6D730002 -kDVIIntelIMAFormat = 0x6D730011 -kDVAudioFormat = FOUR_CHAR_CODE('dvca') -kQDesignCompression = FOUR_CHAR_CODE('QDMC') -kQDesign2Compression = FOUR_CHAR_CODE('QDM2') -kQUALCOMMCompression = FOUR_CHAR_CODE('Qclp') -kOffsetBinary = k8BitOffsetBinaryFormat -kTwosComplement = k16BitBigEndianFormat -kLittleEndianFormat = k16BitLittleEndianFormat -kMPEGLayer3Format = 0x6D730055 -kFullMPEGLay3Format = FOUR_CHAR_CODE('.mp3') -k16BitNativeEndianFormat = k16BitLittleEndianFormat -k16BitNonNativeEndianFormat = k16BitBigEndianFormat -k16BitNativeEndianFormat = k16BitBigEndianFormat -k16BitNonNativeEndianFormat = k16BitLittleEndianFormat -k8BitRawIn = (1 << 0) -k8BitTwosIn = (1 << 1) -k16BitIn = (1 << 2) -kStereoIn = (1 << 3) -k8BitRawOut = (1 << 8) -k8BitTwosOut = (1 << 9) -k16BitOut = (1 << 10) -kStereoOut = (1 << 11) -kReverse = (1L << 16) -kRateConvert = (1L << 17) -kCreateSoundSource = (1L << 18) -kVMAwareness = (1L << 21) -kHighQuality = (1L << 22) -kNonRealTime = (1L << 23) -kSourcePaused = (1 << 0) -kPassThrough = (1L << 16) -kNoSoundComponentChain = (1L << 17) -kNoMixing = (1 << 0) -kNoSampleRateConversion = (1 << 1) -kNoSampleSizeConversion = (1 << 2) -kNoSampleFormatConversion = (1 << 3) -kNoChannelConversion = (1 << 4) -kNoDecompression = (1 << 5) -kNoVolumeConversion = (1 << 6) -kNoRealtimeProcessing = (1 << 7) -kScheduledSource = (1 << 8) -kNonInterleavedBuffer = (1 << 9) -kNonPagingMixer = (1 << 10) -kSoundConverterMixer = (1 << 11) -kPagingMixer = (1 << 12) -kVMAwareMixer = (1 << 13) -kExtendedSoundData = (1 << 14) -kBestQuality = (1 << 0) -kInputMask = 0x000000FF -kOutputMask = 0x0000FF00 -kOutputShift = 8 -kActionMask = 0x00FF0000 -kSoundComponentBits = 0x00FFFFFF -kAudioFormatAtomType = FOUR_CHAR_CODE('frma') -kAudioEndianAtomType = FOUR_CHAR_CODE('enda') -kAudioVBRAtomType = FOUR_CHAR_CODE('vbra') -kAudioTerminatorAtomType = 0 -kAVDisplayHeadphoneRemove = 0 -kAVDisplayHeadphoneInsert = 1 -kAVDisplayPlainTalkRemove = 2 -kAVDisplayPlainTalkInsert = 3 -audioAllChannels = 0 -audioLeftChannel = 1 -audioRightChannel = 2 -audioUnmuted = 0 -audioMuted = 1 -audioDoesMono = (1L << 0) -audioDoesStereo = (1L << 1) -audioDoesIndependentChannels = (1L << 2) -siCDQuality = FOUR_CHAR_CODE('cd ') -siBestQuality = FOUR_CHAR_CODE('best') -siBetterQuality = FOUR_CHAR_CODE('betr') -siGoodQuality = FOUR_CHAR_CODE('good') -siNoneQuality = FOUR_CHAR_CODE('none') -siDeviceIsConnected = 1 -siDeviceNotConnected = 0 -siDontKnowIfConnected = -1 -siReadPermission = 0 -siWritePermission = 1 -kSoundConverterDidntFillBuffer = (1 << 0) -kSoundConverterHasLeftOverData = (1 << 1) -kExtendedSoundSampleCountNotValid = 1L << 0 -kExtendedSoundBufferSizeValid = 1L << 1 -kScheduledSoundDoScheduled = 1 << 0 -kScheduledSoundDoCallBack = 1 << 1 -kScheduledSoundExtendedHdr = 1 << 2 -kSoundComponentInitOutputDeviceSelect = 0x0001 -kSoundComponentSetSourceSelect = 0x0002 -kSoundComponentGetSourceSelect = 0x0003 -kSoundComponentGetSourceDataSelect = 0x0004 -kSoundComponentSetOutputSelect = 0x0005 -kSoundComponentAddSourceSelect = 0x0101 -kSoundComponentRemoveSourceSelect = 0x0102 -kSoundComponentGetInfoSelect = 0x0103 -kSoundComponentSetInfoSelect = 0x0104 -kSoundComponentStartSourceSelect = 0x0105 -kSoundComponentStopSourceSelect = 0x0106 -kSoundComponentPauseSourceSelect = 0x0107 -kSoundComponentPlaySourceBufferSelect = 0x0108 -kAudioGetVolumeSelect = 0x0000 -kAudioSetVolumeSelect = 0x0001 -kAudioGetMuteSelect = 0x0002 -kAudioSetMuteSelect = 0x0003 -kAudioSetToDefaultsSelect = 0x0004 -kAudioGetInfoSelect = 0x0005 -kAudioGetBassSelect = 0x0006 -kAudioSetBassSelect = 0x0007 -kAudioGetTrebleSelect = 0x0008 -kAudioSetTrebleSelect = 0x0009 -kAudioGetOutputDeviceSelect = 0x000A -kAudioMuteOnEventSelect = 0x0081 -kDelegatedSoundComponentSelectors = 0x0100 -kSndInputReadAsyncSelect = 0x0001 -kSndInputReadSyncSelect = 0x0002 -kSndInputPauseRecordingSelect = 0x0003 -kSndInputResumeRecordingSelect = 0x0004 -kSndInputStopRecordingSelect = 0x0005 -kSndInputGetStatusSelect = 0x0006 -kSndInputGetDeviceInfoSelect = 0x0007 -kSndInputSetDeviceInfoSelect = 0x0008 -kSndInputInitHardwareSelect = 0x0009 diff --git a/sys/lib/python/plat-mac/Carbon/TE.py b/sys/lib/python/plat-mac/Carbon/TE.py deleted file mode 100644 index 4351d7a40..000000000 --- a/sys/lib/python/plat-mac/Carbon/TE.py +++ /dev/null @@ -1 +0,0 @@ -from _TE import * diff --git a/sys/lib/python/plat-mac/Carbon/TextEdit.py b/sys/lib/python/plat-mac/Carbon/TextEdit.py deleted file mode 100644 index 176795af9..000000000 --- a/sys/lib/python/plat-mac/Carbon/TextEdit.py +++ /dev/null @@ -1,57 +0,0 @@ -# Generated from 'TextEdit.h' - -teJustLeft = 0 -teJustCenter = 1 -teJustRight = -1 -teForceLeft = -2 -teFlushDefault = 0 -teCenter = 1 -teFlushRight = -1 -teFlushLeft = -2 -fontBit = 0 -faceBit = 1 -sizeBit = 2 -clrBit = 3 -addSizeBit = 4 -toggleBit = 5 -doFont = 1 -doFace = 2 -doSize = 4 -doColor = 8 -doAll = 15 -addSize = 16 -doToggle = 32 -EOLHook = 0 -DRAWHook = 4 -WIDTHHook = 8 -HITTESTHook = 12 -nWIDTHHook = 24 -TextWidthHook = 28 -intEOLHook = 0 -intDrawHook = 1 -intWidthHook = 2 -intHitTestHook = 3 -intNWidthHook = 6 -intTextWidthHook = 7 -intInlineInputTSMTEPreUpdateHook = 8 -intInlineInputTSMTEPostUpdateHook = 9 -teFAutoScroll = 0 -teFTextBuffering = 1 -teFOutlineHilite = 2 -teFInlineInput = 3 -teFUseWhiteBackground = 4 -teFUseInlineInput = 5 -teFInlineInputAutoScroll = 6 -teFIdleWithEventLoopTimer = 7 -teBitClear = 0 -teBitSet = 1 -teBitTest = -1 -teWordSelect = 4 -teWordDrag = 8 -teFromFind = 12 -teFromRecal = 16 -teFind = 0 -teHighlight = 1 -teDraw = -1 -teCaret = -2 -teFUseTextServices = 4 diff --git a/sys/lib/python/plat-mac/Carbon/Win.py b/sys/lib/python/plat-mac/Carbon/Win.py deleted file mode 100644 index 28057723e..000000000 --- a/sys/lib/python/plat-mac/Carbon/Win.py +++ /dev/null @@ -1 +0,0 @@ -from _Win import * diff --git a/sys/lib/python/plat-mac/Carbon/Windows.py b/sys/lib/python/plat-mac/Carbon/Windows.py deleted file mode 100644 index b09d53710..000000000 --- a/sys/lib/python/plat-mac/Carbon/Windows.py +++ /dev/null @@ -1,279 +0,0 @@ -# Generated from 'MacWindows.h' - -def FOUR_CHAR_CODE(x): return x -false = 0 -true = 1 -kWindowNoConstrainAttribute = 0x80000000 -kAlertWindowClass = 1 -kMovableAlertWindowClass = 2 -kModalWindowClass = 3 -kMovableModalWindowClass = 4 -kFloatingWindowClass = 5 -kDocumentWindowClass = 6 -kUtilityWindowClass = 8 -kHelpWindowClass = 10 -kSheetWindowClass = 11 -kToolbarWindowClass = 12 -kPlainWindowClass = 13 -kOverlayWindowClass = 14 -kSheetAlertWindowClass = 15 -kAltPlainWindowClass = 16 -kDrawerWindowClass = 20 -# kAllWindowClasses = (unsigned long)0xFFFFFFFF -kWindowNoAttributes = 0L -kWindowCloseBoxAttribute = (1L << 0) -kWindowHorizontalZoomAttribute = (1L << 1) -kWindowVerticalZoomAttribute = (1L << 2) -kWindowFullZoomAttribute = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute) -kWindowCollapseBoxAttribute = (1L << 3) -kWindowResizableAttribute = (1L << 4) -kWindowSideTitlebarAttribute = (1L << 5) -kWindowToolbarButtonAttribute = (1L << 6) -kWindowNoUpdatesAttribute = (1L << 16) -kWindowNoActivatesAttribute = (1L << 17) -kWindowOpaqueForEventsAttribute = (1L << 18) -kWindowNoShadowAttribute = (1L << 21) -kWindowHideOnSuspendAttribute = (1L << 24) -kWindowStandardHandlerAttribute = (1L << 25) -kWindowHideOnFullScreenAttribute = (1L << 26) -kWindowInWindowMenuAttribute = (1L << 27) -kWindowLiveResizeAttribute = (1L << 28) -# kWindowNoConstrainAttribute = (unsigned long)((1L << 31)) -kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute) -kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute) -kWindowDefProcType = FOUR_CHAR_CODE('WDEF') -kStandardWindowDefinition = 0 -kRoundWindowDefinition = 1 -kFloatingWindowDefinition = 124 -kDocumentWindowVariantCode = 0 -kModalDialogVariantCode = 1 -kPlainDialogVariantCode = 2 -kShadowDialogVariantCode = 3 -kMovableModalDialogVariantCode = 5 -kAlertVariantCode = 7 -kMovableAlertVariantCode = 9 -kSideFloaterVariantCode = 8 -documentProc = 0 -dBoxProc = 1 -plainDBox = 2 -altDBoxProc = 3 -noGrowDocProc = 4 -movableDBoxProc = 5 -zoomDocProc = 8 -zoomNoGrow = 12 -floatProc = 1985 -floatGrowProc = 1987 -floatZoomProc = 1989 -floatZoomGrowProc = 1991 -floatSideProc = 1993 -floatSideGrowProc = 1995 -floatSideZoomProc = 1997 -floatSideZoomGrowProc = 1999 -rDocProc = 16 -kWindowDocumentDefProcResID = 64 -kWindowDialogDefProcResID = 65 -kWindowUtilityDefProcResID = 66 -kWindowUtilitySideTitleDefProcResID = 67 -kWindowSheetDefProcResID = 68 -kWindowSimpleDefProcResID = 69 -kWindowSheetAlertDefProcResID = 70 -kWindowDocumentProc = 1024 -kWindowGrowDocumentProc = 1025 -kWindowVertZoomDocumentProc = 1026 -kWindowVertZoomGrowDocumentProc = 1027 -kWindowHorizZoomDocumentProc = 1028 -kWindowHorizZoomGrowDocumentProc = 1029 -kWindowFullZoomDocumentProc = 1030 -kWindowFullZoomGrowDocumentProc = 1031 -kWindowPlainDialogProc = 1040 -kWindowShadowDialogProc = 1041 -kWindowModalDialogProc = 1042 -kWindowMovableModalDialogProc = 1043 -kWindowAlertProc = 1044 -kWindowMovableAlertProc = 1045 -kWindowMovableModalGrowProc = 1046 -kWindowFloatProc = 1057 -kWindowFloatGrowProc = 1059 -kWindowFloatVertZoomProc = 1061 -kWindowFloatVertZoomGrowProc = 1063 -kWindowFloatHorizZoomProc = 1065 -kWindowFloatHorizZoomGrowProc = 1067 -kWindowFloatFullZoomProc = 1069 -kWindowFloatFullZoomGrowProc = 1071 -kWindowFloatSideProc = 1073 -kWindowFloatSideGrowProc = 1075 -kWindowFloatSideVertZoomProc = 1077 -kWindowFloatSideVertZoomGrowProc = 1079 -kWindowFloatSideHorizZoomProc = 1081 -kWindowFloatSideHorizZoomGrowProc = 1083 -kWindowFloatSideFullZoomProc = 1085 -kWindowFloatSideFullZoomGrowProc = 1087 -kWindowSheetProc = 1088 -kWindowSheetAlertProc = 1120 -kWindowSimpleProc = 1104 -kWindowSimpleFrameProc = 1105 -kWindowNoPosition = 0x0000 -kWindowDefaultPosition = 0x0000 -kWindowCenterMainScreen = 0x280A -kWindowAlertPositionMainScreen = 0x300A -kWindowStaggerMainScreen = 0x380A -kWindowCenterParentWindow = 0xA80A -kWindowAlertPositionParentWindow = 0xB00A -kWindowStaggerParentWindow = 0xB80A -kWindowCenterParentWindowScreen = 0x680A -kWindowAlertPositionParentWindowScreen = 0x700A -kWindowStaggerParentWindowScreen = 0x780A -kWindowCenterOnMainScreen = 1 -kWindowCenterOnParentWindow = 2 -kWindowCenterOnParentWindowScreen = 3 -kWindowCascadeOnMainScreen = 4 -kWindowCascadeOnParentWindow = 5 -kWindowCascadeOnParentWindowScreen = 6 -kWindowCascadeStartAtParentWindowScreen = 10 -kWindowAlertPositionOnMainScreen = 7 -kWindowAlertPositionOnParentWindow = 8 -kWindowAlertPositionOnParentWindowScreen = 9 -kWindowTitleBarRgn = 0 -kWindowTitleTextRgn = 1 -kWindowCloseBoxRgn = 2 -kWindowZoomBoxRgn = 3 -kWindowDragRgn = 5 -kWindowGrowRgn = 6 -kWindowCollapseBoxRgn = 7 -kWindowTitleProxyIconRgn = 8 -kWindowStructureRgn = 32 -kWindowContentRgn = 33 -kWindowUpdateRgn = 34 -kWindowOpaqueRgn = 35 -kWindowGlobalPortRgn = 40 -dialogKind = 2 -userKind = 8 -kDialogWindowKind = 2 -kApplicationWindowKind = 8 -inDesk = 0 -inNoWindow = 0 -inMenuBar = 1 -inSysWindow = 2 -inContent = 3 -inDrag = 4 -inGrow = 5 -inGoAway = 6 -inZoomIn = 7 -inZoomOut = 8 -inCollapseBox = 11 -inProxyIcon = 12 -inToolbarButton = 13 -inStructure = 15 -wNoHit = 0 -wInContent = 1 -wInDrag = 2 -wInGrow = 3 -wInGoAway = 4 -wInZoomIn = 5 -wInZoomOut = 6 -wInCollapseBox = 9 -wInProxyIcon = 10 -wInToolbarButton = 11 -wInStructure = 13 -kWindowMsgDraw = 0 -kWindowMsgHitTest = 1 -kWindowMsgCalculateShape = 2 -kWindowMsgInitialize = 3 -kWindowMsgCleanUp = 4 -kWindowMsgDrawGrowOutline = 5 -kWindowMsgDrawGrowBox = 6 -kWindowMsgGetFeatures = 7 -kWindowMsgGetRegion = 8 -kWindowMsgDragHilite = 9 -kWindowMsgModified = 10 -kWindowMsgDrawInCurrentPort = 11 -kWindowMsgSetupProxyDragImage = 12 -kWindowMsgStateChanged = 13 -kWindowMsgMeasureTitle = 14 -kWindowMsgGetGrowImageRegion = 19 -wDraw = 0 -wHit = 1 -wCalcRgns = 2 -wNew = 3 -wDispose = 4 -wGrow = 5 -wDrawGIcon = 6 -kWindowStateTitleChanged = (1 << 0) -kWindowCanGrow = (1 << 0) -kWindowCanZoom = (1 << 1) -kWindowCanCollapse = (1 << 2) -kWindowIsModal = (1 << 3) -kWindowCanGetWindowRegion = (1 << 4) -kWindowIsAlert = (1 << 5) -kWindowHasTitleBar = (1 << 6) -kWindowSupportsDragHilite = (1 << 7) -kWindowSupportsModifiedBit = (1 << 8) -kWindowCanDrawInCurrentPort = (1 << 9) -kWindowCanSetupProxyDragImage = (1 << 10) -kWindowCanMeasureTitle = (1 << 11) -kWindowWantsDisposeAtProcessDeath = (1 << 12) -kWindowSupportsGetGrowImageRegion = (1 << 13) -kWindowDefSupportsColorGrafPort = 0x40000002 -kWindowIsOpaque = (1 << 14) -kWindowSupportsSetGrowImageRegion = (1 << 13) -deskPatID = 16 -wContentColor = 0 -wFrameColor = 1 -wTextColor = 2 -wHiliteColor = 3 -wTitleBarColor = 4 -# kMouseUpOutOfSlop = (long)0x80008000 -kWindowDefinitionVersionOne = 1 -kWindowDefinitionVersionTwo = 2 -kWindowIsCollapsedState = (1 << 0L) -kStoredWindowSystemTag = FOUR_CHAR_CODE('appl') -kStoredBasicWindowDescriptionID = FOUR_CHAR_CODE('sbas') -kStoredWindowPascalTitleID = FOUR_CHAR_CODE('s255') -kWindowDefProcPtr = 0 -kWindowDefObjectClass = 1 -kWindowDefProcID = 2 -kWindowModalityNone = 0 -kWindowModalitySystemModal = 1 -kWindowModalityAppModal = 2 -kWindowModalityWindowModal = 3 -kWindowGroupAttrSelectAsLayer = 1 << 0 -kWindowGroupAttrMoveTogether = 1 << 1 -kWindowGroupAttrLayerTogether = 1 << 2 -kWindowGroupAttrSharedActivation = 1 << 3 -kWindowGroupAttrHideOnCollapse = 1 << 4 -kWindowActivationScopeNone = 0 -kWindowActivationScopeIndependent = 1 -kWindowActivationScopeAll = 2 -kNextWindowGroup = true -kPreviousWindowGroup = false -kWindowGroupContentsReturnWindows = 1 << 0 -kWindowGroupContentsRecurse = 1 << 1 -kWindowGroupContentsVisible = 1 << 2 -kWindowPaintProcOptionsNone = 0 -kScrollWindowNoOptions = 0 -kScrollWindowInvalidate = (1L << 0) -kScrollWindowEraseToPortBackground = (1L << 1) -kWindowMenuIncludeRotate = 1 << 0 -kWindowZoomTransitionEffect = 1 -kWindowSheetTransitionEffect = 2 -kWindowSlideTransitionEffect = 3 -kWindowShowTransitionAction = 1 -kWindowHideTransitionAction = 2 -kWindowMoveTransitionAction = 3 -kWindowResizeTransitionAction = 4 -kWindowConstrainMayResize = (1L << 0) -kWindowConstrainMoveRegardlessOfFit = (1L << 1) -kWindowConstrainAllowPartial = (1L << 2) -kWindowConstrainCalcOnly = (1L << 3) -kWindowConstrainUseTransitionWindow = (1L << 4) -kWindowConstrainStandardOptions = kWindowConstrainMoveRegardlessOfFit -kWindowLatentVisibleFloater = 1 << 0 -kWindowLatentVisibleSuspend = 1 << 1 -kWindowLatentVisibleFullScreen = 1 << 2 -kWindowLatentVisibleAppHidden = 1 << 3 -kWindowLatentVisibleCollapsedOwner = 1 << 4 -kWindowLatentVisibleCollapsedGroup = 1 << 5 -kWindowPropertyPersistent = 0x00000001 -kWindowGroupAttrSelectable = kWindowGroupAttrSelectAsLayer -kWindowGroupAttrPositionFixed = kWindowGroupAttrMoveTogether -kWindowGroupAttrZOrderFixed = kWindowGroupAttrLayerTogether diff --git a/sys/lib/python/plat-mac/Carbon/__init__.py b/sys/lib/python/plat-mac/Carbon/__init__.py deleted file mode 100644 index 8018c1824..000000000 --- a/sys/lib/python/plat-mac/Carbon/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Filter out warnings about signed/unsigned constants -import warnings -warnings.filterwarnings("ignore", "", FutureWarning, ".*Controls") -warnings.filterwarnings("ignore", "", FutureWarning, ".*MacTextEditor") diff --git a/sys/lib/python/plat-mac/EasyDialogs.py b/sys/lib/python/plat-mac/EasyDialogs.py deleted file mode 100644 index b33d1be54..000000000 --- a/sys/lib/python/plat-mac/EasyDialogs.py +++ /dev/null @@ -1,838 +0,0 @@ -"""Easy to use dialogs. - -Message(msg) -- display a message and an OK button. -AskString(prompt, default) -- ask for a string, display OK and Cancel buttons. -AskPassword(prompt, default) -- like AskString(), but shows text as bullets. -AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons. -GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog -AskFileForOpen(...) -- Ask the user for an existing file -AskFileForSave(...) -- Ask the user for an output file -AskFolder(...) -- Ask the user to select a folder -bar = Progress(label, maxvalue) -- Display a progress bar -bar.set(value) -- Set value -bar.inc( *amount ) -- increment value by amount (default=1) -bar.label( *newlabel ) -- get or set text label. - -More documentation in each function. -This module uses DLOG resources 260 and on. -Based upon STDWIN dialogs with the same names and functions. -""" - -from Carbon.Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog -from Carbon import Qd -from Carbon import QuickDraw -from Carbon import Dialogs -from Carbon import Windows -from Carbon import Dlg,Win,Evt,Events # sdm7g -from Carbon import Ctl -from Carbon import Controls -from Carbon import Menu -from Carbon import AE -import Nav -import MacOS -import string -from Carbon.ControlAccessor import * # Also import Controls constants -import Carbon.File -import macresource -import os -import sys - -__all__ = ['Message', 'AskString', 'AskPassword', 'AskYesNoCancel', - 'GetArgv', 'AskFileForOpen', 'AskFileForSave', 'AskFolder', - 'ProgressBar'] - -_initialized = 0 - -def _initialize(): - global _initialized - if _initialized: return - macresource.need("DLOG", 260, "dialogs.rsrc", __name__) - -def _interact(): - """Make sure the application is in the foreground""" - AE.AEInteractWithUser(50000000) - -def cr2lf(text): - if '\r' in text: - text = string.join(string.split(text, '\r'), '\n') - return text - -def lf2cr(text): - if '\n' in text: - text = string.join(string.split(text, '\n'), '\r') - if len(text) > 253: - text = text[:253] + '\311' - return text - -def Message(msg, id=260, ok=None): - """Display a MESSAGE string. - - Return when the user clicks the OK button or presses Return. - - The MESSAGE string can be at most 255 characters long. - """ - _initialize() - _interact() - d = GetNewDialog(id, -1) - if not d: - print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" - return - h = d.GetDialogItemAsControl(2) - SetDialogItemText(h, lf2cr(msg)) - if ok != None: - h = d.GetDialogItemAsControl(1) - h.SetControlTitle(ok) - d.SetDialogDefaultItem(1) - d.AutoSizeDialog() - d.GetDialogWindow().ShowWindow() - while 1: - n = ModalDialog(None) - if n == 1: - return - - -def AskString(prompt, default = "", id=261, ok=None, cancel=None): - """Display a PROMPT string and a text entry field with a DEFAULT string. - - Return the contents of the text entry field when the user clicks the - OK button or presses Return. - Return None when the user clicks the Cancel button. - - If omitted, DEFAULT is empty. - - The PROMPT and DEFAULT strings, as well as the return value, - can be at most 255 characters long. - """ - - _initialize() - _interact() - d = GetNewDialog(id, -1) - if not d: - print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" - return - h = d.GetDialogItemAsControl(3) - SetDialogItemText(h, lf2cr(prompt)) - h = d.GetDialogItemAsControl(4) - SetDialogItemText(h, lf2cr(default)) - d.SelectDialogItemText(4, 0, 999) -# d.SetDialogItem(4, 0, 255) - if ok != None: - h = d.GetDialogItemAsControl(1) - h.SetControlTitle(ok) - if cancel != None: - h = d.GetDialogItemAsControl(2) - h.SetControlTitle(cancel) - d.SetDialogDefaultItem(1) - d.SetDialogCancelItem(2) - d.AutoSizeDialog() - d.GetDialogWindow().ShowWindow() - while 1: - n = ModalDialog(None) - if n == 1: - h = d.GetDialogItemAsControl(4) - return cr2lf(GetDialogItemText(h)) - if n == 2: return None - -def AskPassword(prompt, default='', id=264, ok=None, cancel=None): - """Display a PROMPT string and a text entry field with a DEFAULT string. - The string is displayed as bullets only. - - Return the contents of the text entry field when the user clicks the - OK button or presses Return. - Return None when the user clicks the Cancel button. - - If omitted, DEFAULT is empty. - - The PROMPT and DEFAULT strings, as well as the return value, - can be at most 255 characters long. - """ - _initialize() - _interact() - d = GetNewDialog(id, -1) - if not d: - print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" - return - h = d.GetDialogItemAsControl(3) - SetDialogItemText(h, lf2cr(prompt)) - pwd = d.GetDialogItemAsControl(4) - bullets = '\245'*len(default) -## SetControlData(pwd, kControlEditTextPart, kControlEditTextTextTag, bullets) - SetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag, default) - d.SelectDialogItemText(4, 0, 999) - Ctl.SetKeyboardFocus(d.GetDialogWindow(), pwd, kControlEditTextPart) - if ok != None: - h = d.GetDialogItemAsControl(1) - h.SetControlTitle(ok) - if cancel != None: - h = d.GetDialogItemAsControl(2) - h.SetControlTitle(cancel) - d.SetDialogDefaultItem(Dialogs.ok) - d.SetDialogCancelItem(Dialogs.cancel) - d.AutoSizeDialog() - d.GetDialogWindow().ShowWindow() - while 1: - n = ModalDialog(None) - if n == 1: - h = d.GetDialogItemAsControl(4) - return cr2lf(GetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag)) - if n == 2: return None - -def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262): - """Display a QUESTION string which can be answered with Yes or No. - - Return 1 when the user clicks the Yes button. - Return 0 when the user clicks the No button. - Return -1 when the user clicks the Cancel button. - - When the user presses Return, the DEFAULT value is returned. - If omitted, this is 0 (No). - - The QUESTION string can be at most 255 characters. - """ - - _initialize() - _interact() - d = GetNewDialog(id, -1) - if not d: - print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" - return - # Button assignments: - # 1 = default (invisible) - # 2 = Yes - # 3 = No - # 4 = Cancel - # The question string is item 5 - h = d.GetDialogItemAsControl(5) - SetDialogItemText(h, lf2cr(question)) - if yes != None: - if yes == '': - d.HideDialogItem(2) - else: - h = d.GetDialogItemAsControl(2) - h.SetControlTitle(yes) - if no != None: - if no == '': - d.HideDialogItem(3) - else: - h = d.GetDialogItemAsControl(3) - h.SetControlTitle(no) - if cancel != None: - if cancel == '': - d.HideDialogItem(4) - else: - h = d.GetDialogItemAsControl(4) - h.SetControlTitle(cancel) - d.SetDialogCancelItem(4) - if default == 1: - d.SetDialogDefaultItem(2) - elif default == 0: - d.SetDialogDefaultItem(3) - elif default == -1: - d.SetDialogDefaultItem(4) - d.AutoSizeDialog() - d.GetDialogWindow().ShowWindow() - while 1: - n = ModalDialog(None) - if n == 1: return default - if n == 2: return 1 - if n == 3: return 0 - if n == 4: return -1 - - - - -screenbounds = Qd.GetQDGlobalsScreenBits().bounds -screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ - screenbounds[2]-4, screenbounds[3]-4 - -kControlProgressBarIndeterminateTag = 'inde' # from Controls.py - - -class ProgressBar: - def __init__(self, title="Working...", maxval=0, label="", id=263): - self.w = None - self.d = None - _initialize() - self.d = GetNewDialog(id, -1) - self.w = self.d.GetDialogWindow() - self.label(label) - self.title(title) - self.set(0, maxval) - self.d.AutoSizeDialog() - self.w.ShowWindow() - self.d.DrawDialog() - - def __del__(self): - if self.w: - self.w.BringToFront() - self.w.HideWindow() - del self.w - del self.d - - def title(self, newstr=""): - """title(text) - Set title of progress window""" - self.w.BringToFront() - self.w.SetWTitle(newstr) - - def label(self, *newstr): - """label(text) - Set text in progress box""" - self.w.BringToFront() - if newstr: - self._label = lf2cr(newstr[0]) - text_h = self.d.GetDialogItemAsControl(2) - SetDialogItemText(text_h, self._label) - - def _update(self, value): - maxval = self.maxval - if maxval == 0: # an indeterminate bar - Ctl.IdleControls(self.w) # spin the barber pole - else: # a determinate bar - if maxval > 32767: - value = int(value/(maxval/32767.0)) - maxval = 32767 - maxval = int(maxval) - value = int(value) - progbar = self.d.GetDialogItemAsControl(3) - progbar.SetControlMaximum(maxval) - progbar.SetControlValue(value) # set the bar length - - # Test for cancel button - ready, ev = Evt.WaitNextEvent( Events.mDownMask, 1 ) - if ready : - what,msg,when,where,mod = ev - part = Win.FindWindow(where)[0] - if Dlg.IsDialogEvent(ev): - ds = Dlg.DialogSelect(ev) - if ds[0] and ds[1] == self.d and ds[-1] == 1: - self.w.HideWindow() - self.w = None - self.d = None - raise KeyboardInterrupt, ev - else: - if part == 4: # inDrag - self.w.DragWindow(where, screenbounds) - else: - MacOS.HandleEvent(ev) - - - def set(self, value, max=None): - """set(value) - Set progress bar position""" - if max != None: - self.maxval = max - bar = self.d.GetDialogItemAsControl(3) - if max <= 0: # indeterminate bar - bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x01') - else: # determinate bar - bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x00') - if value < 0: - value = 0 - elif value > self.maxval: - value = self.maxval - self.curval = value - self._update(value) - - def inc(self, n=1): - """inc(amt) - Increment progress bar position""" - self.set(self.curval + n) - -ARGV_ID=265 -ARGV_ITEM_OK=1 -ARGV_ITEM_CANCEL=2 -ARGV_OPTION_GROUP=3 -ARGV_OPTION_EXPLAIN=4 -ARGV_OPTION_VALUE=5 -ARGV_OPTION_ADD=6 -ARGV_COMMAND_GROUP=7 -ARGV_COMMAND_EXPLAIN=8 -ARGV_COMMAND_ADD=9 -ARGV_ADD_OLDFILE=10 -ARGV_ADD_NEWFILE=11 -ARGV_ADD_FOLDER=12 -ARGV_CMDLINE_GROUP=13 -ARGV_CMDLINE_DATA=14 - -##def _myModalDialog(d): -## while 1: -## ready, ev = Evt.WaitNextEvent(0xffff, -1) -## print 'DBG: WNE', ready, ev -## if ready : -## what,msg,when,where,mod = ev -## part, window = Win.FindWindow(where) -## if Dlg.IsDialogEvent(ev): -## didit, dlgdone, itemdone = Dlg.DialogSelect(ev) -## print 'DBG: DialogSelect', didit, dlgdone, itemdone, d -## if didit and dlgdone == d: -## return itemdone -## elif window == d.GetDialogWindow(): -## d.GetDialogWindow().SelectWindow() -## if part == 4: # inDrag -## d.DragWindow(where, screenbounds) -## else: -## MacOS.HandleEvent(ev) -## else: -## MacOS.HandleEvent(ev) -## -def _setmenu(control, items): - mhandle = control.GetControlData_Handle(Controls.kControlMenuPart, - Controls.kControlPopupButtonMenuHandleTag) - menu = Menu.as_Menu(mhandle) - for item in items: - if type(item) == type(()): - label = item[0] - else: - label = item - if label[-1] == '=' or label[-1] == ':': - label = label[:-1] - menu.AppendMenu(label) -## mhandle, mid = menu.getpopupinfo() -## control.SetControlData_Handle(Controls.kControlMenuPart, -## Controls.kControlPopupButtonMenuHandleTag, mhandle) - control.SetControlMinimum(1) - control.SetControlMaximum(len(items)+1) - -def _selectoption(d, optionlist, idx): - if idx < 0 or idx >= len(optionlist): - MacOS.SysBeep() - return - option = optionlist[idx] - if type(option) == type(()): - if len(option) == 4: - help = option[2] - elif len(option) > 1: - help = option[-1] - else: - help = '' - else: - help = '' - h = d.GetDialogItemAsControl(ARGV_OPTION_EXPLAIN) - if help and len(help) > 250: - help = help[:250] + '...' - Dlg.SetDialogItemText(h, help) - hasvalue = 0 - if type(option) == type(()): - label = option[0] - else: - label = option - if label[-1] == '=' or label[-1] == ':': - hasvalue = 1 - h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE) - Dlg.SetDialogItemText(h, '') - if hasvalue: - d.ShowDialogItem(ARGV_OPTION_VALUE) - d.SelectDialogItemText(ARGV_OPTION_VALUE, 0, 0) - else: - d.HideDialogItem(ARGV_OPTION_VALUE) - - -def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): - _initialize() - _interact() - d = GetNewDialog(id, -1) - if not d: - print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" - return -# h = d.GetDialogItemAsControl(3) -# SetDialogItemText(h, lf2cr(prompt)) -# h = d.GetDialogItemAsControl(4) -# SetDialogItemText(h, lf2cr(default)) -# d.SelectDialogItemText(4, 0, 999) -# d.SetDialogItem(4, 0, 255) - if optionlist: - _setmenu(d.GetDialogItemAsControl(ARGV_OPTION_GROUP), optionlist) - _selectoption(d, optionlist, 0) - else: - d.GetDialogItemAsControl(ARGV_OPTION_GROUP).DeactivateControl() - if commandlist: - _setmenu(d.GetDialogItemAsControl(ARGV_COMMAND_GROUP), commandlist) - if type(commandlist[0]) == type(()) and len(commandlist[0]) > 1: - help = commandlist[0][-1] - h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN) - Dlg.SetDialogItemText(h, help) - else: - d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).DeactivateControl() - if not addoldfile: - d.GetDialogItemAsControl(ARGV_ADD_OLDFILE).DeactivateControl() - if not addnewfile: - d.GetDialogItemAsControl(ARGV_ADD_NEWFILE).DeactivateControl() - if not addfolder: - d.GetDialogItemAsControl(ARGV_ADD_FOLDER).DeactivateControl() - d.SetDialogDefaultItem(ARGV_ITEM_OK) - d.SetDialogCancelItem(ARGV_ITEM_CANCEL) - d.GetDialogWindow().ShowWindow() - d.DrawDialog() - if hasattr(MacOS, 'SchedParams'): - appsw = MacOS.SchedParams(1, 0) - try: - while 1: - stringstoadd = [] - n = ModalDialog(None) - if n == ARGV_ITEM_OK: - break - elif n == ARGV_ITEM_CANCEL: - raise SystemExit - elif n == ARGV_OPTION_GROUP: - idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1 - _selectoption(d, optionlist, idx) - elif n == ARGV_OPTION_VALUE: - pass - elif n == ARGV_OPTION_ADD: - idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1 - if 0 <= idx < len(optionlist): - option = optionlist[idx] - if type(option) == type(()): - option = option[0] - if option[-1] == '=' or option[-1] == ':': - option = option[:-1] - h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE) - value = Dlg.GetDialogItemText(h) - else: - value = '' - if len(option) == 1: - stringtoadd = '-' + option - else: - stringtoadd = '--' + option - stringstoadd = [stringtoadd] - if value: - stringstoadd.append(value) - else: - MacOS.SysBeep() - elif n == ARGV_COMMAND_GROUP: - idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1 - if 0 <= idx < len(commandlist) and type(commandlist[idx]) == type(()) and \ - len(commandlist[idx]) > 1: - help = commandlist[idx][-1] - h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN) - Dlg.SetDialogItemText(h, help) - elif n == ARGV_COMMAND_ADD: - idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1 - if 0 <= idx < len(commandlist): - command = commandlist[idx] - if type(command) == type(()): - command = command[0] - stringstoadd = [command] - else: - MacOS.SysBeep() - elif n == ARGV_ADD_OLDFILE: - pathname = AskFileForOpen() - if pathname: - stringstoadd = [pathname] - elif n == ARGV_ADD_NEWFILE: - pathname = AskFileForSave() - if pathname: - stringstoadd = [pathname] - elif n == ARGV_ADD_FOLDER: - pathname = AskFolder() - if pathname: - stringstoadd = [pathname] - elif n == ARGV_CMDLINE_DATA: - pass # Nothing to do - else: - raise RuntimeError, "Unknown dialog item %d"%n - - for stringtoadd in stringstoadd: - if '"' in stringtoadd or "'" in stringtoadd or " " in stringtoadd: - stringtoadd = repr(stringtoadd) - h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA) - oldstr = GetDialogItemText(h) - if oldstr and oldstr[-1] != ' ': - oldstr = oldstr + ' ' - oldstr = oldstr + stringtoadd - if oldstr[-1] != ' ': - oldstr = oldstr + ' ' - SetDialogItemText(h, oldstr) - d.SelectDialogItemText(ARGV_CMDLINE_DATA, 0x7fff, 0x7fff) - h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA) - oldstr = GetDialogItemText(h) - tmplist = string.split(oldstr) - newlist = [] - while tmplist: - item = tmplist[0] - del tmplist[0] - if item[0] == '"': - while item[-1] != '"': - if not tmplist: - raise RuntimeError, "Unterminated quoted argument" - item = item + ' ' + tmplist[0] - del tmplist[0] - item = item[1:-1] - if item[0] == "'": - while item[-1] != "'": - if not tmplist: - raise RuntimeError, "Unterminated quoted argument" - item = item + ' ' + tmplist[0] - del tmplist[0] - item = item[1:-1] - newlist.append(item) - return newlist - finally: - if hasattr(MacOS, 'SchedParams'): - MacOS.SchedParams(*appsw) - del d - -def _process_Nav_args(dftflags, **args): - import aepack - import Carbon.AE - import Carbon.File - for k in args.keys(): - if args[k] is None: - del args[k] - # Set some defaults, and modify some arguments - if not args.has_key('dialogOptionFlags'): - args['dialogOptionFlags'] = dftflags - if args.has_key('defaultLocation') and \ - not isinstance(args['defaultLocation'], Carbon.AE.AEDesc): - defaultLocation = args['defaultLocation'] - if isinstance(defaultLocation, (Carbon.File.FSSpec, Carbon.File.FSRef)): - args['defaultLocation'] = aepack.pack(defaultLocation) - else: - defaultLocation = Carbon.File.FSRef(defaultLocation) - args['defaultLocation'] = aepack.pack(defaultLocation) - if args.has_key('typeList') and not isinstance(args['typeList'], Carbon.Res.ResourceType): - typeList = args['typeList'][:] - # Workaround for OSX typeless files: - if 'TEXT' in typeList and not '\0\0\0\0' in typeList: - typeList = typeList + ('\0\0\0\0',) - data = 'Pyth' + struct.pack("hh", 0, len(typeList)) - for type in typeList: - data = data+type - args['typeList'] = Carbon.Res.Handle(data) - tpwanted = str - if args.has_key('wanted'): - tpwanted = args['wanted'] - del args['wanted'] - return args, tpwanted - -def _dummy_Nav_eventproc(msg, data): - pass - -_default_Nav_eventproc = _dummy_Nav_eventproc - -def SetDefaultEventProc(proc): - global _default_Nav_eventproc - rv = _default_Nav_eventproc - if proc is None: - proc = _dummy_Nav_eventproc - _default_Nav_eventproc = proc - return rv - -def AskFileForOpen( - message=None, - typeList=None, - # From here on the order is not documented - version=None, - defaultLocation=None, - dialogOptionFlags=None, - location=None, - clientName=None, - windowTitle=None, - actionButtonLabel=None, - cancelButtonLabel=None, - preferenceKey=None, - popupExtension=None, - eventProc=_dummy_Nav_eventproc, - previewProc=None, - filterProc=None, - wanted=None, - multiple=None): - """Display a dialog asking the user for a file to open. - - wanted is the return type wanted: FSSpec, FSRef, unicode or string (default) - the other arguments can be looked up in Apple's Navigation Services documentation""" - - default_flags = 0x56 # Or 0xe4? - args, tpwanted = _process_Nav_args(default_flags, version=version, - defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags, - location=location,clientName=clientName,windowTitle=windowTitle, - actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel, - message=message,preferenceKey=preferenceKey, - popupExtension=popupExtension,eventProc=eventProc,previewProc=previewProc, - filterProc=filterProc,typeList=typeList,wanted=wanted,multiple=multiple) - _interact() - try: - rr = Nav.NavChooseFile(args) - good = 1 - except Nav.error, arg: - if arg[0] != -128: # userCancelledErr - raise Nav.error, arg - return None - if not rr.validRecord or not rr.selection: - return None - if issubclass(tpwanted, Carbon.File.FSRef): - return tpwanted(rr.selection_fsr[0]) - if issubclass(tpwanted, Carbon.File.FSSpec): - return tpwanted(rr.selection[0]) - if issubclass(tpwanted, str): - return tpwanted(rr.selection_fsr[0].as_pathname()) - if issubclass(tpwanted, unicode): - return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8') - raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) - -def AskFileForSave( - message=None, - savedFileName=None, - # From here on the order is not documented - version=None, - defaultLocation=None, - dialogOptionFlags=None, - location=None, - clientName=None, - windowTitle=None, - actionButtonLabel=None, - cancelButtonLabel=None, - preferenceKey=None, - popupExtension=None, - eventProc=_dummy_Nav_eventproc, - fileType=None, - fileCreator=None, - wanted=None, - multiple=None): - """Display a dialog asking the user for a filename to save to. - - wanted is the return type wanted: FSSpec, FSRef, unicode or string (default) - the other arguments can be looked up in Apple's Navigation Services documentation""" - - - default_flags = 0x07 - args, tpwanted = _process_Nav_args(default_flags, version=version, - defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags, - location=location,clientName=clientName,windowTitle=windowTitle, - actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel, - savedFileName=savedFileName,message=message,preferenceKey=preferenceKey, - popupExtension=popupExtension,eventProc=eventProc,fileType=fileType, - fileCreator=fileCreator,wanted=wanted,multiple=multiple) - _interact() - try: - rr = Nav.NavPutFile(args) - good = 1 - except Nav.error, arg: - if arg[0] != -128: # userCancelledErr - raise Nav.error, arg - return None - if not rr.validRecord or not rr.selection: - return None - if issubclass(tpwanted, Carbon.File.FSRef): - raise TypeError, "Cannot pass wanted=FSRef to AskFileForSave" - if issubclass(tpwanted, Carbon.File.FSSpec): - return tpwanted(rr.selection[0]) - if issubclass(tpwanted, (str, unicode)): - if sys.platform == 'mac': - fullpath = rr.selection[0].as_pathname() - else: - # This is gross, and probably incorrect too - vrefnum, dirid, name = rr.selection[0].as_tuple() - pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) - pardir_fsr = Carbon.File.FSRef(pardir_fss) - pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 - name_utf8 = unicode(name, 'macroman').encode('utf8') - fullpath = os.path.join(pardir_path, name_utf8) - if issubclass(tpwanted, unicode): - return unicode(fullpath, 'utf8') - return tpwanted(fullpath) - raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) - -def AskFolder( - message=None, - # From here on the order is not documented - version=None, - defaultLocation=None, - dialogOptionFlags=None, - location=None, - clientName=None, - windowTitle=None, - actionButtonLabel=None, - cancelButtonLabel=None, - preferenceKey=None, - popupExtension=None, - eventProc=_dummy_Nav_eventproc, - filterProc=None, - wanted=None, - multiple=None): - """Display a dialog asking the user for select a folder. - - wanted is the return type wanted: FSSpec, FSRef, unicode or string (default) - the other arguments can be looked up in Apple's Navigation Services documentation""" - - default_flags = 0x17 - args, tpwanted = _process_Nav_args(default_flags, version=version, - defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags, - location=location,clientName=clientName,windowTitle=windowTitle, - actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel, - message=message,preferenceKey=preferenceKey, - popupExtension=popupExtension,eventProc=eventProc,filterProc=filterProc, - wanted=wanted,multiple=multiple) - _interact() - try: - rr = Nav.NavChooseFolder(args) - good = 1 - except Nav.error, arg: - if arg[0] != -128: # userCancelledErr - raise Nav.error, arg - return None - if not rr.validRecord or not rr.selection: - return None - if issubclass(tpwanted, Carbon.File.FSRef): - return tpwanted(rr.selection_fsr[0]) - if issubclass(tpwanted, Carbon.File.FSSpec): - return tpwanted(rr.selection[0]) - if issubclass(tpwanted, str): - return tpwanted(rr.selection_fsr[0].as_pathname()) - if issubclass(tpwanted, unicode): - return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8') - raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) - - -def test(): - import time - - Message("Testing EasyDialogs.") - optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), - ('flags=', 'Valued option'), ('f:', 'Short valued option')) - commandlist = (('start', 'Start something'), ('stop', 'Stop something')) - argv = GetArgv(optionlist=optionlist, commandlist=commandlist, addoldfile=0) - Message("Command line: %s"%' '.join(argv)) - for i in range(len(argv)): - print 'arg[%d] = %r' % (i, argv[i]) - ok = AskYesNoCancel("Do you want to proceed?") - ok = AskYesNoCancel("Do you want to identify?", yes="Identify", no="No") - if ok > 0: - s = AskString("Enter your first name", "Joe") - s2 = AskPassword("Okay %s, tell us your nickname"%s, s, cancel="None") - if not s2: - Message("%s has no secret nickname"%s) - else: - Message("Hello everybody!!\nThe secret nickname of %s is %s!!!"%(s, s2)) - else: - s = 'Anonymous' - rv = AskFileForOpen(message="Gimme a file, %s"%s, wanted=Carbon.File.FSSpec) - Message("rv: %s"%rv) - rv = AskFileForSave(wanted=Carbon.File.FSRef, savedFileName="%s.txt"%s) - Message("rv.as_pathname: %s"%rv.as_pathname()) - rv = AskFolder() - Message("Folder name: %s"%rv) - text = ( "Working Hard...", "Hardly Working..." , - "So far, so good!", "Keep on truckin'" ) - bar = ProgressBar("Progress, progress...", 0, label="Ramping up...") - try: - if hasattr(MacOS, 'SchedParams'): - appsw = MacOS.SchedParams(1, 0) - for i in xrange(20): - bar.inc() - time.sleep(0.05) - bar.set(0,100) - for i in xrange(100): - bar.set(i) - time.sleep(0.05) - if i % 10 == 0: - bar.label(text[(i/10) % 4]) - bar.label("Done.") - time.sleep(1.0) # give'em a chance to see "Done." - finally: - del bar - if hasattr(MacOS, 'SchedParams'): - MacOS.SchedParams(*appsw) - -if __name__ == '__main__': - try: - test() - except KeyboardInterrupt: - Message("Operation Canceled.") diff --git a/sys/lib/python/plat-mac/FrameWork.py b/sys/lib/python/plat-mac/FrameWork.py deleted file mode 100644 index 0a8c1b8e6..000000000 --- a/sys/lib/python/plat-mac/FrameWork.py +++ /dev/null @@ -1,1123 +0,0 @@ -"A sort of application framework for the Mac" - -DEBUG=0 - -import MacOS -import traceback - -from Carbon.AE import * -from Carbon.AppleEvents import * -from Carbon.Ctl import * -from Carbon.Controls import * -from Carbon.Dlg import * -from Carbon.Dialogs import * -from Carbon.Evt import * -from Carbon.Events import * -from Carbon.Help import * -from Carbon.Menu import * -from Carbon.Menus import * -from Carbon.Qd import * -from Carbon.QuickDraw import * -#from Carbon.Res import * -#from Carbon.Resources import * -#from Carbon.Snd import * -#from Carbon.Sound import * -from Carbon.Win import * -from Carbon.Windows import * -import types - -import EasyDialogs - -try: - MyFrontWindow = FrontNonFloatingWindow -except NameError: - MyFrontWindow = FrontWindow - -kHighLevelEvent = 23 # Don't know what header file this should come from -SCROLLBARWIDTH = 16 # Again, not a clue... - -# Trick to forestall a set of SIOUX menus being added to our menubar -SIOUX_APPLEMENU_ID=32000 - - -# Map event 'what' field to strings -eventname = {} -eventname[1] = 'mouseDown' -eventname[2] = 'mouseUp' -eventname[3] = 'keyDown' -eventname[4] = 'keyUp' -eventname[5] = 'autoKey' -eventname[6] = 'updateEvt' -eventname[7] = 'diskEvt' -eventname[8] = 'activateEvt' -eventname[15] = 'osEvt' -eventname[23] = 'kHighLevelEvent' - -# Map part codes returned by WhichWindow() to strings -partname = {} -partname[0] = 'inDesk' -partname[1] = 'inMenuBar' -partname[2] = 'inSysWindow' -partname[3] = 'inContent' -partname[4] = 'inDrag' -partname[5] = 'inGrow' -partname[6] = 'inGoAway' -partname[7] = 'inZoomIn' -partname[8] = 'inZoomOut' - -# -# The useable portion of the screen -# ## but what happens with multiple screens? jvr -screenbounds = GetQDGlobalsScreenBits().bounds -screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ - screenbounds[2]-4, screenbounds[3]-4 - -next_window_x = 16 # jvr -next_window_y = 44 # jvr - -def windowbounds(width, height): - "Return sensible window bounds" - global next_window_x, next_window_y - r, b = next_window_x+width, next_window_y+height - if r > screenbounds[2]: - next_window_x = 16 - if b > screenbounds[3]: - next_window_y = 44 - l, t = next_window_x, next_window_y - r, b = next_window_x+width, next_window_y+height - next_window_x, next_window_y = next_window_x + 8, next_window_y + 20 # jvr - return l, t, r, b - -_watch = None -def setwatchcursor(): - global _watch - - if _watch == None: - _watch = GetCursor(4).data - SetCursor(_watch) - -def setarrowcursor(): - SetCursor(GetQDGlobalsArrow()) - -class Application: - - "Application framework -- your application should be a derived class" - - def __init__(self, nomenubar=0): - self._doing_asyncevents = 0 - self.quitting = 0 - self.needmenubarredraw = 0 - self._windows = {} - self._helpmenu = None - if nomenubar: - self.menubar = None - else: - self.makemenubar() - - def __del__(self): - if self._doing_asyncevents: - self._doing_asyncevents = 0 - MacOS.SetEventHandler() - - def makemenubar(self): - self.menubar = MenuBar(self) - AppleMenu(self.menubar, self.getabouttext(), self.do_about) - self.makeusermenus() - - def makeusermenus(self): - self.filemenu = m = Menu(self.menubar, "File") - self._quititem = MenuItem(m, "Quit", "Q", self._quit) - - def gethelpmenu(self): - if self._helpmenu == None: - self._helpmenu = HelpMenu(self.menubar) - return self._helpmenu - - def _quit(self, *args): - self.quitting = 1 - - def cleanup(self): - for w in self._windows.values(): - w.do_close() - return self._windows == {} - - def appendwindow(self, wid, window): - self._windows[wid] = window - - def removewindow(self, wid): - del self._windows[wid] - - def getabouttext(self): - return "About %s..." % self.__class__.__name__ - - def do_about(self, id, item, window, event): - EasyDialogs.Message("Hello, world!" + "\015(%s)" % self.__class__.__name__) - - # The main event loop is broken up in several simple steps. - # This is done so you can override each individual part, - # if you have a need to do extra processing independent of the - # event type. - # Normally, however, you'd just define handlers for individual - # events. - - schedparams = (0, 0) # By default disable Python's event handling - default_wait = None # By default we wait GetCaretTime in WaitNextEvent - - def mainloop(self, mask = everyEvent, wait = None): - self.quitting = 0 - if hasattr(MacOS, 'SchedParams'): - saveparams = MacOS.SchedParams(*self.schedparams) - try: - while not self.quitting: - try: - self.do1event(mask, wait) - except (Application, SystemExit): - # Note: the raising of "self" is old-fashioned idiom to - # exit the mainloop. Calling _quit() is better for new - # applications. - break - finally: - if hasattr(MacOS, 'SchedParams'): - MacOS.SchedParams(*saveparams) - - def dopendingevents(self, mask = everyEvent): - """dopendingevents - Handle all pending events""" - while self.do1event(mask, wait=0): - pass - - def do1event(self, mask = everyEvent, wait = None): - ok, event = self.getevent(mask, wait) - if IsDialogEvent(event): - if self.do_dialogevent(event): - return - if ok: - self.dispatch(event) - else: - self.idle(event) - - def idle(self, event): - pass - - def getevent(self, mask = everyEvent, wait = None): - if self.needmenubarredraw: - DrawMenuBar() - self.needmenubarredraw = 0 - if wait is None: - wait = self.default_wait - if wait is None: - wait = GetCaretTime() - ok, event = WaitNextEvent(mask, wait) - return ok, event - - def dispatch(self, event): - # The following appears to be double work (already done in do1event) - # but we need it for asynchronous event handling - if IsDialogEvent(event): - if self.do_dialogevent(event): - return - (what, message, when, where, modifiers) = event - if eventname.has_key(what): - name = "do_" + eventname[what] - else: - name = "do_%d" % what - try: - handler = getattr(self, name) - except AttributeError: - handler = self.do_unknownevent - handler(event) - - def asyncevents(self, onoff): - """asyncevents - Set asynchronous event handling on or off""" - if MacOS.runtimemodel == 'macho': - raise 'Unsupported in MachoPython' - old = self._doing_asyncevents - if old: - MacOS.SetEventHandler() - MacOS.SchedParams(*self.schedparams) - if onoff: - MacOS.SetEventHandler(self.dispatch) - doint, dummymask, benice, howoften, bgyield = \ - self.schedparams - MacOS.SchedParams(doint, everyEvent, benice, - howoften, bgyield) - self._doing_asyncevents = onoff - return old - - def do_dialogevent(self, event): - gotone, dlg, item = DialogSelect(event) - if gotone: - window = dlg.GetDialogWindow() - if self._windows.has_key(window): - self._windows[window].do_itemhit(item, event) - else: - print 'Dialog event for unknown dialog' - return 1 - return 0 - - def do_mouseDown(self, event): - (what, message, when, where, modifiers) = event - partcode, wid = FindWindow(where) - - # - # Find the correct name. - # - if partname.has_key(partcode): - name = "do_" + partname[partcode] - else: - name = "do_%d" % partcode - - if wid == None: - # No window, or a non-python window - try: - handler = getattr(self, name) - except AttributeError: - # Not menubar or something, so assume someone - # else's window - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - return - elif self._windows.has_key(wid): - # It is a window. Hand off to correct window. - window = self._windows[wid] - try: - handler = getattr(window, name) - except AttributeError: - handler = self.do_unknownpartcode - else: - # It is a python-toolbox window, but not ours. - handler = self.do_unknownwindow - handler(partcode, wid, event) - - def do_inSysWindow(self, partcode, window, event): - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_inDesk(self, partcode, window, event): - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_inMenuBar(self, partcode, window, event): - if not self.menubar: - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - return - (what, message, when, where, modifiers) = event - result = MenuSelect(where) - id = (result>>16) & 0xffff # Hi word - if id >= 0x8000: - id = -65536 + id - item = result & 0xffff # Lo word - self.do_rawmenu(id, item, window, event) - - def do_rawmenu(self, id, item, window, event): - try: - self.do_menu(id, item, window, event) - finally: - HiliteMenu(0) - - def do_menu(self, id, item, window, event): - if hasattr(MacOS, 'OutputSeen'): - MacOS.OutputSeen() - self.menubar.dispatch(id, item, window, event) - - - def do_unknownpartcode(self, partcode, window, event): - (what, message, when, where, modifiers) = event - if DEBUG: print "Mouse down at global:", where - if DEBUG: print "\tUnknown part code:", partcode - if DEBUG: print "\tEvent:", self.printevent(event) - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_unknownwindow(self, partcode, window, event): - if DEBUG: print 'Unknown window:', window - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_keyDown(self, event): - self.do_key(event) - - def do_autoKey(self, event): - if not event[-1] & cmdKey: - self.do_key(event) - - def do_key(self, event): - (what, message, when, where, modifiers) = event - c = chr(message & charCodeMask) - if self.menubar: - result = MenuEvent(event) - id = (result>>16) & 0xffff # Hi word - item = result & 0xffff # Lo word - if id: - self.do_rawmenu(id, item, None, event) - return - # Otherwise we fall-through - if modifiers & cmdKey: - if c == '.': - raise self - else: - if not self.menubar: - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - return - else: - # See whether the front window wants it - w = MyFrontWindow() - if w and self._windows.has_key(w): - window = self._windows[w] - try: - do_char = window.do_char - except AttributeError: - do_char = self.do_char - do_char(c, event) - # else it wasn't for us, sigh... - - def do_char(self, c, event): - if DEBUG: print "Character", repr(c) - - def do_updateEvt(self, event): - (what, message, when, where, modifiers) = event - wid = WhichWindow(message) - if wid and self._windows.has_key(wid): - window = self._windows[wid] - window.do_rawupdate(wid, event) - else: - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_activateEvt(self, event): - (what, message, when, where, modifiers) = event - wid = WhichWindow(message) - if wid and self._windows.has_key(wid): - window = self._windows[wid] - window.do_activate(modifiers & 1, event) - else: - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - - def do_osEvt(self, event): - (what, message, when, where, modifiers) = event - which = (message >> 24) & 0xff - if which == 1: # suspend/resume - self.do_suspendresume(event) - else: - if DEBUG: - print 'unknown osEvt:', - self.printevent(event) - - def do_suspendresume(self, event): - (what, message, when, where, modifiers) = event - wid = MyFrontWindow() - if wid and self._windows.has_key(wid): - window = self._windows[wid] - window.do_activate(message & 1, event) - - def do_kHighLevelEvent(self, event): - (what, message, when, where, modifiers) = event - if DEBUG: - print "High Level Event:", - self.printevent(event) - try: - AEProcessAppleEvent(event) - except: - pass - #print "AEProcessAppleEvent error:" - #traceback.print_exc() - - def do_unknownevent(self, event): - if DEBUG: - print "Unhandled event:", - self.printevent(event) - - def printevent(self, event): - (what, message, when, where, modifiers) = event - nicewhat = repr(what) - if eventname.has_key(what): - nicewhat = eventname[what] - print nicewhat, - if what == kHighLevelEvent: - h, v = where - print repr(ostypecode(message)), hex(when), repr(ostypecode(h | (v<<16))), - else: - print hex(message), hex(when), where, - print hex(modifiers) - - -class MenuBar: - """Represent a set of menus in a menu bar. - - Interface: - - - (constructor) - - (destructor) - - addmenu - - addpopup (normally used internally) - - dispatch (called from Application) - """ - - nextid = 1 # Necessarily a class variable - - def getnextid(self): - id = MenuBar.nextid - MenuBar.nextid = id+1 - return id - - def __init__(self, parent=None): - self.parent = parent - ClearMenuBar() - self.bar = GetMenuBar() - self.menus = {} - - # XXX necessary? - def close(self): - self.parent = None - self.bar = None - self.menus = None - - def addmenu(self, title, after = 0, id=None): - if id == None: - id = self.getnextid() - if DEBUG: print 'Newmenu', title, id # XXXX - m = NewMenu(id, title) - m.InsertMenu(after) - if after >= 0: - if self.parent: - self.parent.needmenubarredraw = 1 - else: - DrawMenuBar() - return id, m - - def delmenu(self, id): - if DEBUG: print 'Delmenu', id # XXXX - DeleteMenu(id) - - def addpopup(self, title = ''): - return self.addmenu(title, -1) - -# Useless: -# def install(self): -# if not self.bar: return -# SetMenuBar(self.bar) -# if self.parent: -# self.parent.needmenubarredraw = 1 -# else: -# DrawMenuBar() - - def fixmenudimstate(self): - for m in self.menus.keys(): - menu = self.menus[m] - if menu.__class__ == FrameWork.AppleMenu: - continue - for i in range(len(menu.items)): - label, shortcut, callback, kind = menu.items[i] - if type(callback) == types.StringType: - wid = MyFrontWindow() - if wid and self.parent._windows.has_key(wid): - window = self.parent._windows[wid] - if hasattr(window, "domenu_" + callback): - menu.menu.EnableMenuItem(i + 1) - elif hasattr(self.parent, "domenu_" + callback): - menu.menu.EnableMenuItem(i + 1) - else: - menu.menu.DisableMenuItem(i + 1) - elif hasattr(self.parent, "domenu_" + callback): - menu.menu.EnableMenuItem(i + 1) - else: - menu.menu.DisableMenuItem(i + 1) - elif callback: - pass - - def dispatch(self, id, item, window, event): - if self.menus.has_key(id): - self.menus[id].dispatch(id, item, window, event) - else: - if DEBUG: print "MenuBar.dispatch(%d, %d, %s, %s)" % \ - (id, item, window, event) - - -# XXX Need a way to get menus as resources and bind them to callbacks - -class Menu: - "One menu." - - def __init__(self, bar, title, after=0, id=None): - self.bar = bar - self.id, self.menu = self.bar.addmenu(title, after, id) - bar.menus[self.id] = self - self.items = [] - self._parent = None - - def delete(self): - self.bar.delmenu(self.id) - del self.bar.menus[self.id] - self.menu.DisposeMenu() - del self.bar - del self.items - del self.menu - del self.id - del self._parent - - def additem(self, label, shortcut=None, callback=None, kind=None): - self.menu.AppendMenu('x') # add a dummy string - self.items.append((label, shortcut, callback, kind)) - item = len(self.items) - if isinstance(label, unicode): - self.menu.SetMenuItemTextWithCFString(item, label) - else: - self.menu.SetMenuItemText(item, label) - if shortcut and type(shortcut) == type(()): - modifiers, char = shortcut[:2] - self.menu.SetItemCmd(item, ord(char)) - self.menu.SetMenuItemModifiers(item, modifiers) - if len(shortcut) > 2: - self.menu.SetMenuItemKeyGlyph(item, shortcut[2]) - elif shortcut: - self.menu.SetItemCmd(item, ord(shortcut)) - return item - - def delitem(self, item): - if item != len(self.items): - raise 'Can only delete last item of a menu' - self.menu.DeleteMenuItem(item) - del self.items[item-1] - - def addcheck(self, label, shortcut=None, callback=None): - return self.additem(label, shortcut, callback, 'check') - - def addradio(self, label, shortcut=None, callback=None): - return self.additem(label, shortcut, callback, 'radio') - - def addseparator(self): - self.menu.AppendMenu('(-') - self.items.append(('', None, None, 'separator')) - - def addsubmenu(self, label, title=''): - sub = Menu(self.bar, title, -1) - item = self.additem(label, '\x1B', None, 'submenu') - self.menu.SetItemMark(item, sub.id) - sub._parent = self - sub._parent_item = item - return sub - - def dispatch(self, id, item, window, event): - title, shortcut, callback, mtype = self.items[item-1] - if callback: - if not self.bar.parent or type(callback) <> types.StringType: - menuhandler = callback - else: - # callback is string - wid = MyFrontWindow() - if wid and self.bar.parent._windows.has_key(wid): - window = self.bar.parent._windows[wid] - if hasattr(window, "domenu_" + callback): - menuhandler = getattr(window, "domenu_" + callback) - elif hasattr(self.bar.parent, "domenu_" + callback): - menuhandler = getattr(self.bar.parent, "domenu_" + callback) - else: - # nothing we can do. we shouldn't have come this far - # since the menu item should have been disabled... - return - elif hasattr(self.bar.parent, "domenu_" + callback): - menuhandler = getattr(self.bar.parent, "domenu_" + callback) - else: - # nothing we can do. we shouldn't have come this far - # since the menu item should have been disabled... - return - menuhandler(id, item, window, event) - - def enable(self, onoff): - if onoff: - self.menu.EnableMenuItem(0) - if self._parent: - self._parent.menu.EnableMenuItem(self._parent_item) - else: - self.menu.DisableMenuItem(0) - if self._parent: - self._parent.menu.DisableMenuItem(self._parent_item) - if self.bar and self.bar.parent: - self.bar.parent.needmenubarredraw = 1 - -class PopupMenu(Menu): - def __init__(self, bar): - Menu.__init__(self, bar, '(popup)', -1) - - def popup(self, x, y, event, default=1, window=None): - # NOTE that x and y are global coordinates, and they should probably - # be topleft of the button the user clicked (not mouse-coordinates), - # so the popup nicely overlaps. - reply = self.menu.PopUpMenuSelect(x, y, default) - if not reply: - return - id = (reply >> 16) & 0xffff - item = reply & 0xffff - if not window: - wid = MyFrontWindow() - try: - window = self.bar.parent._windows[wid] - except: - pass # If we can't find the window we pass None - self.dispatch(id, item, window, event) - -class MenuItem: - def __init__(self, menu, title, shortcut=None, callback=None, kind=None): - self.item = menu.additem(title, shortcut, callback) - self.menu = menu - - def delete(self): - self.menu.delitem(self.item) - del self.menu - del self.item - - def check(self, onoff): - self.menu.menu.CheckMenuItem(self.item, onoff) - - def enable(self, onoff): - if onoff: - self.menu.menu.EnableMenuItem(self.item) - else: - self.menu.menu.DisableMenuItem(self.item) - - def settext(self, text): - self.menu.menu.SetMenuItemText(self.item, text) - - def setstyle(self, style): - self.menu.menu.SetItemStyle(self.item, style) - - def seticon(self, icon): - self.menu.menu.SetItemIcon(self.item, icon) - - def setcmd(self, cmd): - self.menu.menu.SetItemCmd(self.item, cmd) - - def setmark(self, cmd): - self.menu.menu.SetItemMark(self.item, cmd) - - -class RadioItem(MenuItem): - def __init__(self, menu, title, shortcut=None, callback=None): - MenuItem.__init__(self, menu, title, shortcut, callback, 'radio') - -class CheckItem(MenuItem): - def __init__(self, menu, title, shortcut=None, callback=None): - MenuItem.__init__(self, menu, title, shortcut, callback, 'check') - -def Separator(menu): - menu.addseparator() - -def SubMenu(menu, label, title=''): - return menu.addsubmenu(label, title) - - -class AppleMenu(Menu): - - def __init__(self, bar, abouttext="About me...", aboutcallback=None): - Menu.__init__(self, bar, "\024", id=SIOUX_APPLEMENU_ID) - if MacOS.runtimemodel == 'ppc': - self.additem(abouttext, None, aboutcallback) - self.addseparator() - self.menu.AppendResMenu('DRVR') - else: - # Additem()'s tricks do not work for "apple" menu under Carbon - self.menu.InsertMenuItem(abouttext, 0) - self.items.append((abouttext, None, aboutcallback, None)) - - def dispatch(self, id, item, window, event): - if item == 1: - Menu.dispatch(self, id, item, window, event) - elif MacOS.runtimemodel == 'ppc': - name = self.menu.GetMenuItemText(item) - OpenDeskAcc(name) - -class HelpMenu(Menu): - def __init__(self, bar): - # Note we don't call Menu.__init__, we do the necessary things by hand - self.bar = bar - self.menu, index = HMGetHelpMenu() - self.id = self.menu.GetMenuID() - bar.menus[self.id] = self - # The next line caters for the entries the system already handles for us - self.items = [None]*(index-1) - self._parent = None - - -class Window: - """A single window belonging to an application""" - - def __init__(self, parent): - self.wid = None - self.parent = parent - - def open(self, bounds=(40, 40, 400, 400), resid=None): - if resid <> None: - self.wid = GetNewWindow(resid, -1) - else: - self.wid = NewWindow(bounds, self.__class__.__name__, 1, - 8, -1, 1, 0) # changed to proc id 8 to include zoom box. jvr - self.do_postopen() - - def do_postopen(self): - """Tell our parent we exist""" - self.parent.appendwindow(self.wid, self) - - def close(self): - self.do_postclose() - - def do_postclose(self): - self.parent.removewindow(self.wid) - self.parent = None - self.wid = None - - def SetPort(self): - # Convinience method - SetPort(self.wid) - - def GetWindow(self): - return self.wid - - def do_inDrag(self, partcode, window, event): - where = event[3] - window.DragWindow(where, self.draglimit) - - draglimit = screenbounds - - def do_inGoAway(self, partcode, window, event): - where = event[3] - if window.TrackGoAway(where): - self.close() - - def do_inZoom(self, partcode, window, event): - (what, message, when, where, modifiers) = event - if window.TrackBox(where, partcode): - window.ZoomWindow(partcode, 1) - rect = window.GetWindowUserState() # so that zoom really works... jvr - self.do_postresize(rect[2] - rect[0], rect[3] - rect[1], window) # jvr - - def do_inZoomIn(self, partcode, window, event): - SetPort(window) # !!! - self.do_inZoom(partcode, window, event) - - def do_inZoomOut(self, partcode, window, event): - SetPort(window) # !!! - self.do_inZoom(partcode, window, event) - - def do_inGrow(self, partcode, window, event): - (what, message, when, where, modifiers) = event - result = window.GrowWindow(where, self.growlimit) - if result: - height = (result>>16) & 0xffff # Hi word - width = result & 0xffff # Lo word - self.do_resize(width, height, window) - - growlimit = (50, 50, screenbounds[2] - screenbounds[0], screenbounds[3] - screenbounds[1]) # jvr - - def do_resize(self, width, height, window): - l, t, r, b = self.wid.GetWindowPort().GetPortBounds() # jvr, forGrowIcon - self.SetPort() # jvr - self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr - window.SizeWindow(width, height, 1) # changed updateFlag to true jvr - self.do_postresize(width, height, window) - - def do_postresize(self, width, height, window): - SetPort(window) - self.wid.InvalWindowRect(window.GetWindowPort().GetPortBounds()) - - def do_inContent(self, partcode, window, event): - # - # If we're not frontmost, select ourselves and wait for - # the activate event. - # - if MyFrontWindow() <> window: - window.SelectWindow() - return - # We are. Handle the event. - (what, message, when, where, modifiers) = event - SetPort(window) - local = GlobalToLocal(where) - self.do_contentclick(local, modifiers, event) - - def do_contentclick(self, local, modifiers, event): - if DEBUG: - print 'Click in contents at %s, modifiers %s'%(local, modifiers) - - def do_rawupdate(self, window, event): - if DEBUG: print "raw update for", window - SetPort(window) - window.BeginUpdate() - self.do_update(window, event) - window.EndUpdate() - - def do_update(self, window, event): - if DEBUG: - import time - for i in range(8): - time.sleep(0.1) - InvertRgn(window.GetWindowPort().visRgn) - FillRgn(window.GetWindowPort().visRgn, GetQDGlobalsGray()) - else: - EraseRgn(window.GetWindowPort().visRgn) - - def do_activate(self, activate, event): - if DEBUG: print 'Activate %d for %s'%(activate, self.wid) - -class ControlsWindow(Window): - - def do_rawupdate(self, window, event): - if DEBUG: print "raw update for", window - SetPort(window) - window.BeginUpdate() - self.do_update(window, event) - #DrawControls(window) # jvr - UpdateControls(window, window.GetWindowPort().visRgn) # jvr - window.DrawGrowIcon() - window.EndUpdate() - - def do_controlhit(self, window, control, pcode, event): - if DEBUG: print "control hit in", window, "on", control, "; pcode =", pcode - - def do_inContent(self, partcode, window, event): - if MyFrontWindow() <> window: - window.SelectWindow() - return - (what, message, when, where, modifiers) = event - SetPort(window) # XXXX Needed? - local = GlobalToLocal(where) - pcode, control = FindControl(local, window) - if pcode and control: - self.do_rawcontrolhit(window, control, pcode, local, event) - else: - if DEBUG: print "FindControl(%s, %s) -> (%s, %s)" % \ - (local, window, pcode, control) - self.do_contentclick(local, modifiers, event) - - def do_rawcontrolhit(self, window, control, pcode, local, event): - pcode = control.TrackControl(local) - if pcode: - self.do_controlhit(window, control, pcode, event) - -class ScrolledWindow(ControlsWindow): - def __init__(self, parent): - self.barx = self.bary = None - self.barx_enabled = self.bary_enabled = 1 - self.activated = 1 - ControlsWindow.__init__(self, parent) - - def scrollbars(self, wantx=1, wanty=1): - SetPort(self.wid) - self.barx = self.bary = None - self.barx_enabled = self.bary_enabled = 1 - x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds() - vx, vy = self.getscrollbarvalues() - if vx == None: self.barx_enabled, vx = 0, 0 - if vy == None: self.bary_enabled, vy = 0, 0 - if wantx: - rect = x0-1, y1-(SCROLLBARWIDTH-1), x1-(SCROLLBARWIDTH-2), y1+1 - self.barx = NewControl(self.wid, rect, "", 1, vx, 0, 32767, 16, 0) - if not self.barx_enabled: self.barx.HiliteControl(255) -## self.wid.InvalWindowRect(rect) - if wanty: - rect = x1-(SCROLLBARWIDTH-1), y0-1, x1+1, y1-(SCROLLBARWIDTH-2) - self.bary = NewControl(self.wid, rect, "", 1, vy, 0, 32767, 16, 0) - if not self.bary_enabled: self.bary.HiliteControl(255) -## self.wid.InvalWindowRect(rect) - - def do_postclose(self): - self.barx = self.bary = None - ControlsWindow.do_postclose(self) - - def do_activate(self, onoff, event): - self.activated = onoff - if onoff: - if self.barx and self.barx_enabled: - self.barx.ShowControl() # jvr - if self.bary and self.bary_enabled: - self.bary.ShowControl() # jvr - else: - if self.barx: - self.barx.HideControl() # jvr; An inactive window should have *hidden* - # scrollbars, not just dimmed (no matter what - # BBEdit does... look at the Finder) - if self.bary: - self.bary.HideControl() # jvr - self.wid.DrawGrowIcon() # jvr - - def do_postresize(self, width, height, window): - l, t, r, b = self.wid.GetWindowPort().GetPortBounds() - self.SetPort() - if self.barx: - self.barx.HideControl() # jvr - self.barx.MoveControl(l-1, b-(SCROLLBARWIDTH-1)) - self.barx.SizeControl((r-l)-(SCROLLBARWIDTH-3), SCROLLBARWIDTH) # jvr - if self.bary: - self.bary.HideControl() # jvr - self.bary.MoveControl(r-(SCROLLBARWIDTH-1), t-1) - self.bary.SizeControl(SCROLLBARWIDTH, (b-t)-(SCROLLBARWIDTH-3)) # jvr - if self.barx: - self.barx.ShowControl() # jvr - self.wid.ValidWindowRect((l, b - SCROLLBARWIDTH + 1, r - SCROLLBARWIDTH + 2, b)) # jvr - if self.bary: - self.bary.ShowControl() # jvr - self.wid.ValidWindowRect((r - SCROLLBARWIDTH + 1, t, r, b - SCROLLBARWIDTH + 2)) # jvr - self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr, growicon - - - def do_rawcontrolhit(self, window, control, pcode, local, event): - if control == self.barx: - which = 'x' - elif control == self.bary: - which = 'y' - else: - return 0 - if pcode in (inUpButton, inDownButton, inPageUp, inPageDown): - # We do the work for the buttons and grey area in the tracker - dummy = control.TrackControl(local, self.do_controltrack) - else: - # but the thumb is handled here - pcode = control.TrackControl(local) - if pcode == inThumb: - value = control.GetControlValue() - print 'setbars', which, value #DBG - self.scrollbar_callback(which, 'set', value) - self.updatescrollbars() - else: - print 'funny part', pcode #DBG - return 1 - - def do_controltrack(self, control, pcode): - if control == self.barx: - which = 'x' - elif control == self.bary: - which = 'y' - else: - return - - if pcode == inUpButton: - what = '-' - elif pcode == inDownButton: - what = '+' - elif pcode == inPageUp: - what = '--' - elif pcode == inPageDown: - what = '++' - else: - return - self.scrollbar_callback(which, what, None) - self.updatescrollbars() - - def updatescrollbars(self): - SetPort(self.wid) - vx, vy = self.getscrollbarvalues() - if self.barx: - if vx == None: - self.barx.HiliteControl(255) - self.barx_enabled = 0 - else: - if not self.barx_enabled: - self.barx_enabled = 1 - if self.activated: - self.barx.HiliteControl(0) - self.barx.SetControlValue(vx) - if self.bary: - if vy == None: - self.bary.HiliteControl(255) - self.bary_enabled = 0 - else: - if not self.bary_enabled: - self.bary_enabled = 1 - if self.activated: - self.bary.HiliteControl(0) - self.bary.SetControlValue(vy) - - # Auxiliary function: convert standard text/image/etc coordinate - # to something palatable as getscrollbarvalues() return - def scalebarvalue(self, absmin, absmax, curmin, curmax): - if curmin <= absmin and curmax >= absmax: - return None - if curmin <= absmin: - return 0 - if curmax >= absmax: - return 32767 - perc = float(curmin-absmin)/float(absmax-absmin) - return int(perc*32767) - - # To be overridden: - - def getscrollbarvalues(self): - return 0, 0 - - def scrollbar_callback(self, which, what, value): - print 'scroll', which, what, value - -class DialogWindow(Window): - """A modeless dialog window""" - - def open(self, resid): - self.dlg = GetNewDialog(resid, -1) - self.wid = self.dlg.GetDialogWindow() - self.do_postopen() - - def close(self): - self.do_postclose() - - def do_postclose(self): - self.dlg = None - Window.do_postclose(self) - - def do_itemhit(self, item, event): - print 'Dialog %s, item %d hit'%(self.dlg, item) - - def do_rawupdate(self, window, event): - pass - -def ostypecode(x): - "Convert a long int to the 4-character code it really is" - s = '' - for i in range(4): - x, c = divmod(x, 256) - s = chr(c) + s - return s - - -class TestApp(Application): - - "This class is used by the test() function" - - def makeusermenus(self): - self.filemenu = m = Menu(self.menubar, "File") - self.saveitem = MenuItem(m, "Save", "S", self.save) - Separator(m) - self.optionsmenu = mm = SubMenu(m, "Options") - self.opt1 = CheckItem(mm, "Arguments", "A") - self.opt2 = CheckItem(mm, "Being hit on the head lessons", (kMenuOptionModifier, "A")) - self.opt3 = CheckItem(mm, "Complaints", (kMenuOptionModifier|kMenuNoCommandModifier, "A")) - Separator(m) - self.itemeh = MenuItem(m, "Enable Help", None, self.enablehelp) - self.itemdbg = MenuItem(m, "Debug", None, self.debug) - Separator(m) - self.quititem = MenuItem(m, "Quit", "Q", self.quit) - - def save(self, *args): - print "Save" - - def quit(self, *args): - raise self - - def enablehelp(self, *args): - hm = self.gethelpmenu() - self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp) - - def nohelp(self, *args): - print "I told you there isn't any!" - - def debug(self, *args): - import pdb - pdb.set_trace() - - -def test(): - "Test program" - app = TestApp() - app.mainloop() - - -if __name__ == '__main__': - test() diff --git a/sys/lib/python/plat-mac/MiniAEFrame.py b/sys/lib/python/plat-mac/MiniAEFrame.py deleted file mode 100644 index 98247cbf3..000000000 --- a/sys/lib/python/plat-mac/MiniAEFrame.py +++ /dev/null @@ -1,198 +0,0 @@ -"""MiniAEFrame - A minimal AppleEvent Application framework. - -There are two classes: - AEServer -- a mixin class offering nice AE handling. - MiniApplication -- a very minimal alternative to FrameWork.py, - only suitable for the simplest of AppleEvent servers. -""" - -import sys -import traceback -import MacOS -from Carbon import AE -from Carbon.AppleEvents import * -from Carbon import Evt -from Carbon.Events import * -from Carbon import Menu -from Carbon import Win -from Carbon.Windows import * -from Carbon import Qd - -import aetools -import EasyDialogs - -kHighLevelEvent = 23 # Not defined anywhere for Python yet? - - -class MiniApplication: - - """A minimal FrameWork.Application-like class""" - - def __init__(self): - self.quitting = 0 - # Initialize menu - self.appleid = 1 - self.quitid = 2 - Menu.ClearMenuBar() - self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") - applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) - if MacOS.runtimemodel == 'ppc': - applemenu.AppendResMenu('DRVR') - applemenu.InsertMenu(0) - self.quitmenu = Menu.NewMenu(self.quitid, "File") - self.quitmenu.AppendMenu("Quit") - self.quitmenu.SetItemCmd(1, ord("Q")) - self.quitmenu.InsertMenu(0) - Menu.DrawMenuBar() - - def __del__(self): - self.close() - - def close(self): - pass - - def mainloop(self, mask = everyEvent, timeout = 60*60): - while not self.quitting: - self.dooneevent(mask, timeout) - - def _quit(self): - self.quitting = 1 - - def dooneevent(self, mask = everyEvent, timeout = 60*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self.lowlevelhandler(event) - - def lowlevelhandler(self, event): - what, message, when, where, modifiers = event - h, v = where - if what == kHighLevelEvent: - msg = "High Level Event: %r %r" % (code(message), code(h | (v<<16))) - try: - AE.AEProcessAppleEvent(event) - except AE.Error, err: - print 'AE error: ', err - print 'in', msg - traceback.print_exc() - return - elif what == keyDown: - c = chr(message & charCodeMask) - if modifiers & cmdKey: - if c == '.': - raise KeyboardInterrupt, "Command-period" - if c == 'q': - if hasattr(MacOS, 'OutputSeen'): - MacOS.OutputSeen() - self.quitting = 1 - return - elif what == mouseDown: - partcode, window = Win.FindWindow(where) - if partcode == inMenuBar: - result = Menu.MenuSelect(where) - id = (result>>16) & 0xffff # Hi word - item = result & 0xffff # Lo word - if id == self.appleid: - if item == 1: - EasyDialogs.Message(self.getabouttext()) - elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): - name = self.applemenu.GetMenuItemText(item) - Menu.OpenDeskAcc(name) - elif id == self.quitid and item == 1: - if hasattr(MacOS, 'OutputSeen'): - MacOS.OutputSeen() - self.quitting = 1 - Menu.HiliteMenu(0) - return - # Anything not handled is passed to Python/SIOUX - if hasattr(MacOS, 'HandleEvent'): - MacOS.HandleEvent(event) - else: - print "Unhandled event:", event - - def getabouttext(self): - return self.__class__.__name__ - - def getaboutmenutext(self): - return "About %s\311" % self.__class__.__name__ - - -class AEServer: - - def __init__(self): - self.ae_handlers = {} - - def installaehandler(self, classe, type, callback): - AE.AEInstallEventHandler(classe, type, self.callback_wrapper) - self.ae_handlers[(classe, type)] = callback - - def close(self): - for classe, type in self.ae_handlers.keys(): - AE.AERemoveEventHandler(classe, type) - - def callback_wrapper(self, _request, _reply): - _parameters, _attributes = aetools.unpackevent(_request) - _class = _attributes['evcl'].type - _type = _attributes['evid'].type - - if self.ae_handlers.has_key((_class, _type)): - _function = self.ae_handlers[(_class, _type)] - elif self.ae_handlers.has_key((_class, '****')): - _function = self.ae_handlers[(_class, '****')] - elif self.ae_handlers.has_key(('****', '****')): - _function = self.ae_handlers[('****', '****')] - else: - raise 'Cannot happen: AE callback without handler', (_class, _type) - - # XXXX Do key-to-name mapping here - - _parameters['_attributes'] = _attributes - _parameters['_class'] = _class - _parameters['_type'] = _type - if _parameters.has_key('----'): - _object = _parameters['----'] - del _parameters['----'] - # The try/except that used to be here can mask programmer errors. - # Let the program crash, the programmer can always add a **args - # to the formal parameter list. - rv = _function(_object, **_parameters) - else: - #Same try/except comment as above - rv = _function(**_parameters) - - if rv == None: - aetools.packevent(_reply, {}) - else: - aetools.packevent(_reply, {'----':rv}) - - -def code(x): - "Convert a long int to the 4-character code it really is" - s = '' - for i in range(4): - x, c = divmod(x, 256) - s = chr(c) + s - return s - -class _Test(AEServer, MiniApplication): - """Mini test application, handles required events""" - - def __init__(self): - MiniApplication.__init__(self) - AEServer.__init__(self) - self.installaehandler('aevt', 'oapp', self.open_app) - self.installaehandler('aevt', 'quit', self.quit) - self.installaehandler('****', '****', self.other) - self.mainloop() - - def quit(self, **args): - self._quit() - - def open_app(self, **args): - pass - - def other(self, _object=None, _class=None, _type=None, **args): - print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args - - -if __name__ == '__main__': - _Test() diff --git a/sys/lib/python/plat-mac/PixMapWrapper.py b/sys/lib/python/plat-mac/PixMapWrapper.py deleted file mode 100644 index 7edbac26c..000000000 --- a/sys/lib/python/plat-mac/PixMapWrapper.py +++ /dev/null @@ -1,214 +0,0 @@ -"""PixMapWrapper - defines the PixMapWrapper class, which wraps an opaque -QuickDraw PixMap data structure in a handy Python class. Also provides -methods to convert to/from pixel data (from, e.g., the img module) or a -Python Imaging Library Image object. - -J. Strout <joe@strout.net> February 1999""" - -from Carbon import Qd -from Carbon import QuickDraw -import struct -import MacOS -import img -import imgformat - -# PixMap data structure element format (as used with struct) -_pmElemFormat = { - 'baseAddr':'l', # address of pixel data - 'rowBytes':'H', # bytes per row, plus 0x8000 - 'bounds':'hhhh', # coordinates imposed over pixel data - 'top':'h', - 'left':'h', - 'bottom':'h', - 'right':'h', - 'pmVersion':'h', # flags for Color QuickDraw - 'packType':'h', # format of compression algorithm - 'packSize':'l', # size after compression - 'hRes':'l', # horizontal pixels per inch - 'vRes':'l', # vertical pixels per inch - 'pixelType':'h', # pixel format - 'pixelSize':'h', # bits per pixel - 'cmpCount':'h', # color components per pixel - 'cmpSize':'h', # bits per component - 'planeBytes':'l', # offset in bytes to next plane - 'pmTable':'l', # handle to color table - 'pmReserved':'l' # reserved for future use -} - -# PixMap data structure element offset -_pmElemOffset = { - 'baseAddr':0, - 'rowBytes':4, - 'bounds':6, - 'top':6, - 'left':8, - 'bottom':10, - 'right':12, - 'pmVersion':14, - 'packType':16, - 'packSize':18, - 'hRes':22, - 'vRes':26, - 'pixelType':30, - 'pixelSize':32, - 'cmpCount':34, - 'cmpSize':36, - 'planeBytes':38, - 'pmTable':42, - 'pmReserved':46 -} - -class PixMapWrapper: - """PixMapWrapper -- wraps the QD PixMap object in a Python class, - with methods to easily get/set various pixmap fields. Note: Use the - PixMap() method when passing to QD calls.""" - - def __init__(self): - self.__dict__['data'] = '' - self._header = struct.pack("lhhhhhhhlllhhhhlll", - id(self.data)+MacOS.string_id_to_buffer, - 0, # rowBytes - 0, 0, 0, 0, # bounds - 0, # pmVersion - 0, 0, # packType, packSize - 72<<16, 72<<16, # hRes, vRes - QuickDraw.RGBDirect, # pixelType - 16, # pixelSize - 2, 5, # cmpCount, cmpSize, - 0, 0, 0) # planeBytes, pmTable, pmReserved - self.__dict__['_pm'] = Qd.RawBitMap(self._header) - - def _stuff(self, element, bytes): - offset = _pmElemOffset[element] - fmt = _pmElemFormat[element] - self._header = self._header[:offset] \ - + struct.pack(fmt, bytes) \ - + self._header[offset + struct.calcsize(fmt):] - self.__dict__['_pm'] = None - - def _unstuff(self, element): - offset = _pmElemOffset[element] - fmt = _pmElemFormat[element] - return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0] - - def __setattr__(self, attr, val): - if attr == 'baseAddr': - raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" - elif attr == 'data': - self.__dict__['data'] = val - self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer) - elif attr == 'rowBytes': - # high bit is always set for some odd reason - self._stuff('rowBytes', val | 0x8000) - elif attr == 'bounds': - # assume val is in official Left, Top, Right, Bottom order! - self._stuff('left',val[0]) - self._stuff('top',val[1]) - self._stuff('right',val[2]) - self._stuff('bottom',val[3]) - elif attr == 'hRes' or attr == 'vRes': - # 16.16 fixed format, so just shift 16 bits - self._stuff(attr, int(val) << 16) - elif attr in _pmElemFormat.keys(): - # any other pm attribute -- just stuff - self._stuff(attr, val) - else: - self.__dict__[attr] = val - - def __getattr__(self, attr): - if attr == 'rowBytes': - # high bit is always set for some odd reason - return self._unstuff('rowBytes') & 0x7FFF - elif attr == 'bounds': - # return bounds in official Left, Top, Right, Bottom order! - return ( \ - self._unstuff('left'), - self._unstuff('top'), - self._unstuff('right'), - self._unstuff('bottom') ) - elif attr == 'hRes' or attr == 'vRes': - # 16.16 fixed format, so just shift 16 bits - return self._unstuff(attr) >> 16 - elif attr in _pmElemFormat.keys(): - # any other pm attribute -- just unstuff - return self._unstuff(attr) - else: - return self.__dict__[attr] - - - def PixMap(self): - "Return a QuickDraw PixMap corresponding to this data." - if not self.__dict__['_pm']: - self.__dict__['_pm'] = Qd.RawBitMap(self._header) - return self.__dict__['_pm'] - - def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): - """Draw this pixmap into the given (default current) grafport.""" - src = self.bounds - dest = [x1,y1,x2,y2] - if x2 == None: - dest[2] = x1 + src[2]-src[0] - if y2 == None: - dest[3] = y1 + src[3]-src[1] - if not port: port = Qd.GetPort() - Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), - QuickDraw.srcCopy, None) - - def fromstring(self,s,width,height,format=imgformat.macrgb): - """Stuff this pixmap with raw pixel data from a string. - Supply width, height, and one of the imgformat specifiers.""" - # we only support 16- and 32-bit mac rgb... - # so convert if necessary - if format != imgformat.macrgb and format != imgformat.macrgb16: - # (LATER!) - raise "NotImplementedError", "conversion to macrgb or macrgb16" - self.data = s - self.bounds = (0,0,width,height) - self.cmpCount = 3 - self.pixelType = QuickDraw.RGBDirect - if format == imgformat.macrgb: - self.pixelSize = 32 - self.cmpSize = 8 - else: - self.pixelSize = 16 - self.cmpSize = 5 - self.rowBytes = width*self.pixelSize/8 - - def tostring(self, format=imgformat.macrgb): - """Return raw data as a string in the specified format.""" - # is the native format requested? if so, just return data - if (format == imgformat.macrgb and self.pixelSize == 32) or \ - (format == imgformat.macrgb16 and self.pixelsize == 16): - return self.data - # otherwise, convert to the requested format - # (LATER!) - raise "NotImplementedError", "data format conversion" - - def fromImage(self,im): - """Initialize this PixMap from a PIL Image object.""" - # We need data in ARGB format; PIL can't currently do that, - # but it can do RGBA, which we can use by inserting one null - # up frontpm = - if im.mode != 'RGBA': im = im.convert('RGBA') - data = chr(0) + im.tostring() - self.fromstring(data, im.size[0], im.size[1]) - - def toImage(self): - """Return the contents of this PixMap as a PIL Image object.""" - import Image - # our tostring() method returns data in ARGB format, - # whereas Image uses RGBA; a bit of slicing fixes this... - data = self.tostring()[1:] + chr(0) - bounds = self.bounds - return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data) - -def test(): - import MacOS - import EasyDialogs - import Image - path = EasyDialogs.AskFileForOpen("Image File:") - if not path: return - pm = PixMapWrapper() - pm.fromImage( Image.open(path) ) - pm.blit(20,20) - return pm diff --git a/sys/lib/python/plat-mac/aepack.py b/sys/lib/python/plat-mac/aepack.py deleted file mode 100644 index 529a0a4ed..000000000 --- a/sys/lib/python/plat-mac/aepack.py +++ /dev/null @@ -1,366 +0,0 @@ -"""Tools for use in AppleEvent clients and servers: -conversion between AE types and python types - -pack(x) converts a Python object to an AEDesc object -unpack(desc) does the reverse -coerce(x, wanted_sample) coerces a python object to another python object -""" - -# -# This code was originally written by Guido, and modified/extended by Jack -# to include the various types that were missing. The reference used is -# Apple Event Registry, chapter 9. -# - -import struct -import string -import types -from string import strip -from types import * -from Carbon import AE -from Carbon.AppleEvents import * -import MacOS -import Carbon.File -import StringIO -import aetypes -from aetypes import mkenum, ObjectSpecifier -import os - -# These ones seem to be missing from AppleEvents -# (they're in AERegistry.h) - -#typeColorTable = 'clrt' -#typeDrawingArea = 'cdrw' -#typePixelMap = 'cpix' -#typePixelMapMinus = 'tpmm' -#typeRotation = 'trot' -#typeTextStyles = 'tsty' -#typeStyledText = 'STXT' -#typeAEText = 'tTXT' -#typeEnumeration = 'enum' - -# -# Some AE types are immedeately coerced into something -# we like better (and which is equivalent) -# -unpacker_coercions = { - typeComp : typeFloat, - typeColorTable : typeAEList, - typeDrawingArea : typeAERecord, - typeFixed : typeFloat, - typeExtended : typeFloat, - typePixelMap : typeAERecord, - typeRotation : typeAERecord, - typeStyledText : typeAERecord, - typeTextStyles : typeAERecord, -}; - -# -# Some python types we need in the packer: -# -AEDescType = AE.AEDescType -FSSType = Carbon.File.FSSpecType -FSRefType = Carbon.File.FSRefType -AliasType = Carbon.File.AliasType - -def packkey(ae, key, value): - if hasattr(key, 'which'): - keystr = key.which - elif hasattr(key, 'want'): - keystr = key.want - else: - keystr = key - ae.AEPutParamDesc(keystr, pack(value)) - -def pack(x, forcetype = None): - """Pack a python object into an AE descriptor""" - - if forcetype: - if type(x) is StringType: - return AE.AECreateDesc(forcetype, x) - else: - return pack(x).AECoerceDesc(forcetype) - - if x == None: - return AE.AECreateDesc('null', '') - - if isinstance(x, AEDescType): - return x - if isinstance(x, FSSType): - return AE.AECreateDesc('fss ', x.data) - if isinstance(x, FSRefType): - return AE.AECreateDesc('fsrf', x.data) - if isinstance(x, AliasType): - return AE.AECreateDesc('alis', x.data) - if isinstance(x, IntType): - return AE.AECreateDesc('long', struct.pack('l', x)) - if isinstance(x, FloatType): - return AE.AECreateDesc('doub', struct.pack('d', x)) - if isinstance(x, StringType): - return AE.AECreateDesc('TEXT', x) - if isinstance(x, UnicodeType): - data = x.encode('utf16') - if data[:2] == '\xfe\xff': - data = data[2:] - return AE.AECreateDesc('utxt', data) - if isinstance(x, ListType): - list = AE.AECreateList('', 0) - for item in x: - list.AEPutDesc(0, pack(item)) - return list - if isinstance(x, DictionaryType): - record = AE.AECreateList('', 1) - for key, value in x.items(): - packkey(record, key, value) - #record.AEPutParamDesc(key, pack(value)) - return record - if type(x) == types.ClassType and issubclass(x, ObjectSpecifier): - # Note: we are getting a class object here, not an instance - return AE.AECreateDesc('type', x.want) - if hasattr(x, '__aepack__'): - return x.__aepack__() - if hasattr(x, 'which'): - return AE.AECreateDesc('TEXT', x.which) - if hasattr(x, 'want'): - return AE.AECreateDesc('TEXT', x.want) - return AE.AECreateDesc('TEXT', repr(x)) # Copout - -def unpack(desc, formodulename=""): - """Unpack an AE descriptor to a python object""" - t = desc.type - - if unpacker_coercions.has_key(t): - desc = desc.AECoerceDesc(unpacker_coercions[t]) - t = desc.type # This is a guess by Jack.... - - if t == typeAEList: - l = [] - for i in range(desc.AECountItems()): - keyword, item = desc.AEGetNthDesc(i+1, '****') - l.append(unpack(item, formodulename)) - return l - if t == typeAERecord: - d = {} - for i in range(desc.AECountItems()): - keyword, item = desc.AEGetNthDesc(i+1, '****') - d[keyword] = unpack(item, formodulename) - return d - if t == typeAEText: - record = desc.AECoerceDesc('reco') - return mkaetext(unpack(record, formodulename)) - if t == typeAlias: - return Carbon.File.Alias(rawdata=desc.data) - # typeAppleEvent returned as unknown - if t == typeBoolean: - return struct.unpack('b', desc.data)[0] - if t == typeChar: - return desc.data - if t == typeUnicodeText: - return unicode(desc.data, 'utf16') - # typeColorTable coerced to typeAEList - # typeComp coerced to extended - # typeData returned as unknown - # typeDrawingArea coerced to typeAERecord - if t == typeEnumeration: - return mkenum(desc.data) - # typeEPS returned as unknown - if t == typeFalse: - return 0 - if t == typeFloat: - data = desc.data - return struct.unpack('d', data)[0] - if t == typeFSS: - return Carbon.File.FSSpec(rawdata=desc.data) - if t == typeFSRef: - return Carbon.File.FSRef(rawdata=desc.data) - if t == typeInsertionLoc: - record = desc.AECoerceDesc('reco') - return mkinsertionloc(unpack(record, formodulename)) - # typeInteger equal to typeLongInteger - if t == typeIntlText: - script, language = struct.unpack('hh', desc.data[:4]) - return aetypes.IntlText(script, language, desc.data[4:]) - if t == typeIntlWritingCode: - script, language = struct.unpack('hh', desc.data) - return aetypes.IntlWritingCode(script, language) - if t == typeKeyword: - return mkkeyword(desc.data) - if t == typeLongInteger: - return struct.unpack('l', desc.data)[0] - if t == typeLongDateTime: - a, b = struct.unpack('lL', desc.data) - return (long(a) << 32) + b - if t == typeNull: - return None - if t == typeMagnitude: - v = struct.unpack('l', desc.data) - if v < 0: - v = 0x100000000L + v - return v - if t == typeObjectSpecifier: - record = desc.AECoerceDesc('reco') - # If we have been told the name of the module we are unpacking aedescs for, - # we can attempt to create the right type of python object from that module. - if formodulename: - return mkobjectfrommodule(unpack(record, formodulename), formodulename) - return mkobject(unpack(record, formodulename)) - # typePict returned as unknown - # typePixelMap coerced to typeAERecord - # typePixelMapMinus returned as unknown - # typeProcessSerialNumber returned as unknown - if t == typeQDPoint: - v, h = struct.unpack('hh', desc.data) - return aetypes.QDPoint(v, h) - if t == typeQDRectangle: - v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) - return aetypes.QDRectangle(v0, h0, v1, h1) - if t == typeRGBColor: - r, g, b = struct.unpack('hhh', desc.data) - return aetypes.RGBColor(r, g, b) - # typeRotation coerced to typeAERecord - # typeScrapStyles returned as unknown - # typeSessionID returned as unknown - if t == typeShortFloat: - return struct.unpack('f', desc.data)[0] - if t == typeShortInteger: - return struct.unpack('h', desc.data)[0] - # typeSMFloat identical to typeShortFloat - # typeSMInt indetical to typeShortInt - # typeStyledText coerced to typeAERecord - if t == typeTargetID: - return mktargetid(desc.data) - # typeTextStyles coerced to typeAERecord - # typeTIFF returned as unknown - if t == typeTrue: - return 1 - if t == typeType: - return mktype(desc.data, formodulename) - # - # The following are special - # - if t == 'rang': - record = desc.AECoerceDesc('reco') - return mkrange(unpack(record, formodulename)) - if t == 'cmpd': - record = desc.AECoerceDesc('reco') - return mkcomparison(unpack(record, formodulename)) - if t == 'logi': - record = desc.AECoerceDesc('reco') - return mklogical(unpack(record, formodulename)) - return mkunknown(desc.type, desc.data) - -def coerce(data, egdata): - """Coerce a python object to another type using the AE coercers""" - pdata = pack(data) - pegdata = pack(egdata) - pdata = pdata.AECoerceDesc(pegdata.type) - return unpack(pdata) - -# -# Helper routines for unpack -# -def mktargetid(data): - sessionID = getlong(data[:4]) - name = mkppcportrec(data[4:4+72]) - location = mklocationnamerec(data[76:76+36]) - rcvrName = mkppcportrec(data[112:112+72]) - return sessionID, name, location, rcvrName - -def mkppcportrec(rec): - namescript = getword(rec[:2]) - name = getpstr(rec[2:2+33]) - portkind = getword(rec[36:38]) - if portkind == 1: - ctor = rec[38:42] - type = rec[42:46] - identity = (ctor, type) - else: - identity = getpstr(rec[38:38+33]) - return namescript, name, portkind, identity - -def mklocationnamerec(rec): - kind = getword(rec[:2]) - stuff = rec[2:] - if kind == 0: stuff = None - if kind == 2: stuff = getpstr(stuff) - return kind, stuff - -def mkunknown(type, data): - return aetypes.Unknown(type, data) - -def getpstr(s): - return s[1:1+ord(s[0])] - -def getlong(s): - return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) - -def getword(s): - return (ord(s[0])<<8) | (ord(s[1])<<0) - -def mkkeyword(keyword): - return aetypes.Keyword(keyword) - -def mkrange(dict): - return aetypes.Range(dict['star'], dict['stop']) - -def mkcomparison(dict): - return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) - -def mklogical(dict): - return aetypes.Logical(dict['logc'], dict['term']) - -def mkstyledtext(dict): - return aetypes.StyledText(dict['ksty'], dict['ktxt']) - -def mkaetext(dict): - return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) - -def mkinsertionloc(dict): - return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) - -def mkobject(dict): - want = dict['want'].type - form = dict['form'].enum - seld = dict['seld'] - fr = dict['from'] - if form in ('name', 'indx', 'rang', 'test'): - if want == 'text': return aetypes.Text(seld, fr) - if want == 'cha ': return aetypes.Character(seld, fr) - if want == 'cwor': return aetypes.Word(seld, fr) - if want == 'clin': return aetypes.Line(seld, fr) - if want == 'cpar': return aetypes.Paragraph(seld, fr) - if want == 'cwin': return aetypes.Window(seld, fr) - if want == 'docu': return aetypes.Document(seld, fr) - if want == 'file': return aetypes.File(seld, fr) - if want == 'cins': return aetypes.InsertionPoint(seld, fr) - if want == 'prop' and form == 'prop' and aetypes.IsType(seld): - return aetypes.Property(seld.type, fr) - return aetypes.ObjectSpecifier(want, form, seld, fr) - -# Note by Jack: I'm not 100% sure of the following code. This was -# provided by Donovan Preston, but I wonder whether the assignment -# to __class__ is safe. Moreover, shouldn't there be a better -# initializer for the classes in the suites? -def mkobjectfrommodule(dict, modulename): - if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): - # The type has already been converted to Python. Convert back:-( - classtype = dict['want'] - dict['want'] = aetypes.mktype(classtype.want) - want = dict['want'].type - module = __import__(modulename) - codenamemapper = module._classdeclarations - classtype = codenamemapper.get(want, None) - newobj = mkobject(dict) - if classtype: - assert issubclass(classtype, ObjectSpecifier) - newobj.__class__ = classtype - return newobj - -def mktype(typecode, modulename=None): - if modulename: - module = __import__(modulename) - codenamemapper = module._classdeclarations - classtype = codenamemapper.get(typecode, None) - if classtype: - return classtype - return aetypes.mktype(typecode) diff --git a/sys/lib/python/plat-mac/aetools.py b/sys/lib/python/plat-mac/aetools.py deleted file mode 100644 index 79f397831..000000000 --- a/sys/lib/python/plat-mac/aetools.py +++ /dev/null @@ -1,360 +0,0 @@ -"""Tools for use in AppleEvent clients and servers. - -pack(x) converts a Python object to an AEDesc object -unpack(desc) does the reverse - -packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record -unpackevent(event) returns the parameters and attributes from an AEAppleEvent record - -Plus... Lots of classes and routines that help representing AE objects, -ranges, conditionals, logicals, etc., so you can write, e.g.: - - x = Character(1, Document("foobar")) - -and pack(x) will create an AE object reference equivalent to AppleScript's - - character 1 of document "foobar" - -Some of the stuff that appears to be exported from this module comes from other -files: the pack stuff from aepack, the objects from aetypes. - -""" - - -from types import * -from Carbon import AE -from Carbon import Evt -from Carbon import AppleEvents -import MacOS -import sys -import time - -from aetypes import * -from aepack import packkey, pack, unpack, coerce, AEDescType - -Error = 'aetools.Error' - -# Amount of time to wait for program to be launched -LAUNCH_MAX_WAIT_TIME=10 - -# Special code to unpack an AppleEvent (which is *not* a disguised record!) -# Note by Jack: No??!? If I read the docs correctly it *is*.... - -aekeywords = [ - 'tran', - 'rtid', - 'evcl', - 'evid', - 'addr', - 'optk', - 'timo', - 'inte', # this attribute is read only - will be set in AESend - 'esrc', # this attribute is read only - 'miss', # this attribute is read only - 'from' # new in 1.0.1 -] - -def missed(ae): - try: - desc = ae.AEGetAttributeDesc('miss', 'keyw') - except AE.Error, msg: - return None - return desc.data - -def unpackevent(ae, formodulename=""): - parameters = {} - try: - dirobj = ae.AEGetParamDesc('----', '****') - except AE.Error: - pass - else: - parameters['----'] = unpack(dirobj, formodulename) - del dirobj - # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed... - try: - dirobj = ae.AEGetParamDesc('errn', '****') - except AE.Error: - pass - else: - parameters['errn'] = unpack(dirobj, formodulename) - del dirobj - while 1: - key = missed(ae) - if not key: break - parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) - attributes = {} - for key in aekeywords: - try: - desc = ae.AEGetAttributeDesc(key, '****') - except (AE.Error, MacOS.Error), msg: - if msg[0] != -1701 and msg[0] != -1704: - raise - continue - attributes[key] = unpack(desc, formodulename) - return parameters, attributes - -def packevent(ae, parameters = {}, attributes = {}): - for key, value in parameters.items(): - packkey(ae, key, value) - for key, value in attributes.items(): - ae.AEPutAttributeDesc(key, pack(value)) - -# -# Support routine for automatically generated Suite interfaces -# These routines are also useable for the reverse function. -# -def keysubst(arguments, keydict): - """Replace long name keys by their 4-char counterparts, and check""" - ok = keydict.values() - for k in arguments.keys(): - if keydict.has_key(k): - v = arguments[k] - del arguments[k] - arguments[keydict[k]] = v - elif k != '----' and k not in ok: - raise TypeError, 'Unknown keyword argument: %s'%k - -def enumsubst(arguments, key, edict): - """Substitute a single enum keyword argument, if it occurs""" - if not arguments.has_key(key) or edict is None: - return - v = arguments[key] - ok = edict.values() - if edict.has_key(v): - arguments[key] = Enum(edict[v]) - elif not v in ok: - raise TypeError, 'Unknown enumerator: %s'%v - -def decodeerror(arguments): - """Create the 'best' argument for a raise MacOS.Error""" - errn = arguments['errn'] - err_a1 = errn - if arguments.has_key('errs'): - err_a2 = arguments['errs'] - else: - err_a2 = MacOS.GetErrorString(errn) - if arguments.has_key('erob'): - err_a3 = arguments['erob'] - else: - err_a3 = None - - return (err_a1, err_a2, err_a3) - -class TalkTo: - """An AE connection to an application""" - _signature = None # Can be overridden by subclasses - _moduleName = None # Can be overridden by subclasses - _elemdict = {} # Can be overridden by subclasses - _propdict = {} # Can be overridden by subclasses - - __eventloop_initialized = 0 - def __ensure_WMAvailable(klass): - if klass.__eventloop_initialized: return 1 - if not MacOS.WMAvailable(): return 0 - # Workaround for a but in MacOSX 10.2: we must have an event - # loop before we can call AESend. - Evt.WaitNextEvent(0,0) - return 1 - __ensure_WMAvailable = classmethod(__ensure_WMAvailable) - - def __init__(self, signature=None, start=0, timeout=0): - """Create a communication channel with a particular application. - - Addressing the application is done by specifying either a - 4-byte signature, an AEDesc or an object that will __aepack__ - to an AEDesc. - """ - self.target_signature = None - if signature is None: - signature = self._signature - if type(signature) == AEDescType: - self.target = signature - elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): - self.target = signature.__aepack__() - elif type(signature) == StringType and len(signature) == 4: - self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) - self.target_signature = signature - else: - raise TypeError, "signature should be 4-char string or AEDesc" - self.send_flags = AppleEvents.kAEWaitReply - self.send_priority = AppleEvents.kAENormalPriority - if timeout: - self.send_timeout = timeout - else: - self.send_timeout = AppleEvents.kAEDefaultTimeout - if start: - self._start() - - def _start(self): - """Start the application, if it is not running yet""" - try: - self.send('ascr', 'noop') - except AE.Error: - _launch(self.target_signature) - for i in range(LAUNCH_MAX_WAIT_TIME): - try: - self.send('ascr', 'noop') - except AE.Error: - pass - else: - break - time.sleep(1) - - def start(self): - """Deprecated, used _start()""" - self._start() - - def newevent(self, code, subcode, parameters = {}, attributes = {}): - """Create a complete structure for an apple event""" - - event = AE.AECreateAppleEvent(code, subcode, self.target, - AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) - packevent(event, parameters, attributes) - return event - - def sendevent(self, event): - """Send a pre-created appleevent, await the reply and unpack it""" - if not self.__ensure_WMAvailable(): - raise RuntimeError, "No window manager access, cannot send AppleEvent" - reply = event.AESend(self.send_flags, self.send_priority, - self.send_timeout) - parameters, attributes = unpackevent(reply, self._moduleName) - return reply, parameters, attributes - - def send(self, code, subcode, parameters = {}, attributes = {}): - """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" - return self.sendevent(self.newevent(code, subcode, parameters, attributes)) - - # - # The following events are somehow "standard" and don't seem to appear in any - # suite... - # - def activate(self): - """Send 'activate' command""" - self.send('misc', 'actv') - - def _get(self, _object, as=None, _attributes={}): - """_get: get data from an object - Required argument: the object - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the data - """ - _code = 'core' - _subcode = 'getd' - - _arguments = {'----':_object} - if as: - _arguments['rtyp'] = mktype(as) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.has_key('errn'): - raise Error, decodeerror(_arguments) - - if _arguments.has_key('----'): - return _arguments['----'] - if as: - item.__class__ = as - return item - - get = _get - - _argmap_set = { - 'to' : 'data', - } - - def _set(self, _object, _attributes={}, **_arguments): - """set: Set an object's data. - Required argument: the object for the command - Keyword argument to: The new value. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'setd' - - keysubst(_arguments, self._argmap_set) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise Error, decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - set = _set - - # Magic glue to allow suite-generated classes to function somewhat - # like the "application" class in OSA. - - def __getattr__(self, name): - if self._elemdict.has_key(name): - cls = self._elemdict[name] - return DelayedComponentItem(cls, None) - if self._propdict.has_key(name): - cls = self._propdict[name] - return cls() - raise AttributeError, name - -# Tiny Finder class, for local use only - -class _miniFinder(TalkTo): - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.has_key('errn'): - raise Error, decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] -#pass - -_finder = _miniFinder('MACS') - -def _launch(appfile): - """Open a file thru the finder. Specify file by name or fsspec""" - _finder.open(_application_file(('ID ', appfile))) - - -class _application_file(ComponentItem): - """application file - An application's file on disk""" - want = 'appf' - -_application_file._propdict = { -} -_application_file._elemdict = { -} - -# Test program -# XXXX Should test more, really... - -def test(): - target = AE.AECreateDesc('sign', 'quil') - ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) - print unpackevent(ae) - raw_input(":") - ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) - obj = Character(2, Word(1, Document(1))) - print obj - print repr(obj) - packevent(ae, {'----': obj}) - params, attrs = unpackevent(ae) - print params['----'] - raw_input(":") - -if __name__ == '__main__': - test() - sys.exit(1) diff --git a/sys/lib/python/plat-mac/aetypes.py b/sys/lib/python/plat-mac/aetypes.py deleted file mode 100644 index 65b59ad0c..000000000 --- a/sys/lib/python/plat-mac/aetypes.py +++ /dev/null @@ -1,568 +0,0 @@ -"""aetypes - Python objects representing various AE types.""" - -from Carbon.AppleEvents import * -import struct -from types import * -import string - -# -# convoluted, since there are cyclic dependencies between this file and -# aetools_convert. -# -def pack(*args, **kwargs): - from aepack import pack - return pack( *args, **kwargs) - -def nice(s): - """'nice' representation of an object""" - if type(s) is StringType: return repr(s) - else: return str(s) - -class Unknown: - """An uninterpreted AE object""" - - def __init__(self, type, data): - self.type = type - self.data = data - - def __repr__(self): - return "Unknown(%r, %r)" % (self.type, self.data) - - def __aepack__(self): - return pack(self.data, self.type) - -class Enum: - """An AE enumeration value""" - - def __init__(self, enum): - self.enum = "%-4.4s" % str(enum) - - def __repr__(self): - return "Enum(%r)" % (self.enum,) - - def __str__(self): - return string.strip(self.enum) - - def __aepack__(self): - return pack(self.enum, typeEnumeration) - -def IsEnum(x): - return isinstance(x, Enum) - -def mkenum(enum): - if IsEnum(enum): return enum - return Enum(enum) - -# Jack changed the way this is done -class InsertionLoc: - def __init__(self, of, pos): - self.of = of - self.pos = pos - - def __repr__(self): - return "InsertionLoc(%r, %r)" % (self.of, self.pos) - - def __aepack__(self): - rec = {'kobj': self.of, 'kpos': self.pos} - return pack(rec, forcetype='insl') - -# Convenience functions for dsp: -def beginning(of): - return InsertionLoc(of, Enum('bgng')) - -def end(of): - return InsertionLoc(of, Enum('end ')) - -class Boolean: - """An AE boolean value""" - - def __init__(self, bool): - self.bool = (not not bool) - - def __repr__(self): - return "Boolean(%r)" % (self.bool,) - - def __str__(self): - if self.bool: - return "True" - else: - return "False" - - def __aepack__(self): - return pack(struct.pack('b', self.bool), 'bool') - -def IsBoolean(x): - return isinstance(x, Boolean) - -def mkboolean(bool): - if IsBoolean(bool): return bool - return Boolean(bool) - -class Type: - """An AE 4-char typename object""" - - def __init__(self, type): - self.type = "%-4.4s" % str(type) - - def __repr__(self): - return "Type(%r)" % (self.type,) - - def __str__(self): - return string.strip(self.type) - - def __aepack__(self): - return pack(self.type, typeType) - -def IsType(x): - return isinstance(x, Type) - -def mktype(type): - if IsType(type): return type - return Type(type) - - -class Keyword: - """An AE 4-char keyword object""" - - def __init__(self, keyword): - self.keyword = "%-4.4s" % str(keyword) - - def __repr__(self): - return "Keyword(%r)" % `self.keyword` - - def __str__(self): - return string.strip(self.keyword) - - def __aepack__(self): - return pack(self.keyword, typeKeyword) - -def IsKeyword(x): - return isinstance(x, Keyword) - -class Range: - """An AE range object""" - - def __init__(self, start, stop): - self.start = start - self.stop = stop - - def __repr__(self): - return "Range(%r, %r)" % (self.start, self.stop) - - def __str__(self): - return "%s thru %s" % (nice(self.start), nice(self.stop)) - - def __aepack__(self): - return pack({'star': self.start, 'stop': self.stop}, 'rang') - -def IsRange(x): - return isinstance(x, Range) - -class Comparison: - """An AE Comparison""" - - def __init__(self, obj1, relo, obj2): - self.obj1 = obj1 - self.relo = "%-4.4s" % str(relo) - self.obj2 = obj2 - - def __repr__(self): - return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2) - - def __str__(self): - return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) - - def __aepack__(self): - return pack({'obj1': self.obj1, - 'relo': mkenum(self.relo), - 'obj2': self.obj2}, - 'cmpd') - -def IsComparison(x): - return isinstance(x, Comparison) - -class NComparison(Comparison): - # The class attribute 'relo' must be set in a subclass - - def __init__(self, obj1, obj2): - Comparison.__init__(obj1, self.relo, obj2) - -class Ordinal: - """An AE Ordinal""" - - def __init__(self, abso): -# self.obj1 = obj1 - self.abso = "%-4.4s" % str(abso) - - def __repr__(self): - return "Ordinal(%r)" % (self.abso,) - - def __str__(self): - return "%s" % (string.strip(self.abso)) - - def __aepack__(self): - return pack(self.abso, 'abso') - -def IsOrdinal(x): - return isinstance(x, Ordinal) - -class NOrdinal(Ordinal): - # The class attribute 'abso' must be set in a subclass - - def __init__(self): - Ordinal.__init__(self, self.abso) - -class Logical: - """An AE logical expression object""" - - def __init__(self, logc, term): - self.logc = "%-4.4s" % str(logc) - self.term = term - - def __repr__(self): - return "Logical(%r, %r)" % (self.logc, self.term) - - def __str__(self): - if type(self.term) == ListType and len(self.term) == 2: - return "%s %s %s" % (nice(self.term[0]), - string.strip(self.logc), - nice(self.term[1])) - else: - return "%s(%s)" % (string.strip(self.logc), nice(self.term)) - - def __aepack__(self): - return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi') - -def IsLogical(x): - return isinstance(x, Logical) - -class StyledText: - """An AE object respresenting text in a certain style""" - - def __init__(self, style, text): - self.style = style - self.text = text - - def __repr__(self): - return "StyledText(%r, %r)" % (self.style, self.text) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack({'ksty': self.style, 'ktxt': self.text}, 'STXT') - -def IsStyledText(x): - return isinstance(x, StyledText) - -class AEText: - """An AE text object with style, script and language specified""" - - def __init__(self, script, style, text): - self.script = script - self.style = style - self.text = text - - def __repr__(self): - return "AEText(%r, %r, %r)" % (self.script, self.style, self.text) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack({keyAEScriptTag: self.script, keyAEStyles: self.style, - keyAEText: self.text}, typeAEText) - -def IsAEText(x): - return isinstance(x, AEText) - -class IntlText: - """A text object with script and language specified""" - - def __init__(self, script, language, text): - self.script = script - self.language = language - self.text = text - - def __repr__(self): - return "IntlText(%r, %r, %r)" % (self.script, self.language, self.text) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack(struct.pack('hh', self.script, self.language)+self.text, - typeIntlText) - -def IsIntlText(x): - return isinstance(x, IntlText) - -class IntlWritingCode: - """An object representing script and language""" - - def __init__(self, script, language): - self.script = script - self.language = language - - def __repr__(self): - return "IntlWritingCode(%r, %r)" % (self.script, self.language) - - def __str__(self): - return "script system %d, language %d"%(self.script, self.language) - - def __aepack__(self): - return pack(struct.pack('hh', self.script, self.language), - typeIntlWritingCode) - -def IsIntlWritingCode(x): - return isinstance(x, IntlWritingCode) - -class QDPoint: - """A point""" - - def __init__(self, v, h): - self.v = v - self.h = h - - def __repr__(self): - return "QDPoint(%r, %r)" % (self.v, self.h) - - def __str__(self): - return "(%d, %d)"%(self.v, self.h) - - def __aepack__(self): - return pack(struct.pack('hh', self.v, self.h), - typeQDPoint) - -def IsQDPoint(x): - return isinstance(x, QDPoint) - -class QDRectangle: - """A rectangle""" - - def __init__(self, v0, h0, v1, h1): - self.v0 = v0 - self.h0 = h0 - self.v1 = v1 - self.h1 = h1 - - def __repr__(self): - return "QDRectangle(%r, %r, %r, %r)" % (self.v0, self.h0, self.v1, self.h1) - - def __str__(self): - return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1) - - def __aepack__(self): - return pack(struct.pack('hhhh', self.v0, self.h0, self.v1, self.h1), - typeQDRectangle) - -def IsQDRectangle(x): - return isinstance(x, QDRectangle) - -class RGBColor: - """An RGB color""" - - def __init__(self, r, g, b): - self.r = r - self.g = g - self.b = b - - def __repr__(self): - return "RGBColor(%r, %r, %r)" % (self.r, self.g, self.b) - - def __str__(self): - return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b) - - def __aepack__(self): - return pack(struct.pack('hhh', self.r, self.g, self.b), - typeRGBColor) - -def IsRGBColor(x): - return isinstance(x, RGBColor) - -class ObjectSpecifier: - - """A class for constructing and manipulation AE object specifiers in python. - - An object specifier is actually a record with four fields: - - key type description - --- ---- ----------- - - 'want' type 4-char class code of thing we want, - e.g. word, paragraph or property - - 'form' enum how we specify which 'want' thing(s) we want, - e.g. by index, by range, by name, or by property specifier - - 'seld' any which thing(s) we want, - e.g. its index, its name, or its property specifier - - 'from' object the object in which it is contained, - or null, meaning look for it in the application - - Note that we don't call this class plain "Object", since that name - is likely to be used by the application. - """ - - def __init__(self, want, form, seld, fr = None): - self.want = want - self.form = form - self.seld = seld - self.fr = fr - - def __repr__(self): - s = "ObjectSpecifier(%r, %r, %r" % (self.want, self.form, self.seld) - if self.fr: - s = s + ", %r)" % (self.fr,) - else: - s = s + ")" - return s - - def __aepack__(self): - return pack({'want': mktype(self.want), - 'form': mkenum(self.form), - 'seld': self.seld, - 'from': self.fr}, - 'obj ') - -def IsObjectSpecifier(x): - return isinstance(x, ObjectSpecifier) - - -# Backwards compatibility, sigh... -class Property(ObjectSpecifier): - - def __init__(self, which, fr = None, want='prop'): - ObjectSpecifier.__init__(self, want, 'prop', mktype(which), fr) - - def __repr__(self): - if self.fr: - return "Property(%r, %r)" % (self.seld.type, self.fr) - else: - return "Property(%r)" % (self.seld.type,) - - def __str__(self): - if self.fr: - return "Property %s of %s" % (str(self.seld), str(self.fr)) - else: - return "Property %s" % str(self.seld) - - -class NProperty(ObjectSpecifier): - # Subclasses *must* self baseclass attributes: - # want is the type of this property - # which is the property name of this property - - def __init__(self, fr = None): - #try: - # dummy = self.want - #except: - # self.want = 'prop' - self.want = 'prop' - ObjectSpecifier.__init__(self, self.want, 'prop', - mktype(self.which), fr) - - def __repr__(self): - rv = "Property(%r" % (self.seld.type,) - if self.fr: - rv = rv + ", fr=%r" % (self.fr,) - if self.want != 'prop': - rv = rv + ", want=%r" % (self.want,) - return rv + ")" - - def __str__(self): - if self.fr: - return "Property %s of %s" % (str(self.seld), str(self.fr)) - else: - return "Property %s" % str(self.seld) - - -class SelectableItem(ObjectSpecifier): - - def __init__(self, want, seld, fr = None): - t = type(seld) - if t == StringType: - form = 'name' - elif IsRange(seld): - form = 'rang' - elif IsComparison(seld) or IsLogical(seld): - form = 'test' - elif t == TupleType: - # Breakout: specify both form and seld in a tuple - # (if you want ID or rele or somesuch) - form, seld = seld - else: - form = 'indx' - ObjectSpecifier.__init__(self, want, form, seld, fr) - - -class ComponentItem(SelectableItem): - # Derived classes *must* set the *class attribute* 'want' to some constant - # Also, dictionaries _propdict and _elemdict must be set to map property - # and element names to the correct classes - - _propdict = {} - _elemdict = {} - def __init__(self, which, fr = None): - SelectableItem.__init__(self, self.want, which, fr) - - def __repr__(self): - if not self.fr: - return "%s(%r)" % (self.__class__.__name__, self.seld) - return "%s(%r, %r)" % (self.__class__.__name__, self.seld, self.fr) - - def __str__(self): - seld = self.seld - if type(seld) == StringType: - ss = repr(seld) - elif IsRange(seld): - start, stop = seld.start, seld.stop - if type(start) == InstanceType == type(stop) and \ - start.__class__ == self.__class__ == stop.__class__: - ss = str(start.seld) + " thru " + str(stop.seld) - else: - ss = str(seld) - else: - ss = str(seld) - s = "%s %s" % (self.__class__.__name__, ss) - if self.fr: s = s + " of %s" % str(self.fr) - return s - - def __getattr__(self, name): - if self._elemdict.has_key(name): - cls = self._elemdict[name] - return DelayedComponentItem(cls, self) - if self._propdict.has_key(name): - cls = self._propdict[name] - return cls(self) - raise AttributeError, name - - -class DelayedComponentItem: - def __init__(self, compclass, fr): - self.compclass = compclass - self.fr = fr - - def __call__(self, which): - return self.compclass(which, self.fr) - - def __repr__(self): - return "%s(???, %r)" % (self.__class__.__name__, self.fr) - - def __str__(self): - return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) - -template = """ -class %s(ComponentItem): want = '%s' -""" - -exec template % ("Text", 'text') -exec template % ("Character", 'cha ') -exec template % ("Word", 'cwor') -exec template % ("Line", 'clin') -exec template % ("paragraph", 'cpar') -exec template % ("Window", 'cwin') -exec template % ("Document", 'docu') -exec template % ("File", 'file') -exec template % ("InsertionPoint", 'cins') diff --git a/sys/lib/python/plat-mac/applesingle.py b/sys/lib/python/plat-mac/applesingle.py deleted file mode 100644 index 76bdb0691..000000000 --- a/sys/lib/python/plat-mac/applesingle.py +++ /dev/null @@ -1,137 +0,0 @@ -r"""Routines to decode AppleSingle files -""" -import struct -import sys -try: - import MacOS - import Carbon.File -except: - class MacOS: - def openrf(path, mode): - return open(path + '.rsrc', mode) - openrf = classmethod(openrf) - class Carbon: - class File: - class FSSpec: - pass - class FSRef: - pass - class Alias: - pass - -# all of the errors in this module are really errors in the input -# so I think it should test positive against ValueError. -class Error(ValueError): - pass - -# File header format: magic, version, unused, number of entries -AS_HEADER_FORMAT=">LL16sh" -AS_HEADER_LENGTH=26 -# The flag words for AppleSingle -AS_MAGIC=0x00051600 -AS_VERSION=0x00020000 - -# Entry header format: id, offset, length -AS_ENTRY_FORMAT=">lll" -AS_ENTRY_LENGTH=12 - -# The id values -AS_DATAFORK=1 -AS_RESOURCEFORK=2 -AS_IGNORE=(3,4,5,6,8,9,10,11,12,13,14,15) - -class AppleSingle(object): - datafork = None - resourcefork = None - - def __init__(self, fileobj, verbose=False): - header = fileobj.read(AS_HEADER_LENGTH) - try: - magic, version, ig, nentry = struct.unpack(AS_HEADER_FORMAT, header) - except ValueError, arg: - raise Error, "Unpack header error: %s" % (arg,) - if verbose: - print 'Magic: 0x%8.8x' % (magic,) - print 'Version: 0x%8.8x' % (version,) - print 'Entries: %d' % (nentry,) - if magic != AS_MAGIC: - raise Error, "Unknown AppleSingle magic number 0x%8.8x" % (magic,) - if version != AS_VERSION: - raise Error, "Unknown AppleSingle version number 0x%8.8x" % (version,) - if nentry <= 0: - raise Error, "AppleSingle file contains no forks" - headers = [fileobj.read(AS_ENTRY_LENGTH) for i in xrange(nentry)] - self.forks = [] - for hdr in headers: - try: - restype, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr) - except ValueError, arg: - raise Error, "Unpack entry error: %s" % (arg,) - if verbose: - print "Fork %d, offset %d, length %d" % (restype, offset, length) - fileobj.seek(offset) - data = fileobj.read(length) - if len(data) != length: - raise Error, "Short read: expected %d bytes got %d" % (length, len(data)) - self.forks.append((restype, data)) - if restype == AS_DATAFORK: - self.datafork = data - elif restype == AS_RESOURCEFORK: - self.resourcefork = data - - def tofile(self, path, resonly=False): - outfile = open(path, 'wb') - data = False - if resonly: - if self.resourcefork is None: - raise Error, "No resource fork found" - fp = open(path, 'wb') - fp.write(self.resourcefork) - fp.close() - elif (self.resourcefork is None and self.datafork is None): - raise Error, "No useful forks found" - else: - if self.datafork is not None: - fp = open(path, 'wb') - fp.write(self.datafork) - fp.close() - if self.resourcefork is not None: - fp = MacOS.openrf(path, '*wb') - fp.write(self.resourcefork) - fp.close() - -def decode(infile, outpath, resonly=False, verbose=False): - """decode(infile, outpath [, resonly=False, verbose=False]) - - Creates a decoded file from an AppleSingle encoded file. - If resonly is True, then it will create a regular file at - outpath containing only the resource fork from infile. - Otherwise it will create an AppleDouble file at outpath - with the data and resource forks from infile. On platforms - without the MacOS module, it will create inpath and inpath+'.rsrc' - with the data and resource forks respectively. - - """ - if not hasattr(infile, 'read'): - if isinstance(infile, Carbon.File.Alias): - infile = infile.ResolveAlias()[0] - if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)): - infile = infile.as_pathname() - infile = open(infile, 'rb') - - asfile = AppleSingle(infile, verbose=verbose) - asfile.tofile(outpath, resonly=resonly) - -def _test(): - if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: - print 'Usage: applesingle.py [-r] applesinglefile decodedfile' - sys.exit(1) - if sys.argv[1] == '-r': - resonly = True - del sys.argv[1] - else: - resonly = False - decode(sys.argv[1], sys.argv[2], resonly=resonly) - -if __name__ == '__main__': - _test() diff --git a/sys/lib/python/plat-mac/appletrawmain.py b/sys/lib/python/plat-mac/appletrawmain.py deleted file mode 100644 index 1be918790..000000000 --- a/sys/lib/python/plat-mac/appletrawmain.py +++ /dev/null @@ -1,63 +0,0 @@ -# Emulate sys.argv and run __main__.py or __main__.pyc in an environment that -# is as close to "normal" as possible. -# -# This script is put into __rawmain__.pyc for applets that need argv -# emulation, by BuildApplet and friends. -# -import argvemulator -import os -import sys -import marshal - -# -# Make sure we have an argv[0], and make _dir point to the Resources -# directory. -# -if not sys.argv or sys.argv[0][:1] == '-': - # Insert our (guessed) name. - _dir = os.path.split(sys.executable)[0] # removes "python" - _dir = os.path.split(_dir)[0] # Removes "MacOS" - _dir = os.path.join(_dir, 'Resources') - sys.argv.insert(0, '__rawmain__') -else: - _dir = os.path.split(sys.argv[0])[0] -# -# Add the Resources directory to the path. This is where files installed -# by BuildApplet.py with the --extra option show up, and if those files are -# modules this sys.path modification is necessary to be able to import them. -# -sys.path.insert(0, _dir) -# -# Create sys.argv -# -argvemulator.ArgvCollector().mainloop() -# -# Find the real main program to run -# -__file__ = os.path.join(_dir, '__main__.py') -if os.path.exists(__file__): - # - # Setup something resembling a normal environment and go. - # - sys.argv[0] = __file__ - del argvemulator, os, sys, _dir - execfile(__file__) -else: - __file__ = os.path.join(_dir, '__main__.pyc') - if os.path.exists(__file__): - # - # If we have only a .pyc file we read the code object from that - # - sys.argv[0] = __file__ - _fp = open(__file__, 'rb') - _fp.read(8) - __code__ = marshal.load(_fp) - # - # Again, we create an almost-normal environment (only __code__ is - # funny) and go. - # - del argvemulator, os, sys, marshal, _dir, _fp - exec __code__ - else: - sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) - sys.exit(1) diff --git a/sys/lib/python/plat-mac/appletrunner.py b/sys/lib/python/plat-mac/appletrunner.py deleted file mode 100755 index 8d46c2ad2..000000000 --- a/sys/lib/python/plat-mac/appletrunner.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -# This file is meant as an executable script for running applets. -# BuildApplet will use it as the main executable in the .app bundle if -# we are not running in a framework build. - -import os -import sys -for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: - realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), - "Resources", name) - if os.path.exists(realmain): - break -else: - sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) - sys.exit(1) -sys.argv.insert(1, realmain) -os.execve(sys.executable, sys.argv, os.environ) diff --git a/sys/lib/python/plat-mac/argvemulator.py b/sys/lib/python/plat-mac/argvemulator.py deleted file mode 100644 index 2d66f1c74..000000000 --- a/sys/lib/python/plat-mac/argvemulator.py +++ /dev/null @@ -1,89 +0,0 @@ -"""argvemulator - create sys.argv from OSA events. Used by applets that -want unix-style arguments. -""" - -import sys -import traceback -from Carbon import AE -from Carbon.AppleEvents import * -from Carbon import Evt -from Carbon import File -from Carbon.Events import * -import aetools - -class ArgvCollector: - - """A minimal FrameWork.Application-like class""" - - def __init__(self): - self.quitting = 0 - # Remove the funny -psn_xxx_xxx argument - if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': - del sys.argv[1] - - AE.AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, self.__runapp) - AE.AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, self.__openfiles) - - def close(self): - AE.AERemoveEventHandler(kCoreEventClass, kAEOpenApplication) - AE.AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments) - - def mainloop(self, mask = highLevelEventMask, timeout = 1*60): - # Note: this is not the right way to run an event loop in OSX or even - # "recent" versions of MacOS9. This is however code that has proven - # itself. - stoptime = Evt.TickCount() + timeout - while not self.quitting and Evt.TickCount() < stoptime: - self._dooneevent(mask, timeout) - - if not self.quitting: - print "argvemulator: timeout waiting for arguments" - - self.close() - - def _dooneevent(self, mask = highLevelEventMask, timeout = 1*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self._lowlevelhandler(event) - - def _lowlevelhandler(self, event): - what, message, when, where, modifiers = event - h, v = where - if what == kHighLevelEvent: - try: - AE.AEProcessAppleEvent(event) - except AE.Error, err: - msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16))) - print 'AE error: ', err - print 'in', msg - traceback.print_exc() - return - else: - print "Unhandled event:", event - - - def _quit(self): - self.quitting = 1 - - def __runapp(self, requestevent, replyevent): - self._quit() - - def __openfiles(self, requestevent, replyevent): - try: - listdesc = requestevent.AEGetParamDesc(keyDirectObject, typeAEList) - for i in range(listdesc.AECountItems()): - aliasdesc = listdesc.AEGetNthDesc(i+1, typeAlias)[1] - alias = File.Alias(rawdata=aliasdesc.data) - fsref = alias.FSResolveAlias(None)[0] - pathname = fsref.as_pathname() - sys.argv.append(pathname) - except Exception, e: - print "argvemulator.py warning: can't unpack an open document event" - import traceback - traceback.print_exc() - - self._quit() - -if __name__ == '__main__': - ArgvCollector().mainloop() - print "sys.argv=", sys.argv diff --git a/sys/lib/python/plat-mac/bgenlocations.py b/sys/lib/python/plat-mac/bgenlocations.py deleted file mode 100644 index e7fa35407..000000000 --- a/sys/lib/python/plat-mac/bgenlocations.py +++ /dev/null @@ -1,55 +0,0 @@ -# -# Local customizations for generating the Carbon interface modules. -# Edit this file to reflect where things should be on your system. -# Note that pathnames are unix-style for OSX MachoPython/unix-Python, -# but mac-style for MacPython, whether running on OS9 or OSX. -# - -import sys, os - -Error = "bgenlocations.Error" -# -# Where bgen is. For unix-Python bgen isn't installed, so you have to refer to -# the source tree here. -BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" - -# -# Where to find the Universal Header include files. If you have CodeWarrior -# installed you can use the Universal Headers from there, otherwise you can -# download them from the Apple website. Bgen can handle both unix- and mac-style -# end of lines, so don't worry about that. -# -INCLUDEDIR="/Users/jack/src/Universal/Interfaces/CIncludes" - -# -# Where to put the python definitions files. Note that, on unix-Python, -# if you want to commit your changes to the CVS repository this should refer to -# your source directory, not your installed directory. -# -TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" - -# Creator for C files: -CREATOR="CWIE" - -# The previous definitions can be overriden by creating a module -# bgenlocationscustomize.py and putting it in site-packages (or anywere else -# on sys.path, actually) -try: - from bgenlocationscustomize import * -except ImportError: - pass - -if not os.path.exists(BGENDIR): - raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR -if not os.path.exists(INCLUDEDIR): - raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR -if not os.path.exists(TOOLBOXDIR): - raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR - -# Sigh, due to the way these are used make sure they end with : or /. -if BGENDIR[-1] != os.sep: - BGENDIR = BGENDIR + os.sep -if INCLUDEDIR[-1] != os.sep: - INCLUDEDIR = INCLUDEDIR + os.sep -if TOOLBOXDIR[-1] != os.sep: - TOOLBOXDIR = TOOLBOXDIR + os.sep diff --git a/sys/lib/python/plat-mac/buildtools.py b/sys/lib/python/plat-mac/buildtools.py deleted file mode 100644 index c83e21802..000000000 --- a/sys/lib/python/plat-mac/buildtools.py +++ /dev/null @@ -1,420 +0,0 @@ -"""tools for BuildApplet and BuildApplication""" - -import sys -import os -import string -import imp -import marshal -from Carbon import Res -import Carbon.Files -import Carbon.File -import MacOS -import macostools -import macresource -import EasyDialogs -import shutil - - -BuildError = "BuildError" - -# .pyc file (and 'PYC ' resource magic number) -MAGIC = imp.get_magic() - -# Template file (searched on sys.path) -TEMPLATE = "PythonInterpreter" - -# Specification of our resource -RESTYPE = 'PYC ' -RESNAME = '__main__' - -# A resource with this name sets the "owner" (creator) of the destination -# It should also have ID=0. Either of these alone is not enough. -OWNERNAME = "owner resource" - -# Default applet creator code -DEFAULT_APPLET_CREATOR="Pyta" - -# OpenResFile mode parameters -READ = 1 -WRITE = 2 - -# Parameter for FSOpenResourceFile -RESOURCE_FORK_NAME=Carbon.File.FSGetResourceForkName() - -def findtemplate(template=None): - """Locate the applet template along sys.path""" - if MacOS.runtimemodel == 'macho': - return None - if not template: - template=TEMPLATE - for p in sys.path: - file = os.path.join(p, template) - try: - file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1) - break - except (Carbon.File.Error, ValueError): - continue - else: - raise BuildError, "Template %r not found on sys.path" % (template,) - file = file.as_pathname() - return file - -def process(template, filename, destname, copy_codefragment=0, - rsrcname=None, others=[], raw=0, progress="default", destroot=""): - - if progress == "default": - progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) - progress.label("Compiling...") - progress.inc(0) - # check for the script name being longer than 32 chars. This may trigger a bug - # on OSX that can destroy your sourcefile. - if '#' in os.path.split(filename)[1]: - raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename - # Read the source and compile it - # (there's no point overwriting the destination if it has a syntax error) - - fp = open(filename, 'rU') - text = fp.read() - fp.close() - try: - code = compile(text + '\n', filename, "exec") - except SyntaxError, arg: - raise BuildError, "Syntax error in script %s: %s" % (filename, arg) - except EOFError: - raise BuildError, "End-of-file in script %s" % (filename,) - - # Set the destination file name. Note that basename - # does contain the whole filepath, only a .py is stripped. - - if string.lower(filename[-3:]) == ".py": - basename = filename[:-3] - if MacOS.runtimemodel != 'macho' and not destname: - destname = basename - else: - basename = filename - - if not destname: - if MacOS.runtimemodel == 'macho': - destname = basename + '.app' - else: - destname = basename + '.applet' - if not rsrcname: - rsrcname = basename + '.rsrc' - - # Try removing the output file. This fails in MachO, but it should - # do any harm. - try: - os.remove(destname) - except os.error: - pass - process_common(template, progress, code, rsrcname, destname, 0, - copy_codefragment, raw, others, filename, destroot) - - -def update(template, filename, output): - if MacOS.runtimemodel == 'macho': - raise BuildError, "No updating yet for MachO applets" - if progress: - progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120) - else: - progress = None - if not output: - output = filename + ' (updated)' - - # Try removing the output file - try: - os.remove(output) - except os.error: - pass - process_common(template, progress, None, filename, output, 1, 1) - - -def process_common(template, progress, code, rsrcname, destname, is_update, - copy_codefragment, raw=0, others=[], filename=None, destroot=""): - if MacOS.runtimemodel == 'macho': - return process_common_macho(template, progress, code, rsrcname, destname, - is_update, raw, others, filename, destroot) - if others: - raise BuildError, "Extra files only allowed for MachoPython applets" - # Create FSSpecs for the various files - template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) - template = template_fsr.as_pathname() - - # Copy data (not resources, yet) from the template - if progress: - progress.label("Copy data fork...") - progress.set(10) - - if copy_codefragment: - tmpl = open(template, "rb") - dest = open(destname, "wb") - data = tmpl.read() - if data: - dest.write(data) - dest.close() - tmpl.close() - del dest - del tmpl - - # Open the output resource fork - - if progress: - progress.label("Copy resources...") - progress.set(20) - try: - output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) - except MacOS.Error: - destdir, destfile = os.path.split(destname) - Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) - output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) - - # Copy the resources from the target specific resource template, if any - typesfound, ownertype = [], None - try: - input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) - except (MacOS.Error, ValueError): - pass - if progress: - progress.inc(50) - else: - if is_update: - skip_oldfile = ['cfrg'] - else: - skip_oldfile = [] - typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) - Res.CloseResFile(input) - - # Check which resource-types we should not copy from the template - skiptypes = [] - if 'vers' in typesfound: skiptypes.append('vers') - if 'SIZE' in typesfound: skiptypes.append('SIZE') - if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', - 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] - if not copy_codefragment: - skiptypes.append('cfrg') -## skipowner = (ownertype <> None) - - # Copy the resources from the template - - input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) - dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) - - Res.CloseResFile(input) -## if ownertype == None: -## raise BuildError, "No owner resource found in either resource file or template" - # Make sure we're manipulating the output resource file now - - Res.UseResFile(output) - - if ownertype == None: - # No owner resource in the template. We have skipped the - # Python owner resource, so we have to add our own. The relevant - # bundle stuff is already included in the interpret/applet template. - newres = Res.Resource('\0') - newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") - ownertype = DEFAULT_APPLET_CREATOR - - if code: - # Delete any existing 'PYC ' resource named __main__ - - try: - res = Res.Get1NamedResource(RESTYPE, RESNAME) - res.RemoveResource() - except Res.Error: - pass - - # Create the raw data for the resource from the code object - if progress: - progress.label("Write PYC resource...") - progress.set(120) - - data = marshal.dumps(code) - del code - data = (MAGIC + '\0\0\0\0') + data - - # Create the resource and write it - - id = 0 - while id < 128: - id = Res.Unique1ID(RESTYPE) - res = Res.Resource(data) - res.AddResource(RESTYPE, id, RESNAME) - attrs = res.GetResAttrs() - attrs = attrs | 0x04 # set preload - res.SetResAttrs(attrs) - res.WriteResource() - res.ReleaseResource() - - # Close the output file - - Res.CloseResFile(output) - - # Now set the creator, type and bundle bit of the destination. - # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) - dest_fss = Carbon.File.FSSpec(destname) - dest_finfo = dest_fss.FSpGetFInfo() - dest_finfo.Creator = ownertype - dest_finfo.Type = 'APPL' - dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared - dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited - dest_fss.FSpSetFInfo(dest_finfo) - - macostools.touched(destname) - if progress: - progress.label("Done.") - progress.inc(0) - -def process_common_macho(template, progress, code, rsrcname, destname, is_update, - raw=0, others=[], filename=None, destroot=""): - # Check that we have a filename - if filename is None: - raise BuildError, "Need source filename on MacOSX" - # First make sure the name ends in ".app" - if destname[-4:] != '.app': - destname = destname + '.app' - # Now deduce the short name - destdir, shortname = os.path.split(destname) - if shortname[-4:] == '.app': - # Strip the .app suffix - shortname = shortname[:-4] - # And deduce the .plist and .icns names - plistname = None - icnsname = None - if rsrcname and rsrcname[-5:] == '.rsrc': - tmp = rsrcname[:-5] - plistname = tmp + '.plist' - if os.path.exists(plistname): - icnsname = tmp + '.icns' - if not os.path.exists(icnsname): - icnsname = None - else: - plistname = None - if not icnsname: - dft_icnsname = os.path.join(sys.prefix, 'Resources/Python.app/Contents/Resources/PythonApplet.icns') - if os.path.exists(dft_icnsname): - icnsname = dft_icnsname - if not os.path.exists(rsrcname): - rsrcname = None - if progress: - progress.label('Creating bundle...') - import bundlebuilder - builder = bundlebuilder.AppBuilder(verbosity=0) - builder.mainprogram = filename - builder.builddir = destdir - builder.name = shortname - builder.destroot = destroot - if rsrcname: - realrsrcname = macresource.resource_pathname(rsrcname) - builder.files.append((realrsrcname, - os.path.join('Contents/Resources', os.path.basename(rsrcname)))) - for o in others: - if type(o) == str: - builder.resources.append(o) - else: - builder.files.append(o) - if plistname: - import plistlib - builder.plist = plistlib.Plist.fromFile(plistname) - if icnsname: - builder.iconfile = icnsname - if not raw: - builder.argv_emulation = 1 - builder.setup() - builder.build() - if progress: - progress.label('Done.') - progress.inc(0) - -## macostools.touched(dest_fss) - -# Copy resources between two resource file descriptors. -# skip a resource named '__main__' or (if skipowner is set) with ID zero. -# Also skip resources with a type listed in skiptypes. -# -def copyres(input, output, skiptypes, skipowner, progress=None): - ctor = None - alltypes = [] - Res.UseResFile(input) - ntypes = Res.Count1Types() - progress_type_inc = 50/ntypes - for itype in range(1, 1+ntypes): - type = Res.Get1IndType(itype) - if type in skiptypes: - continue - alltypes.append(type) - nresources = Res.Count1Resources(type) - progress_cur_inc = progress_type_inc/nresources - for ires in range(1, 1+nresources): - res = Res.Get1IndResource(type, ires) - id, type, name = res.GetResInfo() - lcname = string.lower(name) - - if lcname == OWNERNAME and id == 0: - if skipowner: - continue # Skip this one - else: - ctor = type - size = res.size - attrs = res.GetResAttrs() - if progress: - progress.label("Copy %s %d %s"%(type, id, name)) - progress.inc(progress_cur_inc) - res.LoadResource() - res.DetachResource() - Res.UseResFile(output) - try: - res2 = Res.Get1Resource(type, id) - except MacOS.Error: - res2 = None - if res2: - if progress: - progress.label("Overwrite %s %d %s"%(type, id, name)) - progress.inc(0) - res2.RemoveResource() - res.AddResource(type, id, name) - res.WriteResource() - attrs = attrs | res.GetResAttrs() - res.SetResAttrs(attrs) - Res.UseResFile(input) - return alltypes, ctor - -def copyapptree(srctree, dsttree, exceptlist=[], progress=None): - names = [] - if os.path.exists(dsttree): - shutil.rmtree(dsttree) - os.mkdir(dsttree) - todo = os.listdir(srctree) - while todo: - this, todo = todo[0], todo[1:] - if this in exceptlist: - continue - thispath = os.path.join(srctree, this) - if os.path.isdir(thispath): - thiscontent = os.listdir(thispath) - for t in thiscontent: - todo.append(os.path.join(this, t)) - names.append(this) - for this in names: - srcpath = os.path.join(srctree, this) - dstpath = os.path.join(dsttree, this) - if os.path.isdir(srcpath): - os.mkdir(dstpath) - elif os.path.islink(srcpath): - endpoint = os.readlink(srcpath) - os.symlink(endpoint, dstpath) - else: - if progress: - progress.label('Copy '+this) - progress.inc(0) - shutil.copy2(srcpath, dstpath) - -def writepycfile(codeobject, cfile): - import marshal - fc = open(cfile, 'wb') - fc.write('\0\0\0\0') # MAGIC placeholder, written later - fc.write('\0\0\0\0') # Timestap placeholder, not needed - marshal.dump(codeobject, fc) - fc.flush() - fc.seek(0, 0) - fc.write(MAGIC) - fc.close() diff --git a/sys/lib/python/plat-mac/bundlebuilder.py b/sys/lib/python/plat-mac/bundlebuilder.py deleted file mode 100755 index 266b8455a..000000000 --- a/sys/lib/python/plat-mac/bundlebuilder.py +++ /dev/null @@ -1,934 +0,0 @@ -#! /usr/bin/env python - -"""\ -bundlebuilder.py -- Tools to assemble MacOS X (application) bundles. - -This module contains two classes to build so called "bundles" for -MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass -specialized in building application bundles. - -[Bundle|App]Builder objects are instantiated with a bunch of keyword -arguments, and have a build() method that will do all the work. See -the class doc strings for a description of the constructor arguments. - -The module contains a main program that can be used in two ways: - - % python bundlebuilder.py [options] build - % python buildapp.py [options] build - -Where "buildapp.py" is a user-supplied setup.py-like script following -this model: - - from bundlebuilder import buildapp - buildapp(<lots-of-keyword-args>) - -""" - - -__all__ = ["BundleBuilder", "BundleBuilderError", "AppBuilder", "buildapp"] - - -import sys -import os, errno, shutil -import imp, marshal -import re -from copy import deepcopy -import getopt -from plistlib import Plist -from types import FunctionType as function - -class BundleBuilderError(Exception): pass - - -class Defaults: - - """Class attributes that don't start with an underscore and are - not functions or classmethods are (deep)copied to self.__dict__. - This allows for mutable default values. - """ - - def __init__(self, **kwargs): - defaults = self._getDefaults() - defaults.update(kwargs) - self.__dict__.update(defaults) - - def _getDefaults(cls): - defaults = {} - for base in cls.__bases__: - if hasattr(base, "_getDefaults"): - defaults.update(base._getDefaults()) - for name, value in cls.__dict__.items(): - if name[0] != "_" and not isinstance(value, - (function, classmethod)): - defaults[name] = deepcopy(value) - return defaults - _getDefaults = classmethod(_getDefaults) - - -class BundleBuilder(Defaults): - - """BundleBuilder is a barebones class for assembling bundles. It - knows nothing about executables or icons, it only copies files - and creates the PkgInfo and Info.plist files. - """ - - # (Note that Defaults.__init__ (deep)copies these values to - # instance variables. Mutable defaults are therefore safe.) - - # Name of the bundle, with or without extension. - name = None - - # The property list ("plist") - plist = Plist(CFBundleDevelopmentRegion = "English", - CFBundleInfoDictionaryVersion = "6.0") - - # The type of the bundle. - type = "BNDL" - # The creator code of the bundle. - creator = None - - # the CFBundleIdentifier (this is used for the preferences file name) - bundle_id = None - - # List of files that have to be copied to <bundle>/Contents/Resources. - resources = [] - - # List of (src, dest) tuples; dest should be a path relative to the bundle - # (eg. "Contents/Resources/MyStuff/SomeFile.ext). - files = [] - - # List of shared libraries (dylibs, Frameworks) to bundle with the app - # will be placed in Contents/Frameworks - libs = [] - - # Directory where the bundle will be assembled. - builddir = "build" - - # Make symlinks instead copying files. This is handy during debugging, but - # makes the bundle non-distributable. - symlink = 0 - - # Verbosity level. - verbosity = 1 - - # Destination root directory - destroot = "" - - def setup(self): - # XXX rethink self.name munging, this is brittle. - self.name, ext = os.path.splitext(self.name) - if not ext: - ext = ".bundle" - bundleextension = ext - # misc (derived) attributes - self.bundlepath = pathjoin(self.builddir, self.name + bundleextension) - - plist = self.plist - plist.CFBundleName = self.name - plist.CFBundlePackageType = self.type - if self.creator is None: - if hasattr(plist, "CFBundleSignature"): - self.creator = plist.CFBundleSignature - else: - self.creator = "????" - plist.CFBundleSignature = self.creator - if self.bundle_id: - plist.CFBundleIdentifier = self.bundle_id - elif not hasattr(plist, "CFBundleIdentifier"): - plist.CFBundleIdentifier = self.name - - def build(self): - """Build the bundle.""" - builddir = self.builddir - if builddir and not os.path.exists(builddir): - os.mkdir(builddir) - self.message("Building %s" % repr(self.bundlepath), 1) - if os.path.exists(self.bundlepath): - shutil.rmtree(self.bundlepath) - if os.path.exists(self.bundlepath + '~'): - shutil.rmtree(self.bundlepath + '~') - bp = self.bundlepath - - # Create the app bundle in a temporary location and then - # rename the completed bundle. This way the Finder will - # never see an incomplete bundle (where it might pick up - # and cache the wrong meta data) - self.bundlepath = bp + '~' - try: - os.mkdir(self.bundlepath) - self.preProcess() - self._copyFiles() - self._addMetaFiles() - self.postProcess() - os.rename(self.bundlepath, bp) - finally: - self.bundlepath = bp - self.message("Done.", 1) - - def preProcess(self): - """Hook for subclasses.""" - pass - def postProcess(self): - """Hook for subclasses.""" - pass - - def _addMetaFiles(self): - contents = pathjoin(self.bundlepath, "Contents") - makedirs(contents) - # - # Write Contents/PkgInfo - assert len(self.type) == len(self.creator) == 4, \ - "type and creator must be 4-byte strings." - pkginfo = pathjoin(contents, "PkgInfo") - f = open(pkginfo, "wb") - f.write(self.type + self.creator) - f.close() - # - # Write Contents/Info.plist - infoplist = pathjoin(contents, "Info.plist") - self.plist.write(infoplist) - - def _copyFiles(self): - files = self.files[:] - for path in self.resources: - files.append((path, pathjoin("Contents", "Resources", - os.path.basename(path)))) - for path in self.libs: - files.append((path, pathjoin("Contents", "Frameworks", - os.path.basename(path)))) - if self.symlink: - self.message("Making symbolic links", 1) - msg = "Making symlink from" - else: - self.message("Copying files", 1) - msg = "Copying" - files.sort() - for src, dst in files: - if os.path.isdir(src): - self.message("%s %s/ to %s/" % (msg, src, dst), 2) - else: - self.message("%s %s to %s" % (msg, src, dst), 2) - dst = pathjoin(self.bundlepath, dst) - if self.symlink: - symlink(src, dst, mkdirs=1) - else: - copy(src, dst, mkdirs=1) - - def message(self, msg, level=0): - if level <= self.verbosity: - indent = "" - if level > 1: - indent = (level - 1) * " " - sys.stderr.write(indent + msg + "\n") - - def report(self): - # XXX something decent - pass - - -if __debug__: - PYC_EXT = ".pyc" -else: - PYC_EXT = ".pyo" - -MAGIC = imp.get_magic() -USE_ZIPIMPORT = "zipimport" in sys.builtin_module_names - -# For standalone apps, we have our own minimal site.py. We don't need -# all the cruft of the real site.py. -SITE_PY = """\ -import sys -if not %(semi_standalone)s: - del sys.path[1:] # sys.path[0] is Contents/Resources/ -""" - -if USE_ZIPIMPORT: - ZIP_ARCHIVE = "Modules.zip" - SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE - def getPycData(fullname, code, ispkg): - if ispkg: - fullname += ".__init__" - path = fullname.replace(".", os.sep) + PYC_EXT - return path, MAGIC + '\0\0\0\0' + marshal.dumps(code) - -# -# Extension modules can't be in the modules zip archive, so a placeholder -# is added instead, that loads the extension from a specified location. -# -EXT_LOADER = """\ -def __load(): - import imp, sys, os - for p in sys.path: - path = os.path.join(p, "%(filename)s") - if os.path.exists(path): - break - else: - assert 0, "file not found: %(filename)s" - mod = imp.load_dynamic("%(name)s", path) - -__load() -del __load -""" - -MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', - 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', - 'org.python.core', 'riscos', 'riscosenviron', 'riscospath' -] - -STRIP_EXEC = "/usr/bin/strip" - -# -# We're using a stock interpreter to run the app, yet we need -# a way to pass the Python main program to the interpreter. The -# bootstrapping script fires up the interpreter with the right -# arguments. os.execve() is used as OSX doesn't like us to -# start a real new process. Also, the executable name must match -# the CFBundleExecutable value in the Info.plist, so we lie -# deliberately with argv[0]. The actual Python executable is -# passed in an environment variable so we can "repair" -# sys.executable later. -# -BOOTSTRAP_SCRIPT = """\ -#!%(hashbang)s - -import sys, os -execdir = os.path.dirname(sys.argv[0]) -executable = os.path.join(execdir, "%(executable)s") -resdir = os.path.join(os.path.dirname(execdir), "Resources") -libdir = os.path.join(os.path.dirname(execdir), "Frameworks") -mainprogram = os.path.join(resdir, "%(mainprogram)s") - -sys.argv.insert(1, mainprogram) -if %(standalone)s or %(semi_standalone)s: - os.environ["PYTHONPATH"] = resdir - if %(standalone)s: - os.environ["PYTHONHOME"] = resdir -else: - pypath = os.getenv("PYTHONPATH", "") - if pypath: - pypath = ":" + pypath - os.environ["PYTHONPATH"] = resdir + pypath -os.environ["PYTHONEXECUTABLE"] = executable -os.environ["DYLD_LIBRARY_PATH"] = libdir -os.environ["DYLD_FRAMEWORK_PATH"] = libdir -os.execve(executable, sys.argv, os.environ) -""" - - -# -# Optional wrapper that converts "dropped files" into sys.argv values. -# -ARGV_EMULATOR = """\ -import argvemulator, os - -argvemulator.ArgvCollector().mainloop() -execfile(os.path.join(os.path.split(__file__)[0], "%(realmainprogram)s")) -""" - -# -# When building a standalone app with Python.framework, we need to copy -# a subset from Python.framework to the bundle. The following list -# specifies exactly what items we'll copy. -# -PYTHONFRAMEWORKGOODIES = [ - "Python", # the Python core library - "Resources/English.lproj", - "Resources/Info.plist", - "Resources/version.plist", -] - -def isFramework(): - return sys.exec_prefix.find("Python.framework") > 0 - - -LIB = os.path.join(sys.prefix, "lib", "python" + sys.version[:3]) -SITE_PACKAGES = os.path.join(LIB, "site-packages") - - -class AppBuilder(BundleBuilder): - - # Override type of the bundle. - type = "APPL" - - # platform, name of the subfolder of Contents that contains the executable. - platform = "MacOS" - - # A Python main program. If this argument is given, the main - # executable in the bundle will be a small wrapper that invokes - # the main program. (XXX Discuss why.) - mainprogram = None - - # The main executable. If a Python main program is specified - # the executable will be copied to Resources and be invoked - # by the wrapper program mentioned above. Otherwise it will - # simply be used as the main executable. - executable = None - - # The name of the main nib, for Cocoa apps. *Must* be specified - # when building a Cocoa app. - nibname = None - - # The name of the icon file to be copied to Resources and used for - # the Finder icon. - iconfile = None - - # Symlink the executable instead of copying it. - symlink_exec = 0 - - # If True, build standalone app. - standalone = 0 - - # If True, build semi-standalone app (only includes third-party modules). - semi_standalone = 0 - - # If set, use this for #! lines in stead of sys.executable - python = None - - # If True, add a real main program that emulates sys.argv before calling - # mainprogram - argv_emulation = 0 - - # The following attributes are only used when building a standalone app. - - # Exclude these modules. - excludeModules = [] - - # Include these modules. - includeModules = [] - - # Include these packages. - includePackages = [] - - # Strip binaries from debug info. - strip = 0 - - # Found Python modules: [(name, codeobject, ispkg), ...] - pymodules = [] - - # Modules that modulefinder couldn't find: - missingModules = [] - maybeMissingModules = [] - - def setup(self): - if ((self.standalone or self.semi_standalone) - and self.mainprogram is None): - raise BundleBuilderError, ("must specify 'mainprogram' when " - "building a standalone application.") - if self.mainprogram is None and self.executable is None: - raise BundleBuilderError, ("must specify either or both of " - "'executable' and 'mainprogram'") - - self.execdir = pathjoin("Contents", self.platform) - - if self.name is not None: - pass - elif self.mainprogram is not None: - self.name = os.path.splitext(os.path.basename(self.mainprogram))[0] - elif executable is not None: - self.name = os.path.splitext(os.path.basename(self.executable))[0] - if self.name[-4:] != ".app": - self.name += ".app" - - if self.executable is None: - if not self.standalone and not isFramework(): - self.symlink_exec = 1 - if self.python: - self.executable = self.python - else: - self.executable = sys.executable - - if self.nibname: - self.plist.NSMainNibFile = self.nibname - if not hasattr(self.plist, "NSPrincipalClass"): - self.plist.NSPrincipalClass = "NSApplication" - - if self.standalone and isFramework(): - self.addPythonFramework() - - BundleBuilder.setup(self) - - self.plist.CFBundleExecutable = self.name - - if self.standalone or self.semi_standalone: - self.findDependencies() - - def preProcess(self): - resdir = "Contents/Resources" - if self.executable is not None: - if self.mainprogram is None: - execname = self.name - else: - execname = os.path.basename(self.executable) - execpath = pathjoin(self.execdir, execname) - if not self.symlink_exec: - self.files.append((self.destroot + self.executable, execpath)) - self.execpath = execpath - - if self.mainprogram is not None: - mainprogram = os.path.basename(self.mainprogram) - self.files.append((self.mainprogram, pathjoin(resdir, mainprogram))) - if self.argv_emulation: - # Change the main program, and create the helper main program (which - # does argv collection and then calls the real main). - # Also update the included modules (if we're creating a standalone - # program) and the plist - realmainprogram = mainprogram - mainprogram = '__argvemulator_' + mainprogram - resdirpath = pathjoin(self.bundlepath, resdir) - mainprogrampath = pathjoin(resdirpath, mainprogram) - makedirs(resdirpath) - open(mainprogrampath, "w").write(ARGV_EMULATOR % locals()) - if self.standalone or self.semi_standalone: - self.includeModules.append("argvemulator") - self.includeModules.append("os") - if not self.plist.has_key("CFBundleDocumentTypes"): - self.plist["CFBundleDocumentTypes"] = [ - { "CFBundleTypeOSTypes" : [ - "****", - "fold", - "disk"], - "CFBundleTypeRole": "Viewer"}] - # Write bootstrap script - executable = os.path.basename(self.executable) - execdir = pathjoin(self.bundlepath, self.execdir) - bootstrappath = pathjoin(execdir, self.name) - makedirs(execdir) - if self.standalone or self.semi_standalone: - # XXX we're screwed when the end user has deleted - # /usr/bin/python - hashbang = "/usr/bin/python" - elif self.python: - hashbang = self.python - else: - hashbang = os.path.realpath(sys.executable) - standalone = self.standalone - semi_standalone = self.semi_standalone - open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) - os.chmod(bootstrappath, 0775) - - if self.iconfile is not None: - iconbase = os.path.basename(self.iconfile) - self.plist.CFBundleIconFile = iconbase - self.files.append((self.iconfile, pathjoin(resdir, iconbase))) - - def postProcess(self): - if self.standalone or self.semi_standalone: - self.addPythonModules() - if self.strip and not self.symlink: - self.stripBinaries() - - if self.symlink_exec and self.executable: - self.message("Symlinking executable %s to %s" % (self.executable, - self.execpath), 2) - dst = pathjoin(self.bundlepath, self.execpath) - makedirs(os.path.dirname(dst)) - os.symlink(os.path.abspath(self.executable), dst) - - if self.missingModules or self.maybeMissingModules: - self.reportMissing() - - def addPythonFramework(self): - # If we're building a standalone app with Python.framework, - # include a minimal subset of Python.framework, *unless* - # Python.framework was specified manually in self.libs. - for lib in self.libs: - if os.path.basename(lib) == "Python.framework": - # a Python.framework was specified as a library - return - - frameworkpath = sys.exec_prefix[:sys.exec_prefix.find( - "Python.framework") + len("Python.framework")] - - version = sys.version[:3] - frameworkpath = pathjoin(frameworkpath, "Versions", version) - destbase = pathjoin("Contents", "Frameworks", "Python.framework", - "Versions", version) - for item in PYTHONFRAMEWORKGOODIES: - src = pathjoin(frameworkpath, item) - dst = pathjoin(destbase, item) - self.files.append((src, dst)) - - def _getSiteCode(self): - return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, - "<-bundlebuilder.py->", "exec") - - def addPythonModules(self): - self.message("Adding Python modules", 1) - - if USE_ZIPIMPORT: - # Create a zip file containing all modules as pyc. - import zipfile - relpath = pathjoin("Contents", "Resources", ZIP_ARCHIVE) - abspath = pathjoin(self.bundlepath, relpath) - zf = zipfile.ZipFile(abspath, "w", zipfile.ZIP_DEFLATED) - for name, code, ispkg in self.pymodules: - self.message("Adding Python module %s" % name, 2) - path, pyc = getPycData(name, code, ispkg) - zf.writestr(path, pyc) - zf.close() - # add site.pyc - sitepath = pathjoin(self.bundlepath, "Contents", "Resources", - "site" + PYC_EXT) - writePyc(self._getSiteCode(), sitepath) - else: - # Create individual .pyc files. - for name, code, ispkg in self.pymodules: - if ispkg: - name += ".__init__" - path = name.split(".") - path = pathjoin("Contents", "Resources", *path) + PYC_EXT - - if ispkg: - self.message("Adding Python package %s" % path, 2) - else: - self.message("Adding Python module %s" % path, 2) - - abspath = pathjoin(self.bundlepath, path) - makedirs(os.path.dirname(abspath)) - writePyc(code, abspath) - - def stripBinaries(self): - if not os.path.exists(STRIP_EXEC): - self.message("Error: can't strip binaries: no strip program at " - "%s" % STRIP_EXEC, 0) - else: - import stat - self.message("Stripping binaries", 1) - def walk(top): - for name in os.listdir(top): - path = pathjoin(top, name) - if os.path.islink(path): - continue - if os.path.isdir(path): - walk(path) - else: - mod = os.stat(path)[stat.ST_MODE] - if not (mod & 0100): - continue - relpath = path[len(self.bundlepath):] - self.message("Stripping %s" % relpath, 2) - inf, outf = os.popen4("%s -S \"%s\"" % - (STRIP_EXEC, path)) - output = outf.read().strip() - if output: - # usually not a real problem, like when we're - # trying to strip a script - self.message("Problem stripping %s:" % relpath, 3) - self.message(output, 3) - walk(self.bundlepath) - - def findDependencies(self): - self.message("Finding module dependencies", 1) - import modulefinder - mf = modulefinder.ModuleFinder(excludes=self.excludeModules) - if USE_ZIPIMPORT: - # zipimport imports zlib, must add it manually - mf.import_hook("zlib") - # manually add our own site.py - site = mf.add_module("site") - site.__code__ = self._getSiteCode() - mf.scan_code(site.__code__, site) - - # warnings.py gets imported implicitly from C - mf.import_hook("warnings") - - includeModules = self.includeModules[:] - for name in self.includePackages: - includeModules.extend(findPackageContents(name).keys()) - for name in includeModules: - try: - mf.import_hook(name) - except ImportError: - self.missingModules.append(name) - - mf.run_script(self.mainprogram) - modules = mf.modules.items() - modules.sort() - for name, mod in modules: - path = mod.__file__ - if path and self.semi_standalone: - # skip the standard library - if path.startswith(LIB) and not path.startswith(SITE_PACKAGES): - continue - if path and mod.__code__ is None: - # C extension - filename = os.path.basename(path) - pathitems = name.split(".")[:-1] + [filename] - dstpath = pathjoin(*pathitems) - if USE_ZIPIMPORT: - if name != "zlib": - # neatly pack all extension modules in a subdirectory, - # except zlib, since it's neccesary for bootstrapping. - dstpath = pathjoin("ExtensionModules", dstpath) - # Python modules are stored in a Zip archive, but put - # extensions in Contents/Resources/. Add a tiny "loader" - # program in the Zip archive. Due to Thomas Heller. - source = EXT_LOADER % {"name": name, "filename": dstpath} - code = compile(source, "<dynloader for %s>" % name, "exec") - mod.__code__ = code - self.files.append((path, pathjoin("Contents", "Resources", dstpath))) - if mod.__code__ is not None: - ispkg = mod.__path__ is not None - if not USE_ZIPIMPORT or name != "site": - # Our site.py is doing the bootstrapping, so we must - # include a real .pyc file if USE_ZIPIMPORT is True. - self.pymodules.append((name, mod.__code__, ispkg)) - - if hasattr(mf, "any_missing_maybe"): - missing, maybe = mf.any_missing_maybe() - else: - missing = mf.any_missing() - maybe = [] - self.missingModules.extend(missing) - self.maybeMissingModules.extend(maybe) - - def reportMissing(self): - missing = [name for name in self.missingModules - if name not in MAYMISS_MODULES] - if self.maybeMissingModules: - maybe = self.maybeMissingModules - else: - maybe = [name for name in missing if "." in name] - missing = [name for name in missing if "." not in name] - missing.sort() - maybe.sort() - if maybe: - self.message("Warning: couldn't find the following submodules:", 1) - self.message(" (Note that these could be false alarms -- " - "it's not always", 1) - self.message(" possible to distinguish between \"from package " - "import submodule\" ", 1) - self.message(" and \"from package import name\")", 1) - for name in maybe: - self.message(" ? " + name, 1) - if missing: - self.message("Warning: couldn't find the following modules:", 1) - for name in missing: - self.message(" ? " + name, 1) - - def report(self): - # XXX something decent - import pprint - pprint.pprint(self.__dict__) - if self.standalone or self.semi_standalone: - self.reportMissing() - -# -# Utilities. -# - -SUFFIXES = [_suf for _suf, _mode, _tp in imp.get_suffixes()] -identifierRE = re.compile(r"[_a-zA-z][_a-zA-Z0-9]*$") - -def findPackageContents(name, searchpath=None): - head = name.split(".")[-1] - if identifierRE.match(head) is None: - return {} - try: - fp, path, (ext, mode, tp) = imp.find_module(head, searchpath) - except ImportError: - return {} - modules = {name: None} - if tp == imp.PKG_DIRECTORY and path: - files = os.listdir(path) - for sub in files: - sub, ext = os.path.splitext(sub) - fullname = name + "." + sub - if sub != "__init__" and fullname not in modules: - modules.update(findPackageContents(fullname, [path])) - return modules - -def writePyc(code, path): - f = open(path, "wb") - f.write(MAGIC) - f.write("\0" * 4) # don't bother about a time stamp - marshal.dump(code, f) - f.close() - -def copy(src, dst, mkdirs=0): - """Copy a file or a directory.""" - if mkdirs: - makedirs(os.path.dirname(dst)) - if os.path.isdir(src): - shutil.copytree(src, dst, symlinks=1) - else: - shutil.copy2(src, dst) - -def copytodir(src, dstdir): - """Copy a file or a directory to an existing directory.""" - dst = pathjoin(dstdir, os.path.basename(src)) - copy(src, dst) - -def makedirs(dir): - """Make all directories leading up to 'dir' including the leaf - directory. Don't moan if any path element already exists.""" - try: - os.makedirs(dir) - except OSError, why: - if why.errno != errno.EEXIST: - raise - -def symlink(src, dst, mkdirs=0): - """Copy a file or a directory.""" - if not os.path.exists(src): - raise IOError, "No such file or directory: '%s'" % src - if mkdirs: - makedirs(os.path.dirname(dst)) - os.symlink(os.path.abspath(src), dst) - -def pathjoin(*args): - """Safe wrapper for os.path.join: asserts that all but the first - argument are relative paths.""" - for seg in args[1:]: - assert seg[0] != "/" - return os.path.join(*args) - - -cmdline_doc = """\ -Usage: - python bundlebuilder.py [options] command - python mybuildscript.py [options] command - -Commands: - build build the application - report print a report - -Options: - -b, --builddir=DIR the build directory; defaults to "build" - -n, --name=NAME application name - -r, --resource=FILE extra file or folder to be copied to Resources - -f, --file=SRC:DST extra file or folder to be copied into the bundle; - DST must be a path relative to the bundle root - -e, --executable=FILE the executable to be used - -m, --mainprogram=FILE the Python main program - -a, --argv add a wrapper main program to create sys.argv - -p, --plist=FILE .plist file (default: generate one) - --nib=NAME main nib name - -c, --creator=CCCC 4-char creator code (default: '????') - --iconfile=FILE filename of the icon (an .icns file) to be used - as the Finder icon - --bundle-id=ID the CFBundleIdentifier, in reverse-dns format - (eg. org.python.BuildApplet; this is used for - the preferences file name) - -l, --link symlink files/folder instead of copying them - --link-exec symlink the executable instead of copying it - --standalone build a standalone application, which is fully - independent of a Python installation - --semi-standalone build a standalone application, which depends on - an installed Python, yet includes all third-party - modules. - --python=FILE Python to use in #! line in stead of current Python - --lib=FILE shared library or framework to be copied into - the bundle - -x, --exclude=MODULE exclude module (with --(semi-)standalone) - -i, --include=MODULE include module (with --(semi-)standalone) - --package=PACKAGE include a whole package (with --(semi-)standalone) - --strip strip binaries (remove debug info) - -v, --verbose increase verbosity level - -q, --quiet decrease verbosity level - -h, --help print this message -""" - -def usage(msg=None): - if msg: - print msg - print cmdline_doc - sys.exit(1) - -def main(builder=None): - if builder is None: - builder = AppBuilder(verbosity=1) - - shortopts = "b:n:r:f:e:m:c:p:lx:i:hvqa" - longopts = ("builddir=", "name=", "resource=", "file=", "executable=", - "mainprogram=", "creator=", "nib=", "plist=", "link", - "link-exec", "help", "verbose", "quiet", "argv", "standalone", - "exclude=", "include=", "package=", "strip", "iconfile=", - "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=") - - try: - options, args = getopt.getopt(sys.argv[1:], shortopts, longopts) - except getopt.error: - usage() - - for opt, arg in options: - if opt in ('-b', '--builddir'): - builder.builddir = arg - elif opt in ('-n', '--name'): - builder.name = arg - elif opt in ('-r', '--resource'): - builder.resources.append(os.path.normpath(arg)) - elif opt in ('-f', '--file'): - srcdst = arg.split(':') - if len(srcdst) != 2: - usage("-f or --file argument must be two paths, " - "separated by a colon") - builder.files.append(srcdst) - elif opt in ('-e', '--executable'): - builder.executable = arg - elif opt in ('-m', '--mainprogram'): - builder.mainprogram = arg - elif opt in ('-a', '--argv'): - builder.argv_emulation = 1 - elif opt in ('-c', '--creator'): - builder.creator = arg - elif opt == '--bundle-id': - builder.bundle_id = arg - elif opt == '--iconfile': - builder.iconfile = arg - elif opt == "--lib": - builder.libs.append(os.path.normpath(arg)) - elif opt == "--nib": - builder.nibname = arg - elif opt in ('-p', '--plist'): - builder.plist = Plist.fromFile(arg) - elif opt in ('-l', '--link'): - builder.symlink = 1 - elif opt == '--link-exec': - builder.symlink_exec = 1 - elif opt in ('-h', '--help'): - usage() - elif opt in ('-v', '--verbose'): - builder.verbosity += 1 - elif opt in ('-q', '--quiet'): - builder.verbosity -= 1 - elif opt == '--standalone': - builder.standalone = 1 - elif opt == '--semi-standalone': - builder.semi_standalone = 1 - elif opt == '--python': - builder.python = arg - elif opt in ('-x', '--exclude'): - builder.excludeModules.append(arg) - elif opt in ('-i', '--include'): - builder.includeModules.append(arg) - elif opt == '--package': - builder.includePackages.append(arg) - elif opt == '--strip': - builder.strip = 1 - elif opt == '--destroot': - builder.destroot = arg - - if len(args) != 1: - usage("Must specify one command ('build', 'report' or 'help')") - command = args[0] - - if command == "build": - builder.setup() - builder.build() - elif command == "report": - builder.setup() - builder.report() - elif command == "help": - usage() - else: - usage("Unknown command '%s'" % command) - - -def buildapp(**kwargs): - builder = AppBuilder(**kwargs) - main(builder) - - -if __name__ == "__main__": - main() diff --git a/sys/lib/python/plat-mac/cfmfile.py b/sys/lib/python/plat-mac/cfmfile.py deleted file mode 100644 index fd1a3e86c..000000000 --- a/sys/lib/python/plat-mac/cfmfile.py +++ /dev/null @@ -1,183 +0,0 @@ -"""codefragments.py -- wrapper to modify code fragments.""" - -# (c) 1998, Just van Rossum, Letterror - -__version__ = "0.8b3" -__author__ = "jvr" - -import Carbon.File -import struct -from Carbon import Res -import os -import sys - -DEBUG = 0 - -error = "cfm.error" - -BUFSIZE = 0x80000 - -def mergecfmfiles(srclist, dst, architecture = 'fat'): - """Merge all files in srclist into a new file dst. - - If architecture is given, only code fragments of that type will be used: - "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" - 68k code, since it does not use code fragments to begin with. - If architecture is None, all fragments will be used, enabling FAT binaries. - """ - - srclist = list(srclist) - for i in range(len(srclist)): - srclist[i] = Carbon.File.pathname(srclist[i]) - dst = Carbon.File.pathname(dst) - - dstfile = open(dst, "wb") - rf = Res.FSpOpenResFile(dst, 3) - try: - dstcfrg = CfrgResource() - for src in srclist: - srccfrg = CfrgResource(src) - for frag in srccfrg.fragments: - if frag.architecture == 'pwpc' and architecture == 'm68k': - continue - if frag.architecture == 'm68k' and architecture == 'pwpc': - continue - dstcfrg.append(frag) - - frag.copydata(dstfile) - - cfrgres = Res.Resource(dstcfrg.build()) - Res.UseResFile(rf) - cfrgres.AddResource('cfrg', 0, "") - finally: - dstfile.close() - rf = Res.CloseResFile(rf) - - -class CfrgResource: - - def __init__(self, path = None): - self.version = 1 - self.fragments = [] - self.path = path - if path is not None and os.path.exists(path): - currentresref = Res.CurResFile() - resref = Res.FSpOpenResFile(path, 1) - Res.UseResFile(resref) - try: - try: - data = Res.Get1Resource('cfrg', 0).data - except Res.Error: - raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback - finally: - Res.CloseResFile(resref) - Res.UseResFile(currentresref) - self.parse(data) - if self.version <> 1: - raise error, "unknown 'cfrg' resource format" - - def parse(self, data): - (res1, res2, self.version, - res3, res4, res5, res6, - self.memberCount) = struct.unpack("8l", data[:32]) - data = data[32:] - while data: - frag = FragmentDescriptor(self.path, data) - data = data[frag.memberSize:] - self.fragments.append(frag) - - def build(self): - self.memberCount = len(self.fragments) - data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) - for frag in self.fragments: - data = data + frag.build() - return data - - def append(self, frag): - self.fragments.append(frag) - - -class FragmentDescriptor: - - def __init__(self, path, data = None): - self.path = path - if data is not None: - self.parse(data) - - def parse(self, data): - self.architecture = data[:4] - ( self.updatelevel, - self.currentVersion, - self.oldDefVersion, - self.stacksize, - self.applibdir, - self.fragtype, - self.where, - self.offset, - self.length, - self.res1, self.res2, - self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) - pname = data[42:self.memberSize] - self.name = pname[1:1+ord(pname[0])] - - def build(self): - data = self.architecture - data = data + struct.pack("4lhBB4l", - self.updatelevel, - self.currentVersion, - self.oldDefVersion, - self.stacksize, - self.applibdir, - self.fragtype, - self.where, - self.offset, - self.length, - self.res1, self.res2) - self.memberSize = len(data) + 2 + 1 + len(self.name) - # pad to 4 byte boundaries - if self.memberSize % 4: - self.memberSize = self.memberSize + 4 - (self.memberSize % 4) - data = data + struct.pack("hb", self.memberSize, len(self.name)) - data = data + self.name - data = data + '\000' * (self.memberSize - len(data)) - return data - - def getfragment(self): - if self.where <> 1: - raise error, "can't read fragment, unsupported location" - f = open(self.path, "rb") - f.seek(self.offset) - if self.length: - frag = f.read(self.length) - else: - frag = f.read() - f.close() - return frag - - def copydata(self, outfile): - if self.where <> 1: - raise error, "can't read fragment, unsupported location" - infile = open(self.path, "rb") - if self.length == 0: - infile.seek(0, 2) - self.length = infile.tell() - - # Position input file and record new offset from output file - infile.seek(self.offset) - - # pad to 16 byte boundaries - offset = outfile.tell() - if offset % 16: - offset = offset + 16 - (offset % 16) - outfile.seek(offset) - self.offset = offset - - l = self.length - while l: - if l > BUFSIZE: - outfile.write(infile.read(BUFSIZE)) - l = l - BUFSIZE - else: - outfile.write(infile.read(l)) - l = 0 - infile.close() diff --git a/sys/lib/python/plat-mac/dialogs.rsrc b/sys/lib/python/plat-mac/dialogs.rsrc Binary files differdeleted file mode 100644 index 0107493b5..000000000 --- a/sys/lib/python/plat-mac/dialogs.rsrc +++ /dev/null diff --git a/sys/lib/python/plat-mac/errors.rsrc b/sys/lib/python/plat-mac/errors.rsrc Binary files differdeleted file mode 100644 index 61c487e17..000000000 --- a/sys/lib/python/plat-mac/errors.rsrc +++ /dev/null diff --git a/sys/lib/python/plat-mac/findertools.py b/sys/lib/python/plat-mac/findertools.py deleted file mode 100644 index 54b1bdec0..000000000 --- a/sys/lib/python/plat-mac/findertools.py +++ /dev/null @@ -1,831 +0,0 @@ -"""Utility routines depending on the finder, -a combination of code by Jack Jansen and erik@letterror.com. - -Most events have been captured from -Lasso Capture AE and than translated to python code. - -IMPORTANT -Note that the processes() function returns different values -depending on the OS version it is running on. On MacOS 9 -the Finder returns the process *names* which can then be -used to find out more about them. On MacOS 8.6 and earlier -the Finder returns a code which does not seem to work. -So bottom line: the processes() stuff does not work on < MacOS9 - -Mostly written by erik@letterror.com -""" -import Finder -from Carbon import AppleEvents -import aetools -import MacOS -import sys -import Carbon.File -import Carbon.Folder -import aetypes -from types import * - -__version__ = '1.1' -Error = 'findertools.Error' - -_finder_talker = None - -def _getfinder(): - """returns basic (recyclable) Finder AE interface object""" - global _finder_talker - if not _finder_talker: - _finder_talker = Finder.Finder() - _finder_talker.send_flags = ( _finder_talker.send_flags | - AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer) - return _finder_talker - -def launch(file): - """Open a file thru the finder. Specify file by name or fsspec""" - finder = _getfinder() - fss = Carbon.File.FSSpec(file) - return finder.open(fss) - -def Print(file): - """Print a file thru the finder. Specify file by name or fsspec""" - finder = _getfinder() - fss = Carbon.File.FSSpec(file) - return finder._print(fss) - -def copy(src, dstdir): - """Copy a file to a folder""" - finder = _getfinder() - if type(src) == type([]): - src_fss = [] - for s in src: - src_fss.append(Carbon.File.FSSpec(s)) - else: - src_fss = Carbon.File.FSSpec(src) - dst_fss = Carbon.File.FSSpec(dstdir) - return finder.duplicate(src_fss, to=dst_fss) - -def move(src, dstdir): - """Move a file to a folder""" - finder = _getfinder() - if type(src) == type([]): - src_fss = [] - for s in src: - src_fss.append(Carbon.File.FSSpec(s)) - else: - src_fss = Carbon.File.FSSpec(src) - dst_fss = Carbon.File.FSSpec(dstdir) - return finder.move(src_fss, to=dst_fss) - -def sleep(): - """Put the mac to sleep""" - finder = _getfinder() - finder.sleep() - -def shutdown(): - """Shut the mac down""" - finder = _getfinder() - finder.shut_down() - -def restart(): - """Restart the mac""" - finder = _getfinder() - finder.restart() - - -#--------------------------------------------------- -# Additional findertools -# - -def reveal(file): - """Reveal a file in the finder. Specify file by name, fsref or fsspec.""" - finder = _getfinder() - fsr = Carbon.File.FSRef(file) - file_alias = fsr.FSNewAliasMinimal() - return finder.reveal(file_alias) - -def select(file): - """select a file in the finder. Specify file by name, fsref or fsspec.""" - finder = _getfinder() - fsr = Carbon.File.FSRef(file) - file_alias = fsr.FSNewAliasMinimal() - return finder.select(file_alias) - -def update(file): - """Update the display of the specified object(s) to match - their on-disk representation. Specify file by name, fsref or fsspec.""" - finder = _getfinder() - fsr = Carbon.File.FSRef(file) - file_alias = fsr.FSNewAliasMinimal() - return finder.update(file_alias) - - -#--------------------------------------------------- -# More findertools -# - -def comment(object, comment=None): - """comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window.""" - object = Carbon.File.FSRef(object) - object_alias = object.FSNewAliasMonimal() - if comment == None: - return _getcomment(object_alias) - else: - return _setcomment(object_alias, comment) - -def _setcomment(object_alias, comment): - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00) - args['----'] = aeobj_01 - args["data"] = comment - _reply, args, attrs = finder.send("core", "setd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def _getcomment(object_alias): - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00) - args['----'] = aeobj_01 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - - -#--------------------------------------------------- -# Get information about current processes in the Finder. - -def processes(): - """processes returns a list of all active processes running on this computer and their creators.""" - finder = _getfinder() - args = {} - attrs = {} - processnames = [] - processnumbers = [] - creators = [] - partitions = [] - used = [] - ## get the processnames or else the processnumbers - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None) - _reply, args, attrs = finder.send('core', 'getd', args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - p = [] - if args.has_key('----'): - p = args['----'] - for proc in p: - if hasattr(proc, 'seld'): - # it has a real name - processnames.append(proc.seld) - elif hasattr(proc, 'type'): - if proc.type == "psn ": - # it has a process number - processnumbers.append(proc.data) - ## get the creators - args = {} - attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None) - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=aeobj_0) - _reply, args, attrs = finder.send('core', 'getd', args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(_arg) - if args.has_key('----'): - p = args['----'] - creators = p[:] - ## concatenate in one dict - result = [] - if len(processnames) > len(processnumbers): - data = processnames - else: - data = processnumbers - for i in range(len(creators)): - result.append((data[i], creators[i])) - return result - -class _process: - pass - -def isactiveprocess(processname): - """Check of processname is active. MacOS9""" - all = processes() - ok = 0 - for n, c in all: - if n == processname: - return 1 - return 0 - -def processinfo(processname): - """Return an object with all process properties as attributes for processname. MacOS9""" - p = _process() - - if processname == "Finder": - p.partition = None - p.used = None - else: - p.partition = _processproperty(processname, 'appt') - p.used = _processproperty(processname, 'pusd') - p.visible = _processproperty(processname, 'pvis') #Is the process' layer visible? - p.frontmost = _processproperty(processname, 'pisf') #Is the process the frontmost process? - p.file = _processproperty(processname, 'file') #the file from which the process was launched - p.filetype = _processproperty(processname, 'asty') #the OSType of the file type of the process - p.creatortype = _processproperty(processname, 'fcrt') #the OSType of the creator of the process (the signature) - p.accepthighlevel = _processproperty(processname, 'revt') #Is the process high-level event aware (accepts open application, open document, print document, and quit)? - p.hasscripting = _processproperty(processname, 'hscr') #Does the process have a scripting terminology, i.e., can it be scripted? - return p - -def _processproperty(processname, property): - """return the partition size and memory used for processname""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="name", seld=processname, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type(property), fr=aeobj_00) - args['----'] = aeobj_01 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - - -#--------------------------------------------------- -# Mess around with Finder windows. - -def openwindow(object): - """Open a Finder window for object, Specify object by name or fsspec.""" - finder = _getfinder() - object = Carbon.File.FSRef(object) - object_alias = object.FSNewAliasMinimal() - args = {} - attrs = {} - _code = 'aevt' - _subcode = 'odoc' - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) - args['----'] = aeobj_0 - _reply, args, attrs = finder.send(_code, _subcode, args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - -def closewindow(object): - """Close a Finder window for folder, Specify by path.""" - finder = _getfinder() - object = Carbon.File.FSRef(object) - object_alias = object.FSNewAliasMinimal() - args = {} - attrs = {} - _code = 'core' - _subcode = 'clos' - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) - args['----'] = aeobj_0 - _reply, args, attrs = finder.send(_code, _subcode, args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - -def location(object, pos=None): - """Set the position of a Finder window for folder to pos=(w, h). Specify file by name or fsspec. - If pos=None, location will return the current position of the object.""" - object = Carbon.File.FSRef(object) - object_alias = object.FSNewAliasMinimal() - if not pos: - return _getlocation(object_alias) - return _setlocation(object_alias, pos) - -def _setlocation(object_alias, (x, y)): - """_setlocation: Set the location of the icon for the object.""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00) - args['----'] = aeobj_01 - args["data"] = [x, y] - _reply, args, attrs = finder.send("core", "setd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - return (x,y) - -def _getlocation(object_alias): - """_getlocation: get the location of the icon for the object.""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00) - args['----'] = aeobj_01 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - pos = args['----'] - return pos.h, pos.v - -def label(object, index=None): - """label: set or get the label of the item. Specify file by name or fsspec.""" - object = Carbon.File.FSRef(object) - object_alias = object.FSNewAliasMinimal() - if index == None: - return _getlabel(object_alias) - if index < 0 or index > 7: - index = 0 - return _setlabel(object_alias, index) - -def _getlabel(object_alias): - """label: Get the label for the object.""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('labi'), fr=aeobj_00) - args['----'] = aeobj_01 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def _setlabel(object_alias, index): - """label: Set the label for the object.""" - finder = _getfinder() - args = {} - attrs = {} - _code = 'core' - _subcode = 'setd' - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="alis", seld=object_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('labi'), fr=aeobj_0) - args['----'] = aeobj_1 - args["data"] = index - _reply, args, attrs = finder.send(_code, _subcode, args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - return index - -def windowview(folder, view=None): - """windowview: Set the view of the window for the folder. Specify file by name or fsspec. - 0 = by icon (default) - 1 = by name - 2 = by button - """ - fsr = Carbon.File.FSRef(folder) - folder_alias = fsr.FSNewAliasMinimal() - if view == None: - return _getwindowview(folder_alias) - return _setwindowview(folder_alias, view) - -def _setwindowview(folder_alias, view=0): - """set the windowview""" - attrs = {} - args = {} - if view == 1: - _v = aetypes.Type('pnam') - elif view == 2: - _v = aetypes.Type('lgbu') - else: - _v = aetypes.Type('iimg') - finder = _getfinder() - aeobj_0 = aetypes.ObjectSpecifier(want = aetypes.Type('cfol'), - form = 'alis', seld = folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), - form = 'prop', seld = aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), - form = 'prop', seld = aetypes.Type('pvew'), fr=aeobj_1) - aeobj_3 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), - form = 'prop', seld = _v, fr=None) - _code = 'core' - _subcode = 'setd' - args['----'] = aeobj_2 - args['data'] = aeobj_3 - _reply, args, attrs = finder.send(_code, _subcode, args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def _getwindowview(folder_alias): - """get the windowview""" - attrs = {} - args = {} - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_00) - aeobj_02 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('pvew'), fr=aeobj_01) - args['----'] = aeobj_02 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - views = {'iimg':0, 'pnam':1, 'lgbu':2} - if args.has_key('----'): - return views[args['----'].enum] - -def windowsize(folder, size=None): - """Set the size of a Finder window for folder to size=(w, h), Specify by path. - If size=None, windowsize will return the current size of the window. - Specify file by name or fsspec. - """ - fsr = Carbon.File.FSRef(folder) - folder_alias = fsr.FSNewAliasMinimal() - openwindow(fsr) - if not size: - return _getwindowsize(folder_alias) - return _setwindowsize(folder_alias, size) - -def _setwindowsize(folder_alias, (w, h)): - """Set the size of a Finder window for folder to (w, h)""" - finder = _getfinder() - args = {} - attrs = {} - _code = 'core' - _subcode = 'setd' - aevar00 = [w, h] - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), - form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1) - args['----'] = aeobj_2 - args["data"] = aevar00 - _reply, args, attrs = finder.send(_code, _subcode, args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - return (w, h) - -def _getwindowsize(folder_alias): - """Set the size of a Finder window for folder to (w, h)""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), - form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('posn'), fr=aeobj_1) - args['----'] = aeobj_2 - _reply, args, attrs = finder.send('core', 'getd', args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def windowposition(folder, pos=None): - """Set the position of a Finder window for folder to pos=(w, h).""" - fsr = Carbon.File.FSRef(folder) - folder_alias = fsr.FSNewAliasMinimal() - openwindow(fsr) - if not pos: - return _getwindowposition(folder_alias) - if type(pos) == InstanceType: - # pos might be a QDPoint object as returned by _getwindowposition - pos = (pos.h, pos.v) - return _setwindowposition(folder_alias, pos) - -def _setwindowposition(folder_alias, (x, y)): - """Set the size of a Finder window for folder to (w, h).""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), - form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('posn'), fr=aeobj_1) - args['----'] = aeobj_2 - args["data"] = [x, y] - _reply, args, attrs = finder.send('core', 'setd', args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def _getwindowposition(folder_alias): - """Get the size of a Finder window for folder, Specify by path.""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), - form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1) - args['----'] = aeobj_2 - _reply, args, attrs = finder.send('core', 'getd', args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def icon(object, icondata=None): - """icon sets the icon of object, if no icondata is given, - icon will return an AE object with binary data for the current icon. - If left untouched, this data can be used to paste the icon on another file. - Development opportunity: get and set the data as PICT.""" - fsr = Carbon.File.FSRef(object) - object_alias = fsr.FSNewAliasMinimal() - if icondata == None: - return _geticon(object_alias) - return _seticon(object_alias, icondata) - -def _geticon(object_alias): - """get the icondata for object. Binary data of some sort.""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), - form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00) - args['----'] = aeobj_01 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def _seticon(object_alias, icondata): - """set the icondata for object, formatted as produced by _geticon()""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), - form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), - form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00) - args['----'] = aeobj_01 - args["data"] = icondata - _reply, args, attrs = finder.send("core", "setd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'].data - - -#--------------------------------------------------- -# Volumes and servers. - -def mountvolume(volume, server=None, username=None, password=None): - """mount a volume, local or on a server on AppleTalk. - Note: mounting a ASIP server requires a different operation. - server is the name of the server where the volume belongs - username, password belong to a registered user of the volume.""" - finder = _getfinder() - args = {} - attrs = {} - if password: - args["PASS"] = password - if username: - args["USER"] = username - if server: - args["SRVR"] = server - args['----'] = volume - _reply, args, attrs = finder.send("aevt", "mvol", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def unmountvolume(volume): - """unmount a volume that's on the desktop""" - putaway(volume) - -def putaway(object): - """puth the object away, whereever it came from.""" - finder = _getfinder() - args = {} - attrs = {} - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None) - _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - - -#--------------------------------------------------- -# Miscellaneous functions -# - -def volumelevel(level): - """set the audio output level, parameter between 0 (silent) and 7 (full blast)""" - finder = _getfinder() - args = {} - attrs = {} - if level < 0: - level = 0 - elif level > 7: - level = 7 - args['----'] = level - _reply, args, attrs = finder.send("aevt", "stvl", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def OSversion(): - """return the version of the system software""" - finder = _getfinder() - args = {} - attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ver2'), fr=None) - args['----'] = aeobj_00 - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - return args['----'] - -def filesharing(): - """return the current status of filesharing and whether it is starting up or not: - -1 file sharing is off and not starting up - 0 file sharing is off and starting up - 1 file sharing is on""" - status = -1 - finder = _getfinder() - # see if it is on - args = {} - attrs = {} - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None) - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - if args['----'] == 0: - status = -1 - else: - status = 1 - # is it starting up perchance? - args = {} - attrs = {} - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None) - _reply, args, attrs = finder.send("core", "getd", args, attrs) - if args.has_key('errn'): - raise Error, aetools.decodeerror(args) - if args.has_key('----'): - if args['----'] == 1: - status = 0 - return status - -def movetotrash(path): - """move the object to the trash""" - fss = Carbon.File.FSSpec(path) - trashfolder = Carbon.Folder.FSFindFolder(fss.as_tuple()[0], 'trsh', 0) - move(path, trashfolder) - -def emptytrash(): - """empty the trash""" - finder = _getfinder() - args = {} - attrs = {} - args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None) - _reply, args, attrs = finder.send("fndr", "empt", args, attrs) - if args.has_key('errn'): - raise aetools.Error, aetools.decodeerror(args) - - -def _test(): - import EasyDialogs - print 'Original findertools functionality test...' - print 'Testing launch...' - pathname = EasyDialogs.AskFileForOpen('File to launch:') - if pathname: - result = launch(pathname) - if result: - print 'Result: ', result - print 'Press return-', - sys.stdin.readline() - print 'Testing print...' - pathname = EasyDialogs.AskFileForOpen('File to print:') - if pathname: - result = Print(pathname) - if result: - print 'Result: ', result - print 'Press return-', - sys.stdin.readline() - print 'Testing copy...' - pathname = EasyDialogs.AskFileForOpen('File to copy:') - if pathname: - destdir = EasyDialogs.AskFolder('Destination:') - if destdir: - result = copy(pathname, destdir) - if result: - print 'Result:', result - print 'Press return-', - sys.stdin.readline() - print 'Testing move...' - pathname = EasyDialogs.AskFileForOpen('File to move:') - if pathname: - destdir = EasyDialogs.AskFolder('Destination:') - if destdir: - result = move(pathname, destdir) - if result: - print 'Result:', result - print 'Press return-', - sys.stdin.readline() - print 'Testing sleep...' - if EasyDialogs.AskYesNoCancel('Sleep?') > 0: - result = sleep() - if result: - print 'Result:', result - print 'Press return-', - sys.stdin.readline() - print 'Testing shutdown...' - if EasyDialogs.AskYesNoCancel('Shut down?') > 0: - result = shutdown() - if result: - print 'Result:', result - print 'Press return-', - sys.stdin.readline() - print 'Testing restart...' - if EasyDialogs.AskYesNoCancel('Restart?') > 0: - result = restart() - if result: - print 'Result:', result - print 'Press return-', - sys.stdin.readline() - -def _test2(): - print '\nmorefindertools version %s\nTests coming up...' %__version__ - import os - import random - - # miscellaneous - print '\tfilesharing on?', filesharing() # is file sharing on, off, starting up? - print '\tOS version', OSversion() # the version of the system software - - # set the soundvolume in a simple way - print '\tSystem beep volume' - for i in range(0, 7): - volumelevel(i) - MacOS.SysBeep() - - # Finder's windows, file location, file attributes - open("@findertoolstest", "w") - f = "@findertoolstest" - reveal(f) # reveal this file in a Finder window - select(f) # select this file - - base, file = os.path.split(f) - closewindow(base) # close the window this file is in (opened by reveal) - openwindow(base) # open it again - windowview(base, 1) # set the view by list - - label(f, 2) # set the label of this file to something orange - print '\tlabel', label(f) # get the label of this file - - # the file location only works in a window with icon view! - print 'Random locations for an icon' - windowview(base, 0) # set the view by icon - windowsize(base, (600, 600)) - for i in range(50): - location(f, (random.randint(10, 590), random.randint(10, 590))) - - windowsize(base, (200, 400)) - windowview(base, 1) # set the view by icon - - orgpos = windowposition(base) - print 'Animated window location' - for i in range(10): - pos = (100+i*10, 100+i*10) - windowposition(base, pos) - print '\twindow position', pos - windowposition(base, orgpos) # park it where it was before - - print 'Put a comment in file', f, ':' - print '\t', comment(f) # print the Finder comment this file has - s = 'This is a comment no one reads!' - comment(f, s) # set the Finder comment - -def _test3(): - print 'MacOS9 or better specific functions' - # processes - pr = processes() # return a list of tuples with (active_processname, creatorcode) - print 'Return a list of current active processes:' - for p in pr: - print '\t', p - - # get attributes of the first process in the list - print 'Attributes of the first process in the list:' - pinfo = processinfo(pr[0][0]) - print '\t', pr[0][0] - print '\t\tmemory partition', pinfo.partition # the memory allocated to this process - print '\t\tmemory used', pinfo.used # the memory actuall used by this process - print '\t\tis visible', pinfo.visible # is the process visible to the user - print '\t\tis frontmost', pinfo.frontmost # is the process the front most one? - print '\t\thas scripting', pinfo.hasscripting # is the process scriptable? - print '\t\taccepts high level events', pinfo.accepthighlevel # does the process accept high level appleevents? - -if __name__ == '__main__': - _test() - _test2() - _test3() diff --git a/sys/lib/python/plat-mac/gensuitemodule.py b/sys/lib/python/plat-mac/gensuitemodule.py deleted file mode 100644 index 87132c57f..000000000 --- a/sys/lib/python/plat-mac/gensuitemodule.py +++ /dev/null @@ -1,1213 +0,0 @@ -""" -gensuitemodule - Generate an AE suite module from an aete/aeut resource - -Based on aete.py. - -Reading and understanding this code is left as an exercise to the reader. -""" - -import MacOS -import EasyDialogs -import os -import string -import sys -import types -import StringIO -import keyword -import macresource -import aetools -import distutils.sysconfig -import OSATerminology -from Carbon.Res import * -import Carbon.Folder -import MacOS -import getopt -import plistlib - -_MAC_LIB_FOLDER=os.path.dirname(aetools.__file__) -DEFAULT_STANDARD_PACKAGEFOLDER=os.path.join(_MAC_LIB_FOLDER, 'lib-scriptpackages') -DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib() - -def usage(): - sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) - sys.stderr.write("""Options: ---output pkgdir Pathname of the output package (short: -o) ---resource Parse resource file in stead of launching application (-r) ---base package Use another base package in stead of default StdSuites (-b) ---edit old=new Edit suite names, use empty new to skip a suite (-e) ---creator code Set creator code for package (-c) ---dump Dump aete resource to stdout in stead of creating module (-d) ---verbose Tell us what happens (-v) -""") - sys.exit(1) - -def main(): - if len(sys.argv) > 1: - SHORTOPTS = "rb:o:e:c:dv" - LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=", "dump", "verbose") - try: - opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) - except getopt.GetoptError: - usage() - - process_func = processfile - basepkgname = 'StdSuites' - output = None - edit_modnames = [] - creatorsignature = None - dump = None - verbose = None - - for o, a in opts: - if o in ('-r', '--resource'): - process_func = processfile_fromresource - if o in ('-b', '--base'): - basepkgname = a - if o in ('-o', '--output'): - output = a - if o in ('-e', '--edit'): - split = a.split('=') - if len(split) != 2: - usage() - edit_modnames.append(split) - if o in ('-c', '--creator'): - if len(a) != 4: - sys.stderr.write("creator must be 4-char string\n") - sys.exit(1) - creatorsignature = a - if o in ('-d', '--dump'): - dump = sys.stdout - if o in ('-v', '--verbose'): - verbose = sys.stderr - - - if output and len(args) > 1: - sys.stderr.write("%s: cannot specify --output with multiple inputs\n" % sys.argv[0]) - sys.exit(1) - - for filename in args: - process_func(filename, output=output, basepkgname=basepkgname, - edit_modnames=edit_modnames, creatorsignature=creatorsignature, - dump=dump, verbose=verbose) - else: - main_interactive() - -def main_interactive(interact=0, basepkgname='StdSuites'): - if interact: - # Ask for save-filename for each module - edit_modnames = None - else: - # Use default filenames for each module - edit_modnames = [] - appsfolder = Carbon.Folder.FSFindFolder(-32765, 'apps', 0) - filename = EasyDialogs.AskFileForOpen( - message='Select scriptable application', - dialogOptionFlags=0x1056, # allow selection of .app bundles - defaultLocation=appsfolder) - if not filename: - return - if not is_scriptable(filename): - if EasyDialogs.AskYesNoCancel( - "Warning: application does not seem scriptable", - yes="Continue", default=2, no="") <= 0: - return - try: - processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname, - verbose=sys.stderr) - except MacOS.Error, arg: - print "Error getting terminology:", arg - print "Retry, manually parsing resources" - processfile_fromresource(filename, edit_modnames=edit_modnames, - basepkgname=basepkgname, verbose=sys.stderr) - -def is_scriptable(application): - """Return true if the application is scriptable""" - if os.path.isdir(application): - plistfile = os.path.join(application, 'Contents', 'Info.plist') - if not os.path.exists(plistfile): - return False - plist = plistlib.Plist.fromFile(plistfile) - return plist.get('NSAppleScriptEnabled', False) - # If it is a file test for an aete/aeut resource. - currf = CurResFile() - try: - refno = macresource.open_pathname(application) - except MacOS.Error: - return False - UseResFile(refno) - n_terminology = Count1Resources('aete') + Count1Resources('aeut') + \ - Count1Resources('scsz') + Count1Resources('osiz') - CloseResFile(refno) - UseResFile(currf) - return n_terminology > 0 - -def processfile_fromresource(fullname, output=None, basepkgname=None, - edit_modnames=None, creatorsignature=None, dump=None, verbose=None): - """Process all resources in a single file""" - if not is_scriptable(fullname) and verbose: - print >>verbose, "Warning: app does not seem scriptable: %s" % fullname - cur = CurResFile() - if verbose: - print >>verbose, "Processing", fullname - rf = macresource.open_pathname(fullname) - try: - UseResFile(rf) - resources = [] - for i in range(Count1Resources('aete')): - res = Get1IndResource('aete', 1+i) - resources.append(res) - for i in range(Count1Resources('aeut')): - res = Get1IndResource('aeut', 1+i) - resources.append(res) - if verbose: - print >>verbose, "\nLISTING aete+aeut RESOURCES IN", repr(fullname) - aetelist = [] - for res in resources: - if verbose: - print >>verbose, "decoding", res.GetResInfo(), "..." - data = res.data - aete = decode(data, verbose) - aetelist.append((aete, res.GetResInfo())) - finally: - if rf <> cur: - CloseResFile(rf) - UseResFile(cur) - # switch back (needed for dialogs in Python) - UseResFile(cur) - if dump: - dumpaetelist(aetelist, dump) - compileaetelist(aetelist, fullname, output=output, - basepkgname=basepkgname, edit_modnames=edit_modnames, - creatorsignature=creatorsignature, verbose=verbose) - -def processfile(fullname, output=None, basepkgname=None, - edit_modnames=None, creatorsignature=None, dump=None, - verbose=None): - """Ask an application for its terminology and process that""" - if not is_scriptable(fullname) and verbose: - print >>verbose, "Warning: app does not seem scriptable: %s" % fullname - if verbose: - print >>verbose, "\nASKING FOR aete DICTIONARY IN", repr(fullname) - try: - aedescobj, launched = OSATerminology.GetAppTerminology(fullname) - except MacOS.Error, arg: - if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound - if verbose: - print >>verbose, "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" - aedata, sig = getappterminology(fullname, verbose=verbose) - if not creatorsignature: - creatorsignature = sig - else: - raise - else: - if launched: - if verbose: - print >>verbose, "Launched", fullname - raw = aetools.unpack(aedescobj) - if not raw: - if verbose: - print >>verbose, 'Unpack returned empty value:', raw - return - if not raw[0].data: - if verbose: - print >>verbose, 'Unpack returned value without data:', raw - return - aedata = raw[0] - aete = decode(aedata.data, verbose) - if dump: - dumpaetelist([aete], dump) - return - compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, - creatorsignature=creatorsignature, edit_modnames=edit_modnames, - verbose=verbose) - -def getappterminology(fullname, verbose=None): - """Get application terminology by sending an AppleEvent""" - # First check that we actually can send AppleEvents - if not MacOS.WMAvailable(): - raise RuntimeError, "Cannot send AppleEvents, no access to window manager" - # Next, a workaround for a bug in MacOS 10.2: sending events will hang unless - # you have created an event loop first. - import Carbon.Evt - Carbon.Evt.WaitNextEvent(0,0) - if os.path.isdir(fullname): - # Now get the signature of the application, hoping it is a bundle - pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo') - if not os.path.exists(pkginfo): - raise RuntimeError, "No PkgInfo file found" - tp_cr = open(pkginfo, 'rb').read() - cr = tp_cr[4:8] - else: - # Assume it is a file - cr, tp = MacOS.GetCreatorAndType(fullname) - # Let's talk to it and ask for its AETE - talker = aetools.TalkTo(cr) - try: - talker._start() - except (MacOS.Error, aetools.Error), arg: - if verbose: - print >>verbose, 'Warning: start() failed, continuing anyway:', arg - reply = talker.send("ascr", "gdte") - #reply2 = talker.send("ascr", "gdut") - # Now pick the bits out of the return that we need. - return reply[1]['----'], cr - - -def compileaetelist(aetelist, fullname, output=None, basepkgname=None, - edit_modnames=None, creatorsignature=None, verbose=None): - for aete, resinfo in aetelist: - compileaete(aete, resinfo, fullname, output=output, - basepkgname=basepkgname, edit_modnames=edit_modnames, - creatorsignature=creatorsignature, verbose=verbose) - -def dumpaetelist(aetelist, output): - import pprint - pprint.pprint(aetelist, output) - -def decode(data, verbose=None): - """Decode a resource into a python data structure""" - f = StringIO.StringIO(data) - aete = generic(getaete, f) - aete = simplify(aete) - processed = f.tell() - unprocessed = len(f.read()) - total = f.tell() - if unprocessed and verbose: - verbose.write("%d processed + %d unprocessed = %d total\n" % - (processed, unprocessed, total)) - return aete - -def simplify(item): - """Recursively replace singleton tuples by their constituent item""" - if type(item) is types.ListType: - return map(simplify, item) - elif type(item) == types.TupleType and len(item) == 2: - return simplify(item[1]) - else: - return item - - -# Here follows the aete resource decoder. -# It is presented bottom-up instead of top-down because there are direct -# references to the lower-level part-decoders from the high-level part-decoders. - -def getbyte(f, *args): - c = f.read(1) - if not c: - raise EOFError, 'in getbyte' + str(args) - return ord(c) - -def getword(f, *args): - getalign(f) - s = f.read(2) - if len(s) < 2: - raise EOFError, 'in getword' + str(args) - return (ord(s[0])<<8) | ord(s[1]) - -def getlong(f, *args): - getalign(f) - s = f.read(4) - if len(s) < 4: - raise EOFError, 'in getlong' + str(args) - return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) - -def getostype(f, *args): - getalign(f) - s = f.read(4) - if len(s) < 4: - raise EOFError, 'in getostype' + str(args) - return s - -def getpstr(f, *args): - c = f.read(1) - if len(c) < 1: - raise EOFError, 'in getpstr[1]' + str(args) - nbytes = ord(c) - if nbytes == 0: return '' - s = f.read(nbytes) - if len(s) < nbytes: - raise EOFError, 'in getpstr[2]' + str(args) - return s - -def getalign(f): - if f.tell() & 1: - c = f.read(1) - ##if c <> '\0': - ## print align:', repr(c) - -def getlist(f, description, getitem): - count = getword(f) - list = [] - for i in range(count): - list.append(generic(getitem, f)) - getalign(f) - return list - -def alt_generic(what, f, *args): - print "generic", repr(what), args - res = vageneric(what, f, args) - print '->', repr(res) - return res - -def generic(what, f, *args): - if type(what) == types.FunctionType: - return apply(what, (f,) + args) - if type(what) == types.ListType: - record = [] - for thing in what: - item = apply(generic, thing[:1] + (f,) + thing[1:]) - record.append((thing[1], item)) - return record - return "BAD GENERIC ARGS: %r" % (what,) - -getdata = [ - (getostype, "type"), - (getpstr, "description"), - (getword, "flags") - ] -getargument = [ - (getpstr, "name"), - (getostype, "keyword"), - (getdata, "what") - ] -getevent = [ - (getpstr, "name"), - (getpstr, "description"), - (getostype, "suite code"), - (getostype, "event code"), - (getdata, "returns"), - (getdata, "accepts"), - (getlist, "optional arguments", getargument) - ] -getproperty = [ - (getpstr, "name"), - (getostype, "code"), - (getdata, "what") - ] -getelement = [ - (getostype, "type"), - (getlist, "keyform", getostype) - ] -getclass = [ - (getpstr, "name"), - (getostype, "class code"), - (getpstr, "description"), - (getlist, "properties", getproperty), - (getlist, "elements", getelement) - ] -getcomparison = [ - (getpstr, "operator name"), - (getostype, "operator ID"), - (getpstr, "operator comment"), - ] -getenumerator = [ - (getpstr, "enumerator name"), - (getostype, "enumerator ID"), - (getpstr, "enumerator comment") - ] -getenumeration = [ - (getostype, "enumeration ID"), - (getlist, "enumerator", getenumerator) - ] -getsuite = [ - (getpstr, "suite name"), - (getpstr, "suite description"), - (getostype, "suite ID"), - (getword, "suite level"), - (getword, "suite version"), - (getlist, "events", getevent), - (getlist, "classes", getclass), - (getlist, "comparisons", getcomparison), - (getlist, "enumerations", getenumeration) - ] -getaete = [ - (getword, "major/minor version in BCD"), - (getword, "language code"), - (getword, "script code"), - (getlist, "suites", getsuite) - ] - -def compileaete(aete, resinfo, fname, output=None, basepkgname=None, - edit_modnames=None, creatorsignature=None, verbose=None): - """Generate code for a full aete resource. fname passed for doc purposes""" - [version, language, script, suites] = aete - major, minor = divmod(version, 256) - if not creatorsignature: - creatorsignature, dummy = MacOS.GetCreatorAndType(fname) - packagename = identify(os.path.splitext(os.path.basename(fname))[0]) - if language: - packagename = packagename+'_lang%d'%language - if script: - packagename = packagename+'_script%d'%script - if len(packagename) > 27: - packagename = packagename[:27] - if output: - # XXXX Put this in site-packages if it isn't a full pathname? - if not os.path.exists(output): - os.mkdir(output) - pathname = output - else: - pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, - defaultLocation=DEFAULT_USER_PACKAGEFOLDER) - output = pathname - if not pathname: - return - packagename = os.path.split(os.path.normpath(pathname))[1] - if not basepkgname: - basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)', - defaultLocation=DEFAULT_STANDARD_PACKAGEFOLDER) - if basepkgname: - dirname, basepkgname = os.path.split(os.path.normpath(basepkgname)) - if dirname and not dirname in sys.path: - sys.path.insert(0, dirname) - basepackage = __import__(basepkgname) - else: - basepackage = None - suitelist = [] - allprecompinfo = [] - allsuites = [] - for suite in suites: - compiler = SuiteCompiler(suite, basepackage, output, edit_modnames, verbose) - code, modname, precompinfo = compiler.precompilesuite() - if not code: - continue - allprecompinfo = allprecompinfo + precompinfo - suiteinfo = suite, pathname, modname - suitelist.append((code, modname)) - allsuites.append(compiler) - for compiler in allsuites: - compiler.compilesuite(major, minor, language, script, fname, allprecompinfo) - initfilename = os.path.join(output, '__init__.py') - fp = open(initfilename, 'w') - MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT') - fp.write('"""\n') - fp.write("Package generated from %s\n"%ascii(fname)) - if resinfo: - fp.write("Resource %s resid %d %s\n"%(ascii(resinfo[1]), resinfo[0], ascii(resinfo[2]))) - fp.write('"""\n') - fp.write('import aetools\n') - fp.write('Error = aetools.Error\n') - suitelist.sort() - for code, modname in suitelist: - fp.write("import %s\n" % modname) - fp.write("\n\n_code_to_module = {\n") - for code, modname in suitelist: - fp.write(" '%s' : %s,\n"%(ascii(code), modname)) - fp.write("}\n\n") - fp.write("\n\n_code_to_fullname = {\n") - for code, modname in suitelist: - fp.write(" '%s' : ('%s.%s', '%s'),\n"%(ascii(code), packagename, modname, modname)) - fp.write("}\n\n") - for code, modname in suitelist: - fp.write("from %s import *\n"%modname) - - # Generate property dicts and element dicts for all types declared in this module - fp.write("\ndef getbaseclasses(v):\n") - fp.write(" if not getattr(v, '_propdict', None):\n") - fp.write(" v._propdict = {}\n") - fp.write(" v._elemdict = {}\n") - fp.write(" for superclassname in getattr(v, '_superclassnames', []):\n") - fp.write(" superclass = eval(superclassname)\n") - fp.write(" getbaseclasses(superclass)\n") - fp.write(" v._propdict.update(getattr(superclass, '_propdict', {}))\n") - fp.write(" v._elemdict.update(getattr(superclass, '_elemdict', {}))\n") - fp.write(" v._propdict.update(getattr(v, '_privpropdict', {}))\n") - fp.write(" v._elemdict.update(getattr(v, '_privelemdict', {}))\n") - fp.write("\n") - fp.write("import StdSuites\n") - allprecompinfo.sort() - if allprecompinfo: - fp.write("\n#\n# Set property and element dictionaries now that all classes have been defined\n#\n") - for codenamemapper in allprecompinfo: - for k, v in codenamemapper.getall('class'): - fp.write("getbaseclasses(%s)\n" % v) - - # Generate a code-to-name mapper for all of the types (classes) declared in this module - application_class = None - if allprecompinfo: - fp.write("\n#\n# Indices of types declared in this module\n#\n") - fp.write("_classdeclarations = {\n") - for codenamemapper in allprecompinfo: - for k, v in codenamemapper.getall('class'): - fp.write(" %r : %s,\n" % (k, v)) - if k == 'capp': - application_class = v - fp.write("}\n") - - - if suitelist: - fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1])) - for code, modname in suitelist[1:]: - fp.write(",\n %s_Events"%modname) - fp.write(",\n aetools.TalkTo):\n") - fp.write(" _signature = %r\n\n"%(creatorsignature,)) - fp.write(" _moduleName = '%s'\n\n"%packagename) - if application_class: - fp.write(" _elemdict = %s._elemdict\n" % application_class) - fp.write(" _propdict = %s._propdict\n" % application_class) - fp.close() - -class SuiteCompiler: - def __init__(self, suite, basepackage, output, edit_modnames, verbose): - self.suite = suite - self.basepackage = basepackage - self.edit_modnames = edit_modnames - self.output = output - self.verbose = verbose - - # Set by precompilesuite - self.pathname = None - self.modname = None - - # Set by compilesuite - self.fp = None - self.basemodule = None - self.enumsneeded = {} - - def precompilesuite(self): - """Parse a single suite without generating the output. This step is needed - so we can resolve recursive references by suites to enums/comps/etc declared - in other suites""" - [name, desc, code, level, version, events, classes, comps, enums] = self.suite - - modname = identify(name) - if len(modname) > 28: - modname = modname[:27] - if self.edit_modnames is None: - self.pathname = EasyDialogs.AskFileForSave(message='Python output file', - savedFileName=modname+'.py') - else: - for old, new in self.edit_modnames: - if old == modname: - modname = new - if modname: - self.pathname = os.path.join(self.output, modname + '.py') - else: - self.pathname = None - if not self.pathname: - return None, None, None - - self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0] - - if self.basepackage and self.basepackage._code_to_module.has_key(code): - # We are an extension of a baseclass (usually an application extending - # Standard_Suite or so). Import everything from our base module - basemodule = self.basepackage._code_to_module[code] - else: - # We are not an extension. - basemodule = None - - self.enumsneeded = {} - for event in events: - self.findenumsinevent(event) - - objc = ObjectCompiler(None, self.modname, basemodule, interact=(self.edit_modnames is None), - verbose=self.verbose) - for cls in classes: - objc.compileclass(cls) - for cls in classes: - objc.fillclasspropsandelems(cls) - for comp in comps: - objc.compilecomparison(comp) - for enum in enums: - objc.compileenumeration(enum) - - for enum in self.enumsneeded.keys(): - objc.checkforenum(enum) - - objc.dumpindex() - - precompinfo = objc.getprecompinfo(self.modname) - - return code, self.modname, precompinfo - - def compilesuite(self, major, minor, language, script, fname, precompinfo): - """Generate code for a single suite""" - [name, desc, code, level, version, events, classes, comps, enums] = self.suite - # Sort various lists, so re-generated source is easier compared - def class_sorter(k1, k2): - """Sort classes by code, and make sure main class sorts before synonyms""" - # [name, code, desc, properties, elements] = cls - if k1[1] < k2[1]: return -1 - if k1[1] > k2[1]: return 1 - if not k2[3] or k2[3][0][1] == 'c@#!': - # This is a synonym, the other one is better - return -1 - if not k1[3] or k1[3][0][1] == 'c@#!': - # This is a synonym, the other one is better - return 1 - return 0 - - events.sort() - classes.sort(class_sorter) - comps.sort() - enums.sort() - - self.fp = fp = open(self.pathname, 'w') - MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT') - - fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) - fp.write("Level %d, version %d\n\n" % (level, version)) - fp.write("Generated from %s\n"%ascii(fname)) - fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ - (major, minor, language, script)) - fp.write('"""\n\n') - - fp.write('import aetools\n') - fp.write('import MacOS\n\n') - fp.write("_code = %r\n\n"% (code,)) - if self.basepackage and self.basepackage._code_to_module.has_key(code): - # We are an extension of a baseclass (usually an application extending - # Standard_Suite or so). Import everything from our base module - fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0]) - basemodule = self.basepackage._code_to_module[code] - elif self.basepackage and self.basepackage._code_to_module.has_key(code.lower()): - # This is needed by CodeWarrior and some others. - fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0]) - basemodule = self.basepackage._code_to_module[code.lower()] - else: - # We are not an extension. - basemodule = None - self.basemodule = basemodule - self.compileclassheader() - - self.enumsneeded = {} - if events: - for event in events: - self.compileevent(event) - else: - fp.write(" pass\n\n") - - objc = ObjectCompiler(fp, self.modname, basemodule, precompinfo, interact=(self.edit_modnames is None), - verbose=self.verbose) - for cls in classes: - objc.compileclass(cls) - for cls in classes: - objc.fillclasspropsandelems(cls) - for comp in comps: - objc.compilecomparison(comp) - for enum in enums: - objc.compileenumeration(enum) - - for enum in self.enumsneeded.keys(): - objc.checkforenum(enum) - - objc.dumpindex() - - def compileclassheader(self): - """Generate class boilerplate""" - classname = '%s_Events'%self.modname - if self.basemodule: - modshortname = string.split(self.basemodule.__name__, '.')[-1] - baseclassname = '%s_Events'%modshortname - self.fp.write("class %s(%s):\n\n"%(classname, baseclassname)) - else: - self.fp.write("class %s:\n\n"%classname) - - def compileevent(self, event): - """Generate code for a single event""" - [name, desc, code, subcode, returns, accepts, arguments] = event - fp = self.fp - funcname = identify(name) - # - # generate name->keyword map - # - if arguments: - fp.write(" _argmap_%s = {\n"%funcname) - for a in arguments: - fp.write(" %r : %r,\n"%(identify(a[0]), a[1])) - fp.write(" }\n\n") - - # - # Generate function header - # - has_arg = (not is_null(accepts)) - opt_arg = (has_arg and is_optional(accepts)) - - fp.write(" def %s(self, "%funcname) - if has_arg: - if not opt_arg: - fp.write("_object, ") # Include direct object, if it has one - else: - fp.write("_object=None, ") # Also include if it is optional - else: - fp.write("_no_object=None, ") # For argument checking - fp.write("_attributes={}, **_arguments):\n") # include attribute dict and args - # - # Generate doc string (important, since it may be the only - # available documentation, due to our name-remaping) - # - fp.write(' """%s: %s\n'%(ascii(name), ascii(desc))) - if has_arg: - fp.write(" Required argument: %s\n"%getdatadoc(accepts)) - elif opt_arg: - fp.write(" Optional argument: %s\n"%getdatadoc(accepts)) - for arg in arguments: - fp.write(" Keyword argument %s: %s\n"%(identify(arg[0]), - getdatadoc(arg[2]))) - fp.write(" Keyword argument _attributes: AppleEvent attribute dictionary\n") - if not is_null(returns): - fp.write(" Returns: %s\n"%getdatadoc(returns)) - fp.write(' """\n') - # - # Fiddle the args so everything ends up in 'arguments' dictionary - # - fp.write(" _code = %r\n"% (code,)) - fp.write(" _subcode = %r\n\n"% (subcode,)) - # - # Do keyword name substitution - # - if arguments: - fp.write(" aetools.keysubst(_arguments, self._argmap_%s)\n"%funcname) - else: - fp.write(" if _arguments: raise TypeError, 'No optional args expected'\n") - # - # Stuff required arg (if there is one) into arguments - # - if has_arg: - fp.write(" _arguments['----'] = _object\n") - elif opt_arg: - fp.write(" if _object:\n") - fp.write(" _arguments['----'] = _object\n") - else: - fp.write(" if _no_object != None: raise TypeError, 'No direct arg expected'\n") - fp.write("\n") - # - # Do enum-name substitution - # - for a in arguments: - if is_enum(a[2]): - kname = a[1] - ename = a[2][0] - if ename <> '****': - fp.write(" aetools.enumsubst(_arguments, %r, _Enum_%s)\n" % - (kname, identify(ename))) - self.enumsneeded[ename] = 1 - fp.write("\n") - # - # Do the transaction - # - fp.write(" _reply, _arguments, _attributes = self.send(_code, _subcode,\n") - fp.write(" _arguments, _attributes)\n") - # - # Error handling - # - fp.write(" if _arguments.get('errn', 0):\n") - fp.write(" raise aetools.Error, aetools.decodeerror(_arguments)\n") - fp.write(" # XXXX Optionally decode result\n") - # - # Decode result - # - fp.write(" if _arguments.has_key('----'):\n") - if is_enum(returns): - fp.write(" # XXXX Should do enum remapping here...\n") - fp.write(" return _arguments['----']\n") - fp.write("\n") - - def findenumsinevent(self, event): - """Find all enums for a single event""" - [name, desc, code, subcode, returns, accepts, arguments] = event - for a in arguments: - if is_enum(a[2]): - ename = a[2][0] - if ename <> '****': - self.enumsneeded[ename] = 1 - -# -# This class stores the code<->name translations for a single module. It is used -# to keep the information while we're compiling the module, but we also keep these objects -# around so if one suite refers to, say, an enum in another suite we know where to -# find it. Finally, if we really can't find a code, the user can add modules by -# hand. -# -class CodeNameMapper: - - def __init__(self, interact=1, verbose=None): - self.code2name = { - "property" : {}, - "class" : {}, - "enum" : {}, - "comparison" : {}, - } - self.name2code = { - "property" : {}, - "class" : {}, - "enum" : {}, - "comparison" : {}, - } - self.modulename = None - self.star_imported = 0 - self.can_interact = interact - self.verbose = verbose - - def addnamecode(self, type, name, code): - self.name2code[type][name] = code - if not self.code2name[type].has_key(code): - self.code2name[type][code] = name - - def hasname(self, name): - for dict in self.name2code.values(): - if dict.has_key(name): - return True - return False - - def hascode(self, type, code): - return self.code2name[type].has_key(code) - - def findcodename(self, type, code): - if not self.hascode(type, code): - return None, None, None - name = self.code2name[type][code] - if self.modulename and not self.star_imported: - qualname = '%s.%s'%(self.modulename, name) - else: - qualname = name - return name, qualname, self.modulename - - def getall(self, type): - return self.code2name[type].items() - - def addmodule(self, module, name, star_imported): - self.modulename = name - self.star_imported = star_imported - for code, name in module._propdeclarations.items(): - self.addnamecode('property', name, code) - for code, name in module._classdeclarations.items(): - self.addnamecode('class', name, code) - for code in module._enumdeclarations.keys(): - self.addnamecode('enum', '_Enum_'+identify(code), code) - for code, name in module._compdeclarations.items(): - self.addnamecode('comparison', name, code) - - def prepareforexport(self, name=None): - if not self.modulename: - self.modulename = name - return self - -class ObjectCompiler: - def __init__(self, fp, modname, basesuite, othernamemappers=None, interact=1, - verbose=None): - self.fp = fp - self.verbose = verbose - self.basesuite = basesuite - self.can_interact = interact - self.modulename = modname - self.namemappers = [CodeNameMapper(self.can_interact, self.verbose)] - if othernamemappers: - self.othernamemappers = othernamemappers[:] - else: - self.othernamemappers = [] - if basesuite: - basemapper = CodeNameMapper(self.can_interact, self.verbose) - basemapper.addmodule(basesuite, '', 1) - self.namemappers.append(basemapper) - - def getprecompinfo(self, modname): - list = [] - for mapper in self.namemappers: - emapper = mapper.prepareforexport(modname) - if emapper: - list.append(emapper) - return list - - def findcodename(self, type, code): - while 1: - # First try: check whether we already know about this code. - for mapper in self.namemappers: - if mapper.hascode(type, code): - return mapper.findcodename(type, code) - # Second try: maybe one of the other modules knows about it. - for mapper in self.othernamemappers: - if mapper.hascode(type, code): - self.othernamemappers.remove(mapper) - self.namemappers.append(mapper) - if self.fp: - self.fp.write("import %s\n"%mapper.modulename) - break - else: - # If all this has failed we ask the user for a guess on where it could - # be and retry. - if self.fp: - m = self.askdefinitionmodule(type, code) - else: - m = None - if not m: return None, None, None - mapper = CodeNameMapper(self.can_interact, self.verbose) - mapper.addmodule(m, m.__name__, 0) - self.namemappers.append(mapper) - - def hasname(self, name): - for mapper in self.othernamemappers: - if mapper.hasname(name) and mapper.modulename != self.modulename: - if self.verbose: - print >>self.verbose, "Duplicate Python identifier:", name, self.modulename, mapper.modulename - return True - return False - - def askdefinitionmodule(self, type, code): - if not self.can_interact: - if self.verbose: - print >>self.verbose, "** No definition for %s '%s' found" % (type, code) - return None - path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) - if not path: return - path, file = os.path.split(path) - modname = os.path.splitext(file)[0] - if not path in sys.path: - sys.path.insert(0, path) - m = __import__(modname) - self.fp.write("import %s\n"%modname) - return m - - def compileclass(self, cls): - [name, code, desc, properties, elements] = cls - pname = identify(name) - if self.namemappers[0].hascode('class', code): - # plural forms and such - othername, dummy, dummy = self.namemappers[0].findcodename('class', code) - if self.fp: - self.fp.write("\n%s = %s\n"%(pname, othername)) - else: - if self.fp: - self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname) - self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(desc))) - self.fp.write(' want = %r\n' % (code,)) - self.namemappers[0].addnamecode('class', pname, code) - is_application_class = (code == 'capp') - properties.sort() - for prop in properties: - self.compileproperty(prop, is_application_class) - elements.sort() - for elem in elements: - self.compileelement(elem) - - def compileproperty(self, prop, is_application_class=False): - [name, code, what] = prop - if code == 'c@#!': - # Something silly with plurals. Skip it. - return - pname = identify(name) - if self.namemappers[0].hascode('property', code): - # plural forms and such - othername, dummy, dummy = self.namemappers[0].findcodename('property', code) - if pname == othername: - return - if self.fp: - self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername)) - else: - if self.fp: - self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname) - self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(what[1]))) - self.fp.write(" which = %r\n" % (code,)) - self.fp.write(" want = %r\n" % (what[0],)) - self.namemappers[0].addnamecode('property', pname, code) - if is_application_class and self.fp: - self.fp.write("%s = _Prop_%s()\n" % (pname, pname)) - - def compileelement(self, elem): - [code, keyform] = elem - if self.fp: - self.fp.write("# element %r as %s\n" % (code, keyform)) - - def fillclasspropsandelems(self, cls): - [name, code, desc, properties, elements] = cls - cname = identify(name) - if self.namemappers[0].hascode('class', code) and \ - self.namemappers[0].findcodename('class', code)[0] != cname: - # This is an other name (plural or so) for something else. Skip. - if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and - properties[0][1] != 'c@#!')): - if self.verbose: - print >>self.verbose, '** Skip multiple %s of %s (code %r)' % (cname, self.namemappers[0].findcodename('class', code)[0], code) - raise RuntimeError, "About to skip non-empty class" - return - plist = [] - elist = [] - superclasses = [] - for prop in properties: - [pname, pcode, what] = prop - if pcode == "c@#^": - superclasses.append(what) - if pcode == 'c@#!': - continue - pname = identify(pname) - plist.append(pname) - - superclassnames = [] - for superclass in superclasses: - superId, superDesc, dummy = superclass - superclassname, fullyqualifiedname, module = self.findcodename("class", superId) - # I don't think this is correct: - if superclassname == cname: - pass # superclassnames.append(fullyqualifiedname) - else: - superclassnames.append(superclassname) - - if self.fp: - self.fp.write("%s._superclassnames = %r\n"%(cname, superclassnames)) - - for elem in elements: - [ecode, keyform] = elem - if ecode == 'c@#!': - continue - name, ename, module = self.findcodename('class', ecode) - if not name: - if self.fp: - self.fp.write("# XXXX %s element %r not found!!\n"%(cname, ecode)) - else: - elist.append((name, ename)) - - plist.sort() - elist.sort() - - if self.fp: - self.fp.write("%s._privpropdict = {\n"%cname) - for n in plist: - self.fp.write(" '%s' : _Prop_%s,\n"%(n, n)) - self.fp.write("}\n") - self.fp.write("%s._privelemdict = {\n"%cname) - for n, fulln in elist: - self.fp.write(" '%s' : %s,\n"%(n, fulln)) - self.fp.write("}\n") - - def compilecomparison(self, comp): - [name, code, comment] = comp - iname = identify(name) - self.namemappers[0].addnamecode('comparison', iname, code) - if self.fp: - self.fp.write("class %s(aetools.NComparison):\n" % iname) - self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(comment))) - - def compileenumeration(self, enum): - [code, items] = enum - name = "_Enum_%s" % identify(code) - if self.fp: - self.fp.write("%s = {\n" % name) - for item in items: - self.compileenumerator(item) - self.fp.write("}\n\n") - self.namemappers[0].addnamecode('enum', name, code) - return code - - def compileenumerator(self, item): - [name, code, desc] = item - self.fp.write(" %r : %r,\t# %s\n" % (identify(name), code, ascii(desc))) - - def checkforenum(self, enum): - """This enum code is used by an event. Make sure it's available""" - name, fullname, module = self.findcodename('enum', enum) - if not name: - if self.fp: - self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), ascii(enum))) - return - if module: - if self.fp: - self.fp.write("from %s import %s\n"%(module, name)) - - def dumpindex(self): - if not self.fp: - return - self.fp.write("\n#\n# Indices of types declared in this module\n#\n") - - self.fp.write("_classdeclarations = {\n") - classlist = self.namemappers[0].getall('class') - classlist.sort() - for k, v in classlist: - self.fp.write(" %r : %s,\n" % (k, v)) - self.fp.write("}\n") - - self.fp.write("\n_propdeclarations = {\n") - proplist = self.namemappers[0].getall('property') - proplist.sort() - for k, v in proplist: - self.fp.write(" %r : _Prop_%s,\n" % (k, v)) - self.fp.write("}\n") - - self.fp.write("\n_compdeclarations = {\n") - complist = self.namemappers[0].getall('comparison') - complist.sort() - for k, v in complist: - self.fp.write(" %r : %s,\n" % (k, v)) - self.fp.write("}\n") - - self.fp.write("\n_enumdeclarations = {\n") - enumlist = self.namemappers[0].getall('enum') - enumlist.sort() - for k, v in enumlist: - self.fp.write(" %r : %s,\n" % (k, v)) - self.fp.write("}\n") - -def compiledata(data): - [type, description, flags] = data - return "%r -- %r %s" % (type, description, compiledataflags(flags)) - -def is_null(data): - return data[0] == 'null' - -def is_optional(data): - return (data[2] & 0x8000) - -def is_enum(data): - return (data[2] & 0x2000) - -def getdatadoc(data): - [type, descr, flags] = data - if descr: - return ascii(descr) - if type == '****': - return 'anything' - if type == 'obj ': - return 'an AE object reference' - return "undocumented, typecode %r"%(type,) - -dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} -def compiledataflags(flags): - bits = [] - for i in range(16): - if flags & (1<<i): - if i in dataflagdict.keys(): - bits.append(dataflagdict[i]) - else: - bits.append(repr(i)) - return '[%s]' % string.join(bits) - -def ascii(str): - """Return a string with all non-ascii characters hex-encoded""" - if type(str) != type(''): - return map(ascii, str) - rv = '' - for c in str: - if c in ('\t', '\n', '\r') or ' ' <= c < chr(0x7f): - rv = rv + c - else: - rv = rv + '\\' + 'x%02.2x' % ord(c) - return rv - -def identify(str): - """Turn any string into an identifier: - - replace space by _ - - replace other illegal chars by _xx_ (hex code) - - append _ if the result is a python keyword - """ - if not str: - return "empty_ae_name_" - rv = '' - ok = string.ascii_letters + '_' - ok2 = ok + string.digits - for c in str: - if c in ok: - rv = rv + c - elif c == ' ': - rv = rv + '_' - else: - rv = rv + '_%02.2x_'%ord(c) - ok = ok2 - if keyword.iskeyword(rv): - rv = rv + '_' - return rv - -# Call the main program - -if __name__ == '__main__': - main() - sys.exit(1) diff --git a/sys/lib/python/plat-mac/ic.py b/sys/lib/python/plat-mac/ic.py deleted file mode 100644 index 6575336af..000000000 --- a/sys/lib/python/plat-mac/ic.py +++ /dev/null @@ -1,268 +0,0 @@ -"""IC wrapper module, based on Internet Config 1.3""" - -import icglue -import string -import sys -import os -from Carbon import Res -import Carbon.File -import macostools - -error=icglue.error - -# From ictypes.h: -icPrefNotFoundErr = -666 # preference not found (duh!) -icPermErr = -667 # cannot set preference -icPrefDataErr = -668 # problem with preference data -icInternalErr = -669 # hmm, this is not good -icTruncatedErr = -670 # more data was present than was returned -icNoMoreWritersErr = -671 # you cannot begin a write session because someone else is already doing it */ -icNothingToOverrideErr = -672 # no component for the override component to capture -icNoURLErr = -673 # no URL found -icConfigNotFoundErr = -674 # no configuration was found -icConfigInappropriateErr = -675 # incorrect manufacturer code - -ICattr_no_change = -1 - -icNoPerm = 0 -icReadOnlyPerm = 1 -icReadWritePerm = 2 -# End of ictypes.h - -class ICOpaqueData: - """An unparseable IC entry""" - def __init__(self, data): - self.data = data - - def __repr__(self): - return "ICOpaqueData(%r)"%(self.data,) - -_ICOpaqueDataType=type(ICOpaqueData('')) - -def _decode_default(data, key): - if len(data) == 0: - return data - if ord(data[0]) == len(data)-1: - # Assume Pstring - return data[1:] - return ICOpaqueData(data) - - -def _decode_multistr(data, key): - numstr = ord(data[0]) << 8 | ord(data[1]) - rv = [] - ptr = 2 - for i in range(numstr): - strlen = ord(data[ptr]) - str = data[ptr+1:ptr+strlen+1] - rv.append(str) - ptr = ptr + strlen + 1 - return rv - -def _decode_fontrecord(data, key): - size = ord(data[0]) << 8 | ord(data[1]) - face = ord(data[2]) - namelen = ord(data[4]) - return size, face, data[5:5+namelen] - -def _decode_boolean(data, key): - return ord(data[0]) - -def _decode_text(data, key): - return data - -def _decode_charset(data, key): - return data[:256], data[256:] - -def _decode_appspec(data, key): - namelen = ord(data[4]) - return data[0:4], data[5:5+namelen] - -def _code_default(data, key): - return chr(len(data)) + data - -def _code_multistr(data, key): - numstr = len(data) - rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) - for i in data: - rv = rv + _code_default(i) - return rv - -def _code_fontrecord(data, key): - size, face, name = data - return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ - chr(0) + _code_default(name) - -def _code_boolean(data, key): - print 'XXXX boolean:', repr(data) - return chr(data) - -def _code_text(data, key): - return data - -def _code_charset(data, key): - return data[0] + data[1] - -def _code_appspec(data, key): - return data[0] + _code_default(data[1]) - -_decoder_table = { - "ArchieAll" : (_decode_multistr , _code_multistr), - "UMichAll" : (_decode_multistr , _code_multistr), - "InfoMacAll" : (_decode_multistr , _code_multistr), - "ListFont" : (_decode_fontrecord , _code_fontrecord), - "ScreenFont" : (_decode_fontrecord , _code_fontrecord), - "PrinterFont" : (_decode_fontrecord , _code_fontrecord), -# "DownloadFolder" : (_decode_filespec , _code_filespec), - "Signature": (_decode_text , _code_text), - "Plan" : (_decode_text , _code_text), - "MailHeaders" : (_decode_text , _code_text), - "NewsHeaders" : (_decode_text , _code_text), -# "Mapping" - "CharacterSet" : (_decode_charset , _code_charset), - "Helper\245" : (_decode_appspec , _code_appspec), -# "Services" : (_decode_services, ????), - "NewMailFlashIcon" : (_decode_boolean , _code_boolean), - "NewMailDialog" : (_decode_boolean , _code_boolean), - "NewMailPlaySound" : (_decode_boolean , _code_boolean), -# "WebBackgroundColor" : _decode_color, - "NoProxyDomains" : (_decode_multistr , _code_multistr), - "UseHTTPProxy" : (_decode_boolean , _code_boolean), - "UseGopherProxy": (_decode_boolean , _code_boolean), - "UseFTPProxy" : (_decode_boolean , _code_boolean), - "UsePassiveFTP" : (_decode_boolean , _code_boolean), -} - -def _decode(data, key): - if '\245' in key: - key2 = key[:string.index(key, '\245')+1] - else: - key2 = key - if _decoder_table.has_key(key2): - decoder = _decoder_table[key2][0] - else: - decoder = _decode_default - return decoder(data, key) - -def _code(data, key): - if type(data) == _ICOpaqueDataType: - return data.data - if '\245' in key: - key2 = key[:string.index(key, '\245')+1] - else: - key2 = key - if _decoder_table.has_key(key2): - coder = _decoder_table[key2][1] - else: - coder = _code_default - return coder(data, key) - -class IC: - def __init__(self, signature='Pyth', ic=None): - if ic: - self.ic = ic - else: - self.ic = icglue.ICStart(signature) - if hasattr(self.ic, 'ICFindConfigFile'): - self.ic.ICFindConfigFile() - self.h = Res.Resource('') - - def keys(self): - rv = [] - self.ic.ICBegin(icReadOnlyPerm) - num = self.ic.ICCountPref() - for i in range(num): - rv.append(self.ic.ICGetIndPref(i+1)) - self.ic.ICEnd() - return rv - - def has_key(self, key): - return self.__contains__(key) - - def __contains__(self, key): - try: - dummy = self.ic.ICFindPrefHandle(key, self.h) - except icglue.error: - return 0 - return 1 - - def __getitem__(self, key): - attr = self.ic.ICFindPrefHandle(key, self.h) - return _decode(self.h.data, key) - - def __setitem__(self, key, value): - value = _code(value, key) - self.ic.ICSetPref(key, ICattr_no_change, value) - - def launchurl(self, url, hint=""): - # Work around a bug in ICLaunchURL: file:/foo does - # not work but file:///foo does. - if url[:6] == 'file:/' and url[6] != '/': - url = 'file:///' + url[6:] - self.ic.ICLaunchURL(hint, url, 0, len(url)) - - def parseurl(self, data, start=None, end=None, hint=""): - if start == None: - selStart = 0 - selEnd = len(data) - else: - selStart = selEnd = start - if end != None: - selEnd = end - selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) - return self.h.data, selStart, selEnd - - def mapfile(self, file): - if type(file) != type(''): - file = file.as_tuple()[2] - return self.ic.ICMapFilename(file) - - def maptypecreator(self, type, creator, filename=""): - return self.ic.ICMapTypeCreator(type, creator, filename) - - def settypecreator(self, file): - file = Carbon.File.pathname(file) - record = self.mapfile(os.path.split(file)[1]) - MacOS.SetCreatorAndType(file, record[2], record[1]) - macostools.touched(fss) - -# Convenience routines -_dft_ic = None - -def launchurl(url, hint=""): - global _dft_ic - if _dft_ic == None: _dft_ic = IC() - return _dft_ic.launchurl(url, hint) - -def parseurl(data, start=None, end=None, hint=""): - global _dft_ic - if _dft_ic == None: _dft_ic = IC() - return _dft_ic.parseurl(data, start, end, hint) - -def mapfile(filename): - global _dft_ic - if _dft_ic == None: _dft_ic = IC() - return _dft_ic.mapfile(filename) - -def maptypecreator(type, creator, filename=""): - global _dft_ic - if _dft_ic == None: _dft_ic = IC() - return _dft_ic.maptypecreator(type, creator, filename) - -def settypecreator(file): - global _dft_ic - if _dft_ic == None: _dft_ic = IC() - return _dft_ic.settypecreator(file) - -def _test(): - ic = IC() - for k in ic.keys(): - try: - v = ic[k] - except error: - v = '????' - print k, '\t', v - sys.exit(1) - -if __name__ == '__main__': - _test() diff --git a/sys/lib/python/plat-mac/icopen.py b/sys/lib/python/plat-mac/icopen.py deleted file mode 100644 index eea608379..000000000 --- a/sys/lib/python/plat-mac/icopen.py +++ /dev/null @@ -1,66 +0,0 @@ -"""icopen patch - -OVERVIEW - -icopen patches MacOS Python to use the Internet Config file mappings to select -the type and creator for a file. - -Version 1 released to the public domain 3 November 1999 -by Oliver Steele (steele@cs.brandeis.edu). - -DETAILS - -This patch causes files created by Python's open(filename, 'w') command (and -by functions and scripts that call it) to set the type and creator of the file -to the type and creator associated with filename's extension (the -portion of the filename after the last period), according to Internet Config. -Thus, a script that creates a file foo.html will create one that opens in whatever -browser you've set to handle *.html files, and so on. - -Python IDE uses its own algorithm to select the type and creator for saved -editor windows, so this patch won't effect their types. - -As of System 8.6 at least, Internet Config is built into the system, and the -file mappings are accessed from the Advanced pane of the Internet control -panel. User Mode (in the Edit menu) needs to be set to Advanced in order to -access this pane. - -INSTALLATION - -Put this file in your Python path, and create a file named {Python}:sitecustomize.py -that contains: - import icopen - -(If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.) - -The next time you launch PythonInterpreter or Python IDE, the patch will take -effect. -""" - -import __builtin__ - -_builtin_open = globals().get('_builtin_open', __builtin__.open) - -def _open_with_typer(*args): - file = _builtin_open(*args) - filename = args[0] - mode = 'r' - if args[1:]: - mode = args[1] - if mode[0] == 'w': - from ic import error, settypecreator - try: - settypecreator(filename) - except error: - pass - return file - -__builtin__.open = _open_with_typer - -""" -open('test.py') -_open_with_typer('test.py', 'w') -_open_with_typer('test.txt', 'w') -_open_with_typer('test.html', 'w') -_open_with_typer('test.foo', 'w') -""" diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py deleted file mode 100644 index 0fd562b95..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py +++ /dev/null @@ -1,682 +0,0 @@ -"""Suite CodeWarrior suite: Terms for scripting the CodeWarrior IDE -Level 0, version 0 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'CWIE' - -class CodeWarrior_suite_Events: - - _argmap_add = { - 'new' : 'kocl', - 'with_data' : 'data', - 'to_targets' : 'TTGT', - 'to_group' : 'TGRP', - } - - def add(self, _object, _attributes={}, **_arguments): - """add: add elements to a project or target - Required argument: an AE object reference - Keyword argument new: the class of the new element or elements to add - Keyword argument with_data: the initial data for the element or elements - Keyword argument to_targets: the targets to which the new element or elements will be added - Keyword argument to_group: the group to which the new element or elements will be added - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'ADDF' - - aetools.keysubst(_arguments, self._argmap_add) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def build(self, _no_object=None, _attributes={}, **_arguments): - """build: build a project or target (equivalent of the Make menu command) - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'MAKE' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def check(self, _object=None, _attributes={}, **_arguments): - """check: check the syntax of a file in a project or target - Required argument: the file or files to be checked - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'CHEK' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def compile_file(self, _object=None, _attributes={}, **_arguments): - """compile file: compile a file in a project or target - Required argument: the file or files to be compiled - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'COMP' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def disassemble_file(self, _object=None, _attributes={}, **_arguments): - """disassemble file: disassemble a file in a project or target - Required argument: the file or files to be disassembled - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'DASM' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_export = { - 'in_' : 'kfil', - } - - def export(self, _no_object=None, _attributes={}, **_arguments): - """export: Export the project file as an XML file - Keyword argument in_: the XML file in which to export the project - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'EXPT' - - aetools.keysubst(_arguments, self._argmap_export) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def remove_object_code(self, _no_object=None, _attributes={}, **_arguments): - """remove object code: remove object code from a project or target - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'RMOB' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def remove_target_files(self, _object, _attributes={}, **_arguments): - """remove target files: remove files from a target - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'RMFL' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run_target(self, _no_object=None, _attributes={}, **_arguments): - """run target: run a project or target - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'RUN ' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def touch_file(self, _object=None, _attributes={}, **_arguments): - """touch file: touch a file in a project or target for compilation - Required argument: the file or files to be touched - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'TOCH' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def update(self, _no_object=None, _attributes={}, **_arguments): - """update: bring a project or target up to date - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'CWIE' - _subcode = 'UP2D' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class single_class_browser(aetools.ComponentItem): - """single class browser - a single class browser """ - want = '1BRW' -class _Prop_inherits(aetools.NProperty): - """inherits - all properties and elements of the given class are inherited by this class. """ - which = 'c@#^' - want = 'TXTD' - -single_class_browsers = single_class_browser - -class single_class_hierarchy(aetools.ComponentItem): - """single class hierarchy - a single class hierarchy document """ - want = '1HIR' - -single_class_hierarchies = single_class_hierarchy - -class class_browser(aetools.ComponentItem): - """class browser - a class browser """ - want = 'BROW' - -class_browsers = class_browser - -class file_compare_document(aetools.ComponentItem): - """file compare document - a file compare document """ - want = 'COMP' - -file_compare_documents = file_compare_document - -class catalog_document(aetools.ComponentItem): - """catalog document - a browser catalog document """ - want = 'CTLG' - -catalog_documents = catalog_document - -class editor_document(aetools.ComponentItem): - """editor document - an editor document """ - want = 'EDIT' - -editor_documents = editor_document - -class class_hierarchy(aetools.ComponentItem): - """class hierarchy - a class hierarchy document """ - want = 'HIER' - -class_hierarchies = class_hierarchy - -class project_inspector(aetools.ComponentItem): - """project inspector - the project inspector """ - want = 'INSP' - -project_inspectors = project_inspector - -class message_document(aetools.ComponentItem): - """message document - a message document """ - want = 'MSSG' - -message_documents = message_document - -class build_progress_document(aetools.ComponentItem): - """build progress document - a build progress document """ - want = 'PRGS' - -build_progress_documents = build_progress_document - -class project_document(aetools.ComponentItem): - """project document - a project document """ - want = 'PRJD' -class _Prop_current_target(aetools.NProperty): - """current target - the current target """ - which = 'CURT' - want = 'TRGT' -# element 'TRGT' as ['indx', 'name', 'test', 'rang'] - -project_documents = project_document - -class subtarget(aetools.ComponentItem): - """subtarget - a target that is prerequisite for another target """ - want = 'SBTG' -class _Prop_link_against_output(aetools.NProperty): - """link against output - is the output of this subtarget linked into its dependent target? """ - which = 'LNKO' - want = 'bool' -class _Prop_target(aetools.NProperty): - """target - the target that is dependent on this subtarget """ - which = 'TrgT' - want = 'TRGT' - -subtargets = subtarget - -class target_file(aetools.ComponentItem): - """target file - a source or header file in a target """ - want = 'SRCF' -class _Prop_code_size(aetools.NProperty): - """code size - the size of the code (in bytes) produced by compiling this source file """ - which = 'CSZE' - want = 'long' -class _Prop_compiled_date(aetools.NProperty): - """compiled date - the date and this source file was last compiled """ - which = 'CMPD' - want = 'ldt ' -class _Prop_data_size(aetools.NProperty): - """data size - the size of the date (in bytes) produced by compiling this source file """ - which = 'DSZE' - want = 'long' -class _Prop_debug(aetools.NProperty): - """debug - is debugging information generated for this source file? """ - which = 'DBUG' - want = 'bool' -class _Prop_dependents(aetools.NProperty): - """dependents - the source files that need this source file in order to build """ - which = 'DPND' - want = 'list' -class _Prop_id(aetools.NProperty): - """id - the unique ID number of the target file """ - which = 'ID ' - want = 'long' -class _Prop_init_before(aetools.NProperty): - """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ - which = 'INIT' - want = 'bool' -class _Prop_link_index(aetools.NProperty): - """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ - which = 'LIDX' - want = 'long' -class _Prop_linked(aetools.NProperty): - """linked - is the source file in the link order of its target? """ - which = 'LINK' - want = 'bool' -class _Prop_location(aetools.NProperty): - """location - the location of the target file on disk """ - which = 'FILE' - want = 'fss ' -class _Prop_merge_output(aetools.NProperty): - """merge output - is this shared library merged into another code fragment? """ - which = 'MRGE' - want = 'bool' -class _Prop_modified_date(aetools.NProperty): - """modified date - the date and time this source file was last modified """ - which = 'MODD' - want = 'ldt ' -class _Prop_path(aetools.NProperty): - """path - the path of the source file on disk """ - which = 'Path' - want = 'itxt' -class _Prop_prerequisites(aetools.NProperty): - """prerequisites - the source files needed to build this source file """ - which = 'PRER' - want = 'list' -class _Prop_type(aetools.NProperty): - """type - the type of source file """ - which = 'FTYP' - want = 'FTYP' -class _Prop_weak_link(aetools.NProperty): - """weak link - is this shared library linked weakly? """ - which = 'WEAK' - want = 'bool' - -target_files = target_file - -class symbol_browser(aetools.ComponentItem): - """symbol browser - a symbol browser """ - want = 'SYMB' - -symbol_browsers = symbol_browser - -class ToolServer_worksheet(aetools.ComponentItem): - """ToolServer worksheet - a ToolServer worksheet """ - want = 'TOOL' - -ToolServer_worksheets = ToolServer_worksheet - -class target(aetools.ComponentItem): - """target - a target in a project """ - want = 'TRGT' -class _Prop_name(aetools.NProperty): - """name - """ - which = 'pnam' - want = 'itxt' -class _Prop_project_document(aetools.NProperty): - """project document - the project document that contains this target """ - which = 'PrjD' - want = 'PRJD' -# element 'SBTG' as ['indx', 'test', 'rang'] -# element 'SRCF' as ['indx', 'test', 'rang'] - -targets = target - -class text_document(aetools.ComponentItem): - """text document - a document that contains text """ - want = 'TXTD' -class _Prop_modified(aetools.NProperty): - """modified - Has the document been modified since the last save? """ - which = 'imod' - want = 'bool' -class _Prop_selection(aetools.NProperty): - """selection - the selection visible to the user """ - which = 'sele' - want = 'csel' -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cins' as ['rele'] -# element 'clin' as ['indx', 'rang', 'rele'] -# element 'ctxt' as ['rang'] - -text_documents = text_document -single_class_browser._superclassnames = ['text_document'] -single_class_browser._privpropdict = { - 'inherits' : _Prop_inherits, -} -single_class_browser._privelemdict = { -} -import Standard_Suite -single_class_hierarchy._superclassnames = ['document'] -single_class_hierarchy._privpropdict = { - 'inherits' : _Prop_inherits, -} -single_class_hierarchy._privelemdict = { -} -class_browser._superclassnames = ['text_document'] -class_browser._privpropdict = { - 'inherits' : _Prop_inherits, -} -class_browser._privelemdict = { -} -file_compare_document._superclassnames = ['text_document'] -file_compare_document._privpropdict = { - 'inherits' : _Prop_inherits, -} -file_compare_document._privelemdict = { -} -catalog_document._superclassnames = ['text_document'] -catalog_document._privpropdict = { - 'inherits' : _Prop_inherits, -} -catalog_document._privelemdict = { -} -editor_document._superclassnames = ['text_document'] -editor_document._privpropdict = { - 'inherits' : _Prop_inherits, -} -editor_document._privelemdict = { -} -class_hierarchy._superclassnames = ['document'] -class_hierarchy._privpropdict = { - 'inherits' : _Prop_inherits, -} -class_hierarchy._privelemdict = { -} -project_inspector._superclassnames = ['document'] -project_inspector._privpropdict = { - 'inherits' : _Prop_inherits, -} -project_inspector._privelemdict = { -} -message_document._superclassnames = ['text_document'] -message_document._privpropdict = { - 'inherits' : _Prop_inherits, -} -message_document._privelemdict = { -} -build_progress_document._superclassnames = ['document'] -build_progress_document._privpropdict = { - 'inherits' : _Prop_inherits, -} -build_progress_document._privelemdict = { -} -project_document._superclassnames = ['document'] -project_document._privpropdict = { - 'current_target' : _Prop_current_target, - 'inherits' : _Prop_inherits, -} -project_document._privelemdict = { - 'target' : target, -} -subtarget._superclassnames = ['target'] -subtarget._privpropdict = { - 'inherits' : _Prop_inherits, - 'link_against_output' : _Prop_link_against_output, - 'target' : _Prop_target, -} -subtarget._privelemdict = { -} -target_file._superclassnames = [] -target_file._privpropdict = { - 'code_size' : _Prop_code_size, - 'compiled_date' : _Prop_compiled_date, - 'data_size' : _Prop_data_size, - 'debug' : _Prop_debug, - 'dependents' : _Prop_dependents, - 'id' : _Prop_id, - 'init_before' : _Prop_init_before, - 'link_index' : _Prop_link_index, - 'linked' : _Prop_linked, - 'location' : _Prop_location, - 'merge_output' : _Prop_merge_output, - 'modified_date' : _Prop_modified_date, - 'path' : _Prop_path, - 'prerequisites' : _Prop_prerequisites, - 'type' : _Prop_type, - 'weak_link' : _Prop_weak_link, -} -target_file._privelemdict = { -} -symbol_browser._superclassnames = ['text_document'] -symbol_browser._privpropdict = { - 'inherits' : _Prop_inherits, -} -symbol_browser._privelemdict = { -} -ToolServer_worksheet._superclassnames = ['text_document'] -ToolServer_worksheet._privpropdict = { - 'inherits' : _Prop_inherits, -} -ToolServer_worksheet._privelemdict = { -} -target._superclassnames = [] -target._privpropdict = { - 'name' : _Prop_name, - 'project_document' : _Prop_project_document, -} -target._privelemdict = { - 'subtarget' : subtarget, - 'target_file' : target_file, -} -text_document._superclassnames = ['document'] -text_document._privpropdict = { - 'inherits' : _Prop_inherits, - 'modified' : _Prop_modified, - 'selection' : _Prop_selection, -} -text_document._privelemdict = { - 'character' : Standard_Suite.character, - 'insertion_point' : Standard_Suite.insertion_point, - 'line' : Standard_Suite.line, - 'text' : Standard_Suite.text, -} -_Enum_DKND = { - 'project' : 'PRJD', # a project document - 'editor_document' : 'EDIT', # an editor document - 'message' : 'MSSG', # a message document - 'file_compare' : 'COMP', # a file compare document - 'catalog_document' : 'CTLG', # a browser catalog - 'class_browser' : 'BROW', # a class browser document - 'single_class_browser' : '1BRW', # a single class browser document - 'symbol_browser' : 'SYMB', # a symbol browser document - 'class_hierarchy' : 'HIER', # a class hierarchy document - 'single_class_hierarchy' : '1HIR', # a single class hierarchy document - 'project_inspector' : 'INSP', # a project inspector - 'ToolServer_worksheet' : 'TOOL', # the ToolServer worksheet - 'build_progress_document' : 'PRGS', # the build progress window -} - -_Enum_FTYP = { - 'library_file' : 'LIBF', # a library file - 'project_file' : 'PRJF', # a project file - 'resource_file' : 'RESF', # a resource file - 'text_file' : 'TXTF', # a text file - 'unknown_file' : 'UNKN', # unknown file type -} - -_Enum_Inte = { - 'never_interact' : 'eNvr', # never allow user interactions - 'interact_with_self' : 'eInS', # allow user interaction only when an AppleEvent is sent from within CodeWarrior - 'interact_with_local' : 'eInL', # allow user interaction when AppleEvents are sent from applications on the same machine (default) - 'interact_with_all' : 'eInA', # allow user interaction from both local and remote AppleEvents -} - -_Enum_PERM = { - 'read_write' : 'RdWr', # the file is open with read/write permission - 'read_only' : 'Read', # the file is open with read/only permission - 'checked_out_read_write' : 'CkRW', # the file is checked out with read/write permission - 'checked_out_read_only' : 'CkRO', # the file is checked out with read/only permission - 'checked_out_read_modify' : 'CkRM', # the file is checked out with read/modify permission - 'locked' : 'Lock', # the file is locked on disk - 'none' : 'LNNO', # the file is new -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - '1BRW' : single_class_browser, - '1HIR' : single_class_hierarchy, - 'BROW' : class_browser, - 'COMP' : file_compare_document, - 'CTLG' : catalog_document, - 'EDIT' : editor_document, - 'HIER' : class_hierarchy, - 'INSP' : project_inspector, - 'MSSG' : message_document, - 'PRGS' : build_progress_document, - 'PRJD' : project_document, - 'SBTG' : subtarget, - 'SRCF' : target_file, - 'SYMB' : symbol_browser, - 'TOOL' : ToolServer_worksheet, - 'TRGT' : target, - 'TXTD' : text_document, -} - -_propdeclarations = { - 'CMPD' : _Prop_compiled_date, - 'CSZE' : _Prop_code_size, - 'CURT' : _Prop_current_target, - 'DBUG' : _Prop_debug, - 'DPND' : _Prop_dependents, - 'DSZE' : _Prop_data_size, - 'FILE' : _Prop_location, - 'FTYP' : _Prop_type, - 'ID ' : _Prop_id, - 'INIT' : _Prop_init_before, - 'LIDX' : _Prop_link_index, - 'LINK' : _Prop_linked, - 'LNKO' : _Prop_link_against_output, - 'MODD' : _Prop_modified_date, - 'MRGE' : _Prop_merge_output, - 'PRER' : _Prop_prerequisites, - 'Path' : _Prop_path, - 'PrjD' : _Prop_project_document, - 'TrgT' : _Prop_target, - 'WEAK' : _Prop_weak_link, - 'c@#^' : _Prop_inherits, - 'imod' : _Prop_modified, - 'pnam' : _Prop_name, - 'sele' : _Prop_selection, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'DKND' : _Enum_DKND, - 'FTYP' : _Enum_FTYP, - 'Inte' : _Enum_Inte, - 'PERM' : _Enum_PERM, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py deleted file mode 100644 index 909cdc0fe..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py +++ /dev/null @@ -1,2373 +0,0 @@ -"""Suite Metrowerks Shell Suite: Events supported by the Metrowerks Project Shell -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'MMPR' - -class Metrowerks_Shell_Suite_Events: - - _argmap_Add_Files = { - 'To_Segment' : 'Segm', - } - - def Add_Files(self, _object, _attributes={}, **_arguments): - """Add Files: Add the specified file(s) to the current project - Required argument: List of files to add - Keyword argument To_Segment: Segment number into which to add the file(s) - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Error code for each file added - """ - _code = 'MMPR' - _subcode = 'AddF' - - aetools.keysubst(_arguments, self._argmap_Add_Files) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Check_Syntax = { - 'ExternalEditor' : 'Errs', - } - - def Check_Syntax(self, _object, _attributes={}, **_arguments): - """Check Syntax: Check the syntax of the specified file(s) - Required argument: List of files to check the syntax of - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors for each file whose syntax was checked - """ - _code = 'MMPR' - _subcode = 'Chek' - - aetools.keysubst(_arguments, self._argmap_Check_Syntax) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Close_Project(self, _no_object=None, _attributes={}, **_arguments): - """Close Project: Close the current project - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'ClsP' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Close_Window = { - 'Saving' : 'savo', - } - - def Close_Window(self, _object, _attributes={}, **_arguments): - """Close Window: Close the windows showing the specified files - Required argument: The files to close - Keyword argument Saving: Whether to save changes to each file before closing its window - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'ClsW' - - aetools.keysubst(_arguments, self._argmap_Close_Window) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Compile = { - 'ExternalEditor' : 'Errs', - } - - def Compile(self, _object, _attributes={}, **_arguments): - """Compile: Compile the specified file(s) - Required argument: List of files to compile - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors for each file compiled - """ - _code = 'MMPR' - _subcode = 'Comp' - - aetools.keysubst(_arguments, self._argmap_Compile) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Create_Project = { - 'from_stationery' : 'Tmpl', - } - - def Create_Project(self, _object, _attributes={}, **_arguments): - """Create Project: Create a new project file - Required argument: New project file specifier - Keyword argument from_stationery: undocumented, typecode 'alis' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'NewP' - - aetools.keysubst(_arguments, self._argmap_Create_Project) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_Definition(self, _object, _attributes={}, **_arguments): - """Get Definition: Returns the location(s) of a globally scoped function or data object. - Required argument: undocumented, typecode 'TEXT' - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'FDef' - """ - _code = 'MMPR' - _subcode = 'GDef' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_Open_Documents(self, _no_object=None, _attributes={}, **_arguments): - """Get Open Documents: Returns the list of open documents - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: The list of documents - """ - _code = 'MMPR' - _subcode = 'GDoc' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Get_Preferences = { - 'of' : 'PRec', - 'from_panel' : 'PNam', - } - - def Get_Preferences(self, _no_object=None, _attributes={}, **_arguments): - """Get Preferences: Get the preferences for the current project - Keyword argument of: Names of requested preferences - Keyword argument from_panel: Name of the preference panel - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: The requested preferences - """ - _code = 'MMPR' - _subcode = 'Gref' - - aetools.keysubst(_arguments, self._argmap_Get_Preferences) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Get_Project_File = { - 'Segment' : 'Segm', - } - - def Get_Project_File(self, _object, _attributes={}, **_arguments): - """Get Project File: Returns a description of a file in the project window. - Required argument: The index of the file within its segment. - Keyword argument Segment: The segment containing the file. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'SrcF' - """ - _code = 'MMPR' - _subcode = 'GFil' - - aetools.keysubst(_arguments, self._argmap_Get_Project_File) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_Project_Specifier(self, _no_object=None, _attributes={}, **_arguments): - """Get Project Specifier: Return the File Specifier for the current project - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: File Specifier for the current project - """ - _code = 'MMPR' - _subcode = 'GetP' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_Segments(self, _no_object=None, _attributes={}, **_arguments): - """Get Segments: Returns a description of each segment in the project. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'Seg ' - """ - _code = 'MMPR' - _subcode = 'GSeg' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_member_function_names(self, _object, _attributes={}, **_arguments): - """Get member function names: Returns a list containing the names of all the member functions of a class object - Required argument: must be a class object - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'MMPR' - _subcode = 'MbFN' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_nonsimple_classes(self, _no_object=None, _attributes={}, **_arguments): - """Get nonsimple classes: Returns an alphabetical list of classes with member functions, bases classes, or subclasses - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'MMPR' - _subcode = 'NsCl' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Goto_Function(self, _object, _attributes={}, **_arguments): - """Goto Function: Goto Specified Function Name - Required argument: undocumented, typecode 'TEXT' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'GoFn' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Goto_Line(self, _object, _attributes={}, **_arguments): - """Goto Line: Goto Specified Line Number - Required argument: The requested source file line number - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'GoLn' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Is_In_Project(self, _object, _attributes={}, **_arguments): - """Is In Project: Whether or not the specified file(s) is in the current project - Required argument: List of files to check for project membership - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Result code for each file - """ - _code = 'MMPR' - _subcode = 'FInP' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Make_Project = { - 'ExternalEditor' : 'Errs', - } - - def Make_Project(self, _no_object=None, _attributes={}, **_arguments): - """Make Project: Make the current project - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors that occurred while making the project - """ - _code = 'MMPR' - _subcode = 'Make' - - aetools.keysubst(_arguments, self._argmap_Make_Project) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Open_browser(self, _object, _attributes={}, **_arguments): - """Open browser: Display a class, member function, or data member object in a single class browser window - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'Brow' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Precompile = { - 'Saving_As' : 'Targ', - 'ExternalEditor' : 'Errs', - } - - def Precompile(self, _object, _attributes={}, **_arguments): - """Precompile: Precompile the specified file to the specified destination file - Required argument: File to precompile - Keyword argument Saving_As: Destination file for precompiled header - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors for the precompiled file - """ - _code = 'MMPR' - _subcode = 'PreC' - - aetools.keysubst(_arguments, self._argmap_Precompile) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Preprocess = { - 'ExternalEditor' : 'Errs', - } - - def Preprocess(self, _object, _attributes={}, **_arguments): - """Preprocess: Preprocesses the specified file(s) - Required argument: undocumented, typecode 'alis' - Keyword argument ExternalEditor: undocumented, typecode 'bool' - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors for each preprocessed file - """ - _code = 'MMPR' - _subcode = 'PreP' - - aetools.keysubst(_arguments, self._argmap_Preprocess) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Remove_Binaries(self, _no_object=None, _attributes={}, **_arguments): - """Remove Binaries: Remove the binary object code from the current project - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'RemB' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Remove_Files(self, _object, _attributes={}, **_arguments): - """Remove Files: Remove the specified file(s) from the current project - Required argument: List of files to remove - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Error code for each file removed - """ - _code = 'MMPR' - _subcode = 'RemF' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Reset_File_Paths(self, _no_object=None, _attributes={}, **_arguments): - """Reset File Paths: Resets access paths for all files belonging to open project. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'ReFP' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Run_Project = { - 'ExternalEditor' : 'Errs', - 'SourceDebugger' : 'DeBg', - } - - def Run_Project(self, _no_object=None, _attributes={}, **_arguments): - """Run Project: Run the current project - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument SourceDebugger: Run the application under the control of the source-level debugger - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors that occurred when running the project - """ - _code = 'MMPR' - _subcode = 'RunP' - - aetools.keysubst(_arguments, self._argmap_Run_Project) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Save_Error_Window_As(self, _object, _attributes={}, **_arguments): - """Save Error Window As: Saves the Errors & Warnings window as a text file - Required argument: Destination file for Save Message Window As - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'SvMs' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Set_Current_Target(self, _object=None, _attributes={}, **_arguments): - """Set Current Target: Set the current target of a project - Required argument: Name of target - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'STrg' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Set_Default_Project(self, _object, _attributes={}, **_arguments): - """Set Default Project: Set the default project - Required argument: Name of project - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'SDfP' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Set_Modification_Date = { - 'to' : 'MDat', - } - - def Set_Modification_Date(self, _object, _attributes={}, **_arguments): - """Set Modification Date: Changes the internal modification date of the specified file(s) - Required argument: List of files - Keyword argument to: undocumented, typecode 'ldt ' - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Error code for each modified file - """ - _code = 'MMPR' - _subcode = 'SMod' - - aetools.keysubst(_arguments, self._argmap_Set_Modification_Date) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Set_Preferences = { - 'of_panel' : 'PNam', - 'to' : 'PRec', - } - - def Set_Preferences(self, _no_object=None, _attributes={}, **_arguments): - """Set Preferences: Set the preferences for the current project - Keyword argument of_panel: Name of the preference panel - Keyword argument to: Preferences settings - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'Pref' - - aetools.keysubst(_arguments, self._argmap_Set_Preferences) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Set_Project_File = { - 'to' : 'SrcS', - } - - def Set_Project_File(self, _object, _attributes={}, **_arguments): - """Set Project File: Changes the settings for a given file in the project. - Required argument: The name of the file - Keyword argument to: The new settings for the file - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'SFil' - - aetools.keysubst(_arguments, self._argmap_Set_Project_File) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Set_Segment = { - 'to' : 'Segm', - } - - def Set_Segment(self, _object, _attributes={}, **_arguments): - """Set Segment: Changes the name and attributes of a segment. - Required argument: The segment to change - Keyword argument to: The new name and attributes for the segment. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'SSeg' - - aetools.keysubst(_arguments, self._argmap_Set_Segment) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Touch(self, _object, _attributes={}, **_arguments): - """Touch: Force recompilation of the specified file(s) - Required argument: List of files to compile - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Error code for each file touched - """ - _code = 'MMPR' - _subcode = 'Toch' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Update_Project = { - 'ExternalEditor' : 'Errs', - } - - def Update_Project(self, _no_object=None, _attributes={}, **_arguments): - """Update Project: Update the current project - Keyword argument ExternalEditor: Should the contents of the message window be returned to the caller? - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Errors that occurred while updating the project - """ - _code = 'MMPR' - _subcode = 'UpdP' - - aetools.keysubst(_arguments, self._argmap_Update_Project) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class Browser_Coloring(aetools.ComponentItem): - """Browser Coloring - Colors for Browser symbols. """ - want = 'BRKW' -class _Prop_Browser_Keywords(aetools.NProperty): - """Browser Keywords - Mark Browser symbols with color. """ - which = 'BW00' - want = 'bool' -class _Prop_Classes_Color(aetools.NProperty): - """Classes Color - The color for classes. """ - which = 'BW01' - want = 'cRGB' -class _Prop_Constants_Color(aetools.NProperty): - """Constants Color - The color for constants. """ - which = 'BW02' - want = 'cRGB' -class _Prop_Enums_Color(aetools.NProperty): - """Enums Color - The color for enums. """ - which = 'BW03' - want = 'cRGB' -class _Prop_Functions_Color(aetools.NProperty): - """Functions Color - Set color for functions. """ - which = 'BW04' - want = 'cRGB' -class _Prop_Globals_Color(aetools.NProperty): - """Globals Color - The color for globals """ - which = 'BW05' - want = 'cRGB' -class _Prop_Macros_Color(aetools.NProperty): - """Macros Color - The color for macros. """ - which = 'BW06' - want = 'cRGB' -class _Prop_Template_Commands_in_Menu(aetools.NProperty): - """Template Commands in Menu - Include template commands in context menus """ - which = 'BW10' - want = 'bool' -class _Prop_Templates_Color(aetools.NProperty): - """Templates Color - Set color for templates. """ - which = 'BW07' - want = 'cRGB' -class _Prop_Typedefs_Color(aetools.NProperty): - """Typedefs Color - The color for typedefs. """ - which = 'BW08' - want = 'cRGB' - -class Build_Settings(aetools.ComponentItem): - """Build Settings - Build Settings preferences. """ - want = 'BSTG' -class _Prop_Build_Before_Running(aetools.NProperty): - """Build Before Running - Build the target before running. """ - which = 'BX04' - want = 'BXbr' -class _Prop_Compiler_Thread_Stack_Size(aetools.NProperty): - """Compiler Thread Stack Size - Compiler Thread Stack Size """ - which = 'BX06' - want = 'long' -class _Prop_Completion_Sound(aetools.NProperty): - """Completion Sound - Play a sound when finished a Bring Up To Date or Make command. """ - which = 'BX01' - want = 'bool' -class _Prop_Failure_Sound(aetools.NProperty): - """Failure Sound - The sound CodeWarrior plays when it cannot finish a Bring Up To Date or Make command. """ - which = 'BX03' - want = 'TEXT' -class _Prop_Include_Cache_Size(aetools.NProperty): - """Include Cache Size - Include file cache size. """ - which = 'BX05' - want = 'long' -class _Prop_Save_Before_Building(aetools.NProperty): - """Save Before Building - Save open editor files before build operations """ - which = 'BX07' - want = 'bool' -class _Prop_Success_Sound(aetools.NProperty): - """Success Sound - The sound CodeWarrior plays when it successfully finishes a Bring Up To Date or Make command. """ - which = 'BX02' - want = 'TEXT' - -class base_class(aetools.ComponentItem): - """base class - A base class or super class of a class """ - want = 'BsCl' -class _Prop_access(aetools.NProperty): - """access - """ - which = 'Acce' - want = 'Acce' -class _Prop_class_(aetools.NProperty): - """class - The class object corresponding to this base class """ - which = 'Clas' - want = 'obj ' -class _Prop_virtual(aetools.NProperty): - """virtual - """ - which = 'Virt' - want = 'bool' - -base_classes = base_class - -class Custom_Keywords(aetools.ComponentItem): - """Custom Keywords - """ - want = 'CUKW' -class _Prop_Custom_Color_1(aetools.NProperty): - """Custom Color 1 - The color for the first set of custom keywords. """ - which = 'GH05' - want = 'cRGB' -class _Prop_Custom_Color_2(aetools.NProperty): - """Custom Color 2 - The color for the second set custom keywords. """ - which = 'GH06' - want = 'cRGB' -class _Prop_Custom_Color_3(aetools.NProperty): - """Custom Color 3 - The color for the third set of custom keywords. """ - which = 'GH07' - want = 'cRGB' -class _Prop_Custom_Color_4(aetools.NProperty): - """Custom Color 4 - The color for the fourth set of custom keywords. """ - which = 'GH08' - want = 'cRGB' - -class browser_catalog(aetools.ComponentItem): - """browser catalog - The browser symbol catalog for the current project """ - want = 'Cata' -# element 'Clas' as ['indx', 'name'] - -class class_(aetools.ComponentItem): - """class - A class, struct, or record type in the current project. """ - want = 'Clas' -class _Prop_all_subclasses(aetools.NProperty): - """all subclasses - the classes directly or indirectly derived from this class """ - which = 'SubA' - want = 'Clas' -class _Prop_declaration_end_offset(aetools.NProperty): - """declaration end offset - End of class declaration """ - which = 'DcEn' - want = 'long' -class _Prop_declaration_file(aetools.NProperty): - """declaration file - Source file containing the class declaration """ - which = 'DcFl' - want = 'fss ' -class _Prop_declaration_start_offset(aetools.NProperty): - """declaration start offset - Start of class declaration source code """ - which = 'DcSt' - want = 'long' -class _Prop_language(aetools.NProperty): - """language - Implementation language of this class """ - which = 'Lang' - want = 'Lang' -class _Prop_name(aetools.NProperty): - """name - """ - which = 'pnam' - want = 'TEXT' -class _Prop_subclasses(aetools.NProperty): - """subclasses - the immediate subclasses of this class """ - which = 'SubC' - want = 'Clas' -# element 'BsCl' as ['indx'] -# element 'DtMb' as ['indx', 'name'] -# element 'MbFn' as ['indx', 'name'] - -classes = class_ - -class Debugger_Display(aetools.ComponentItem): - """Debugger Display - Debugger Display preferences """ - want = 'DbDS' -class _Prop_Default_Array_Size(aetools.NProperty): - """Default Array Size - Controls whether CodeWarrior uses its own integrated editor or an external application for editing text files. """ - which = 'Db08' - want = 'shor' -class _Prop_Show_As_Decimal(aetools.NProperty): - """Show As Decimal - Show variable values as decimal by default """ - which = 'Db10' - want = 'bool' -class _Prop_Show_Locals(aetools.NProperty): - """Show Locals - Show locals by default """ - which = 'Db09' - want = 'bool' -class _Prop_Show_Variable_Types(aetools.NProperty): - """Show Variable Types - Show variable types by default. """ - which = 'Db01' - want = 'bool' -class _Prop_Sort_By_Method(aetools.NProperty): - """Sort By Method - Sort functions by method. """ - which = 'Db02' - want = 'bool' -class _Prop_Threads_in_Window(aetools.NProperty): - """Threads in Window - Show threads in separate windows. """ - which = 'Db04' - want = 'bool' -class _Prop_Use_RTTI(aetools.NProperty): - """Use RTTI - Enable RunTime Type Information. """ - which = 'Db03' - want = 'bool' -class _Prop_Variable_Changed_Hilite(aetools.NProperty): - """Variable Changed Hilite - Variable changed hilite color. """ - which = 'Db07' - want = 'cRGB' -class _Prop_Variable_Hints(aetools.NProperty): - """Variable Hints - Show variable hints. """ - which = 'Db05' - want = 'bool' -class _Prop_Watchpoint_Hilite(aetools.NProperty): - """Watchpoint Hilite - Watchpoint hilite color. """ - which = 'Db06' - want = 'cRGB' - -class Debugger_Global(aetools.ComponentItem): - """Debugger Global - Debugger Global preferences """ - want = 'DbGL' -class _Prop_Auto_Target_Libraries(aetools.NProperty): - """Auto Target Libraries - Automatically target libraries when debugging """ - which = 'Dg11' - want = 'bool' -class _Prop_Cache_Edited_Files(aetools.NProperty): - """Cache Edited Files - Cache edit files between debug sessions """ - which = 'Dg12' - want = 'bool' -class _Prop_Confirm_Kill(aetools.NProperty): - """Confirm Kill - Confirm the \xd4killing\xd5 of the process. """ - which = 'Dg04' - want = 'bool' -class _Prop_Dont_Step_in_Runtime(aetools.NProperty): - """Dont Step in Runtime - Don\xd5t step into runtime code when debugging. """ - which = 'Dg07' - want = 'bool' -class _Prop_File_Cache_Duration(aetools.NProperty): - """File Cache Duration - Duration to keep files in cache (in days) """ - which = 'Dg13' - want = 'shor' -class _Prop_Ignore_Mod_Dates(aetools.NProperty): - """Ignore Mod Dates - Ignore modification dates of files. """ - which = 'Dg01' - want = 'bool' -class _Prop_Launch_Apps_on_Open(aetools.NProperty): - """Launch Apps on Open - Launch applications on the opening of sym files. """ - which = 'Dg03' - want = 'bool' -class _Prop_Open_All_Classes(aetools.NProperty): - """Open All Classes - Open all Java class files. """ - which = 'Dg02' - want = 'bool' -class _Prop_Select_Stack_Crawl(aetools.NProperty): - """Select Stack Crawl - Select the stack crawl. """ - which = 'Dg06' - want = 'bool' -class _Prop_Stop_at_Main(aetools.NProperty): - """Stop at Main - Stop to debug on the main() function. """ - which = 'Dg05' - want = 'bool' - -class Debugger_Target(aetools.ComponentItem): - """Debugger Target - Debugger Target preferences """ - want = 'DbTG' -class _Prop_Cache_symbolics(aetools.NProperty): - """Cache symbolics - Cache symbolics between runs when executable doesn\xd5t change, else release symbolics files after killing process. """ - which = 'Dt15' - want = 'bool' -class _Prop_Data_Update_Interval(aetools.NProperty): - """Data Update Interval - How often to update the data while running (in seconds) """ - which = 'Dt09' - want = 'long' -class _Prop_Log_System_Messages(aetools.NProperty): - """Log System Messages - Log all system messages while debugging. """ - which = 'Dt02' - want = 'bool' -class _Prop_Relocated_Executable_Path(aetools.NProperty): - """Relocated Executable Path - Path to location of relocated libraries, code resources or remote debugging folder """ - which = 'Dt10' - want = 'RlPt' -class _Prop_Stop_at_temp_breakpoint(aetools.NProperty): - """Stop at temp breakpoint - Stop at a temp breakpoint on program launch. Set breakpoint type in Temp Breakpoint Type AppleEvent. """ - which = 'Dt13' - want = 'bool' -class _Prop_Temp_Breakpoint_Type(aetools.NProperty): - """Temp Breakpoint Type - Type of temp breakpoint to set on program launch. """ - which = 'Dt16' - want = 'TmpB' -class _Prop_Temp_breakpoint_names(aetools.NProperty): - """Temp breakpoint names - Comma separated list of names to attempt to stop at on program launch. First symbol to resolve in list is the temp BP that will be set. """ - which = 'Dt14' - want = 'ctxt' -class _Prop_Update_Data_While_Running(aetools.NProperty): - """Update Data While Running - Should pause to update data while running """ - which = 'Dt08' - want = 'bool' - -class Debugger_Windowing(aetools.ComponentItem): - """Debugger Windowing - """ - want = 'DbWN' -class _Prop_Debugging_Start_Action(aetools.NProperty): - """Debugging Start Action - What action to take when debug session starts """ - which = 'Dw01' - want = 'DbSA' -class _Prop_Do_Nothing_To_Projects(aetools.NProperty): - """Do Nothing To Projects - Suppress debugging start action for project windows """ - which = 'Dw02' - want = 'bool' - -class data_member(aetools.ComponentItem): - """data member - A class data member or field """ - want = 'DtMb' -class _Prop_static(aetools.NProperty): - """static - """ - which = 'Stat' - want = 'bool' - -data_members = data_member - -class Editor(aetools.ComponentItem): - """Editor - """ - want = 'EDTR' -class _Prop_Background_Color(aetools.NProperty): - """Background Color - Color of the background of editor windows. """ - which = 'ED13' - want = 'cRGB' -class _Prop_Balance(aetools.NProperty): - """Balance - Flash the matching opening bracket when you type a closing bracket. """ - which = 'ED03' - want = 'bool' -class _Prop_Context_Popup_Delay(aetools.NProperty): - """Context Popup Delay - The amount of time, in sixtieths of a second, before the context popup is displayed if you click and hold on a browser symbol. """ - which = 'ED14' - want = 'long' -class _Prop_Default_Text_File_Format(aetools.NProperty): - """Default Text File Format - Default text file format (i.e. which type of line endings to use) """ - which = 'ED17' - want = 'TxtF' -class _Prop_Dynamic_Scroll(aetools.NProperty): - """Dynamic Scroll - Display a window\xd5s contents as you move the scroll box. """ - which = 'ED02' - want = 'bool' -class _Prop_Flash_Delay(aetools.NProperty): - """Flash Delay - The amount of time, in sixtieths of a second, the editor highlights a matching bracket. """ - which = 'ED01' - want = 'long' -class _Prop_Left_Margin_Line_Select(aetools.NProperty): - """Left Margin Line Select - Clicking in the left margin selects lines """ - which = 'ED16' - want = 'bool' -class _Prop_Main_Text_Color(aetools.NProperty): - """Main Text Color - Main, default, color for text. """ - which = 'ED12' - want = 'cRGB' -class _Prop_Relaxed_C_Popup_Parsing(aetools.NProperty): - """Relaxed C Popup Parsing - Relax the function parser for C source files """ - which = 'ED15' - want = 'bool' -class _Prop_Remember_Font(aetools.NProperty): - """Remember Font - Display a source file with its own font settings. """ - which = 'ED08' - want = 'bool' -class _Prop_Remember_Selection(aetools.NProperty): - """Remember Selection - Restore the previous selection in a file when you open it. """ - which = 'ED09' - want = 'bool' -class _Prop_Remember_Window(aetools.NProperty): - """Remember Window - Restore the last size and position for a source file window when you open it. """ - which = 'ED10' - want = 'bool' -class _Prop_Sort_Function_Popup(aetools.NProperty): - """Sort Function Popup - """ - which = 'ED06' - want = 'bool' -class _Prop_Use_Drag__26__Drop_Editing(aetools.NProperty): - """Use Drag & Drop Editing - Use Drag & Drop text editing. """ - which = 'ED04' - want = 'bool' -class _Prop_Use_Multiple_Undo(aetools.NProperty): - """Use Multiple Undo - """ - which = 'ED07' - want = 'bool' - -class Environment_Variable(aetools.ComponentItem): - """Environment Variable - Environment variable for host OS """ - want = 'EnvV' -class _Prop_value(aetools.NProperty): - """value - Value of the environment variable """ - which = 'Valu' - want = 'TEXT' - -class Error_Information(aetools.ComponentItem): - """Error Information - Describes a single error or warning from the compiler or the linker. """ - want = 'ErrM' -class _Prop_disk_file(aetools.NProperty): - """disk file - The file where the error occurred. May not be returned for certain kinds of errors (eg, link errors). """ - which = 'file' - want = 'fss ' -class _Prop_lineNumber(aetools.NProperty): - """lineNumber - The line in the file where the error occurred. May not be returned for certain kinds of errors (eg, link errors). """ - which = 'ErrL' - want = 'long' -class _Prop_message(aetools.NProperty): - """message - The error or warning message. """ - which = 'ErrS' - want = 'TEXT' -class _Prop_messageKind(aetools.NProperty): - """messageKind - The type of error or warning. """ - which = 'ErrT' - want = 'ErrT' - -class Function_Information(aetools.ComponentItem): - """Function Information - Describes the location of any function or global data definition within the current project. """ - want = 'FDef' - -class File_Mappings(aetools.ComponentItem): - """File Mappings - Mappings of extensions & file types to compilers """ - want = 'FLMP' -class _Prop_Mappings(aetools.NProperty): - """Mappings - """ - which = 'FMps' - want = 'FMap' - -class File_Mapping(aetools.ComponentItem): - """File Mapping - """ - want = 'FMap' -class _Prop_Compiler(aetools.NProperty): - """Compiler - """ - which = 'TA07' - want = 'TEXT' -class _Prop_Extension(aetools.NProperty): - """Extension - """ - which = 'TA02' - want = 'TEXT' -class _Prop_File_Type(aetools.NProperty): - """File Type - """ - which = 'PR04' - want = 'TEXT' -class _Prop_Ignored_by_Make(aetools.NProperty): - """Ignored by Make - """ - which = 'TA06' - want = 'bool' -class _Prop_Launchable(aetools.NProperty): - """Launchable - """ - which = 'TA05' - want = 'bool' -class _Prop_Precompiled(aetools.NProperty): - """Precompiled - """ - which = 'TA03' - want = 'bool' -class _Prop_Resource_File(aetools.NProperty): - """Resource File - """ - which = 'TA04' - want = 'bool' - -class Global_Source_Trees(aetools.ComponentItem): - """Global Source Trees - Globally-defined source tree roots """ - want = 'GSTs' -class _Prop_Source_Trees(aetools.NProperty): - """Source Trees - List of source tree roots """ - which = 'ST01' - want = 'SrcT' - -class Extras(aetools.ComponentItem): - """Extras - """ - want = 'GXTR' -class _Prop_Automatic_Toolbar_Help(aetools.NProperty): - """Automatic Toolbar Help - Automatically show balloon help in toolbar after delay """ - which = 'EX19' - want = 'bool' -class _Prop_External_Reference(aetools.NProperty): - """External Reference - Which on-line function reference to use. """ - which = 'EX08' - want = 'RefP' -class _Prop_Full_Screen_Zoom(aetools.NProperty): - """Full Screen Zoom - Zoom windows to the full screen width. """ - which = 'EX07' - want = 'bool' -class _Prop_Recent_Editor_Count(aetools.NProperty): - """Recent Editor Count - Maximum number of editor documents to show in the \xd2Open Recent\xd3 menu """ - which = 'EX16' - want = 'shor' -class _Prop_Recent_Project_Count(aetools.NProperty): - """Recent Project Count - Maximum number of project documents to show in the \xd2Open Recent\xd3 menu """ - which = 'EX17' - want = 'shor' -class _Prop_Use_Editor_Extensions(aetools.NProperty): - """Use Editor Extensions - Controls the use of the Editor Extensions menu """ - which = 'EX10' - want = 'bool' -class _Prop_Use_External_Editor(aetools.NProperty): - """Use External Editor - Controls whether CodeWarrior uses its own integrated editor or an external application for editing text files. """ - which = 'EX11' - want = 'bool' -class _Prop_Use_Script_Menu(aetools.NProperty): - """Use Script Menu - Controls the use of the AppleScript menu """ - which = 'EX12' - want = 'bool' -class _Prop_Use_ToolServer_Menu(aetools.NProperty): - """Use ToolServer Menu - Controls the use of the ToolServer menu """ - which = 'EX18' - want = 'bool' - -class Build_Extras(aetools.ComponentItem): - """Build Extras - """ - want = 'LXTR' -class _Prop_Browser_Active(aetools.NProperty): - """Browser Active - Allow the collection of browser information. """ - which = 'EX09' - want = 'bool' -class _Prop_Cache_Subproject_Data(aetools.NProperty): - """Cache Subproject Data - """ - which = 'EX31' - want = 'bool' -class _Prop_Dump_Browser_Info(aetools.NProperty): - """Dump Browser Info - """ - which = 'EX30' - want = 'bool' -class _Prop_Modification_Date_Caching(aetools.NProperty): - """Modification Date Caching - """ - which = 'EX04' - want = 'bool' - -class member_function(aetools.ComponentItem): - """member function - A class member function or method. """ - want = 'MbFn' -class _Prop_implementation_end_offset(aetools.NProperty): - """implementation end offset - end of member function definition """ - which = 'DfEn' - want = 'long' -class _Prop_implementation_file(aetools.NProperty): - """implementation file - Source file containing the member function definition """ - which = 'DfFl' - want = 'fss ' -class _Prop_implementation_start_offset(aetools.NProperty): - """implementation start offset - start of member function definition source code """ - which = 'DfSt' - want = 'long' - -member_functions = member_function - -class Access_Paths(aetools.ComponentItem): - """Access Paths - Contains the definitions of a project\xd5s access (search) paths. """ - want = 'PATH' -class _Prop_Always_Full_Search(aetools.NProperty): - """Always Full Search - To force the compiler to search for system includes like it searches for user includes. """ - which = 'PA02' - want = 'bool' -class _Prop_Convert_Paths(aetools.NProperty): - """Convert Paths - Enables conversion of DOS & Unix-style relative paths when searching for files. """ - which = 'PA04' - want = 'bool' -class _Prop_Require_Framework_Includes(aetools.NProperty): - """Require Framework Includes - Causes the IDE to only look in the framework access paths if a Mac OS X framework style include (i.e. <Carbon/Carbon.h> ) is used. """ - which = 'PA05' - want = 'bool' -class _Prop_System_Paths(aetools.NProperty): - """System Paths - To add an access path for the include files. (Not supported in Pascal) """ - which = 'PA03' - want = 'PInf' -class _Prop_User_Paths(aetools.NProperty): - """User Paths - To add an access path for the source files. """ - which = 'PA01' - want = 'PInf' - -class Path_Information(aetools.ComponentItem): - """Path Information - Contains all of the parameters that describe an access path. """ - want = 'PInf' -class _Prop_format(aetools.NProperty): - """format - Format of the a """ - which = 'Frmt' - want = 'PthF' -class _Prop_framework(aetools.NProperty): - """framework - Is the path a Mac OS X framework style path? (This flag is readable but not writeable from AppleScript.) """ - which = 'Frmw' - want = 'bool' -class _Prop_host_flags(aetools.NProperty): - """host flags - Bit fields enabling the access path for each host OS (1 = Mac OS, 2 = Windows) """ - which = 'HstF' - want = 'long' -class _Prop_origin(aetools.NProperty): - """origin - """ - which = 'Orig' - want = 'PPrm' -class _Prop_recursive(aetools.NProperty): - """recursive - Will the path be searched recursively? (Default is true) """ - which = 'Recu' - want = 'bool' -class _Prop_root(aetools.NProperty): - """root - Name of the root of the relative path. Pre-defined values are \xd2Absolute\xd3, \xd2Project\xd3, \xd2CodeWarrior\xd3, and \xd2System\xd3. Anything else is a user-defined root. """ - which = 'Root' - want = 'TEXT' - -class Plugin_Settings(aetools.ComponentItem): - """Plugin Settings - Settings for plugin tools """ - want = 'PSTG' -class _Prop_Disable_Third_Party_COM_Plugins(aetools.NProperty): - """Disable Third Party COM Plugins - Disable COM plugins from third parties """ - which = 'PX02' - want = 'bool' -class _Prop_Plugin_Diagnostics_Level(aetools.NProperty): - """Plugin Diagnostics Level - Plugin Diagnostics Level is for those who are developing plugins for the IDE and need to debug them. """ - which = 'PX01' - want = 'PXdg' - -class Runtime_Settings(aetools.ComponentItem): - """Runtime Settings - Runtime settings """ - want = 'RSTG' -class _Prop_Command_Line_Arguments(aetools.NProperty): - """Command Line Arguments - Extra command line args to pass to executable """ - which = 'RS02' - want = 'TEXT' -class _Prop_Environment_Variables(aetools.NProperty): - """Environment Variables - Environment variables to use when running the executable """ - which = 'RS04' - want = 'EnvV' -class _Prop_Host_Application(aetools.NProperty): - """Host Application - Host application for running/debugging libraries and code resources """ - which = 'RS01' - want = 'RlPt' -class _Prop_Working_Directory(aetools.NProperty): - """Working Directory - Working directory to use when running the executable """ - which = 'RS03' - want = 'TEXT' - -class Relative_Path(aetools.ComponentItem): - """Relative Path - Relative path from some root """ - want = 'RlPt' - -class Shielded_Folder(aetools.ComponentItem): - """Shielded Folder - """ - want = 'SFit' -class _Prop_Expression_To_Match(aetools.NProperty): - """Expression To Match - Regular expression which describes folders to skip """ - which = 'SF01' - want = 'TEXT' -class _Prop_Skip_Find_And_Compare_Operations(aetools.NProperty): - """Skip Find And Compare Operations - Matching folders will be skipped during find and compare operations """ - which = 'SF03' - want = 'bool' -class _Prop_Skip_Project_Operations(aetools.NProperty): - """Skip Project Operations - Matching folders will be skipped during project operations """ - which = 'SF02' - want = 'bool' - -class Shielded_Folders(aetools.ComponentItem): - """Shielded Folders - Folders skipped when performing project and find-and-compare operations """ - want = 'SHFL' -class _Prop_Shielded_Items(aetools.NProperty): - """Shielded Items - """ - which = 'SFis' - want = 'SFit' - -class Syntax_Coloring(aetools.ComponentItem): - """Syntax Coloring - """ - want = 'SNTX' -class _Prop_Comment_Color(aetools.NProperty): - """Comment Color - The color for comments. """ - which = 'GH02' - want = 'cRGB' -class _Prop_Keyword_Color(aetools.NProperty): - """Keyword Color - The color for language keywords. """ - which = 'GH03' - want = 'cRGB' -class _Prop_String_Color(aetools.NProperty): - """String Color - The color for strings. """ - which = 'GH04' - want = 'cRGB' -class _Prop_Syntax_Coloring(aetools.NProperty): - """Syntax Coloring - Mark keywords and comments with color. """ - which = 'GH01' - want = 'bool' - -class Segment(aetools.ComponentItem): - """Segment - A segment or group in the project """ - want = 'Seg ' -class _Prop_filecount(aetools.NProperty): - """filecount - """ - which = 'NumF' - want = 'shor' -class _Prop_seg_2d_locked(aetools.NProperty): - """seg-locked - Is the segment locked ? [68K only] """ - which = 'PLck' - want = 'bool' -class _Prop_seg_2d_preloaded(aetools.NProperty): - """seg-preloaded - Is the segment preloaded ? [68K only] """ - which = 'Prel' - want = 'bool' -class _Prop_seg_2d_protected(aetools.NProperty): - """seg-protected - Is the segment protected ? [68K only] """ - which = 'Prot' - want = 'bool' -class _Prop_seg_2d_purgeable(aetools.NProperty): - """seg-purgeable - Is the segment purgeable ? [68K only] """ - which = 'Purg' - want = 'bool' -class _Prop_seg_2d_system_heap(aetools.NProperty): - """seg-system heap - Is the segment loaded into the system heap ? [68K only] """ - which = 'SysH' - want = 'bool' - -class ProjectFile(aetools.ComponentItem): - """ProjectFile - A file contained in a project """ - want = 'SrcF' -class _Prop_codesize(aetools.NProperty): - """codesize - The size of this file\xd5s code. """ - which = 'CSiz' - want = 'long' -class _Prop_datasize(aetools.NProperty): - """datasize - The size of this file\xd5s data. """ - which = 'DSiz' - want = 'long' -class _Prop_filetype(aetools.NProperty): - """filetype - What kind of file is this ? """ - which = 'SrcT' - want = 'SrcT' -class _Prop_includes(aetools.NProperty): - """includes - """ - which = 'IncF' - want = 'fss ' -class _Prop_initialize_before(aetools.NProperty): - """initialize before - Initialize the shared library before the main application. """ - which = 'Bfor' - want = 'bool' -class _Prop_symbols(aetools.NProperty): - """symbols - Are debugging symbols generated for this file ? """ - which = 'SymG' - want = 'bool' -class _Prop_up_to_date(aetools.NProperty): - """up to date - Has the file been compiled since its last modification ? """ - which = 'UpTD' - want = 'bool' -class _Prop_weak_link(aetools.NProperty): - """weak link - Is this file imported weakly into the project ? [PowerPC only] """ - which = 'Weak' - want = 'bool' - -class Source_Tree(aetools.ComponentItem): - """Source Tree - User-defined source tree root """ - want = 'SrcT' -class _Prop_path(aetools.NProperty): - """path - path for the user-defined source tree root """ - which = 'Path' - want = 'TEXT' -class _Prop_path_kind(aetools.NProperty): - """path kind - kind of path """ - which = 'Kind' - want = 'STKd' - -class Target_Settings(aetools.ComponentItem): - """Target Settings - Contains the definitions of a project\xd5s target. """ - want = 'TARG' -class _Prop_Linker(aetools.NProperty): - """Linker - The name of the current linker. """ - which = 'TA01' - want = 'TEXT' -class _Prop_Output_Directory_Location(aetools.NProperty): - """Output Directory Location - Location of output directory """ - which = 'TA16' - want = 'RlPt' -class _Prop_Output_Directory_Origin(aetools.NProperty): - """Output Directory Origin - Origin of path to output directory. Usage of this property is deprecated. Use the \xd2Output Directory Location\xd3 property instead. """ - which = 'TA12' - want = 'PPrm' -class _Prop_Output_Directory_Path(aetools.NProperty): - """Output Directory Path - Path to output directory. Usage of this property is deprecated. Use the \xd2Output Directory Location\xd3 property instead. """ - which = 'TA11' - want = 'TEXT' -class _Prop_Post_Linker(aetools.NProperty): - """Post Linker - """ - which = 'TA09' - want = 'TEXT' -class _Prop_Pre_Linker(aetools.NProperty): - """Pre Linker - """ - which = 'TA13' - want = 'TEXT' -class _Prop_Target_Name(aetools.NProperty): - """Target Name - """ - which = 'TA10' - want = 'TEXT' -class _Prop_Use_Relative_Paths(aetools.NProperty): - """Use Relative Paths - Save project entries using relative paths """ - which = 'TA15' - want = 'bool' - -class Target_Source_Trees(aetools.ComponentItem): - """Target Source Trees - Target-specific user-defined source tree roots """ - want = 'TSTs' - -class VCS_Setup(aetools.ComponentItem): - """VCS Setup - The version control system preferences. """ - want = 'VCSs' -class _Prop_Always_Prompt(aetools.NProperty): - """Always Prompt - Always show login dialog """ - which = 'VC07' - want = 'bool' -class _Prop_Auto_Connect(aetools.NProperty): - """Auto Connect - Automatically connect to database when starting. """ - which = 'VC05' - want = 'bool' -class _Prop_Connection_Method(aetools.NProperty): - """Connection Method - Name of Version Control System to use. """ - which = 'VC02' - want = 'TEXT' -class _Prop_Database_Path(aetools.NProperty): - """Database Path - Path to the VCS database. """ - which = 'VC09' - want = 'RlPt' -class _Prop_Local_Path(aetools.NProperty): - """Local Path - Path to the local root """ - which = 'VC10' - want = 'RlPt' -class _Prop_Mount_Volume(aetools.NProperty): - """Mount Volume - Attempt to mount the database volume if it isn't available. """ - which = 'VC08' - want = 'bool' -class _Prop_Password(aetools.NProperty): - """Password - The password for the VCS. """ - which = 'VC04' - want = 'TEXT' -class _Prop_Store_Password(aetools.NProperty): - """Store Password - Store the password. """ - which = 'VC06' - want = 'bool' -class _Prop_Use_Global_Settings(aetools.NProperty): - """Use Global Settings - Use the global VCS settings by default """ - which = 'VC11' - want = 'bool' -class _Prop_Username(aetools.NProperty): - """Username - The user name for the VCS. """ - which = 'VC03' - want = 'TEXT' -class _Prop_VCS_Active(aetools.NProperty): - """VCS Active - Use Version Control """ - which = 'VC01' - want = 'bool' - -class Font(aetools.ComponentItem): - """Font - """ - want = 'mFNT' -class _Prop_Auto_Indent(aetools.NProperty): - """Auto Indent - Indent new lines automatically. """ - which = 'FN01' - want = 'bool' -class _Prop_Tab_Indents_Selection(aetools.NProperty): - """Tab Indents Selection - Tab indents selection when multiple lines are selected """ - which = 'FN03' - want = 'bool' -class _Prop_Tab_Inserts_Spaces(aetools.NProperty): - """Tab Inserts Spaces - Insert spaces instead of tab character """ - which = 'FN04' - want = 'bool' -class _Prop_Tab_Size(aetools.NProperty): - """Tab Size - """ - which = 'FN02' - want = 'shor' -class _Prop_Text_Font(aetools.NProperty): - """Text Font - The font used in editing windows. """ - which = 'ptxf' - want = 'TEXT' -class _Prop_Text_Size(aetools.NProperty): - """Text Size - The size of the text in an editing window. """ - which = 'ptps' - want = 'shor' -Browser_Coloring._superclassnames = [] -Browser_Coloring._privpropdict = { - 'Browser_Keywords' : _Prop_Browser_Keywords, - 'Classes_Color' : _Prop_Classes_Color, - 'Constants_Color' : _Prop_Constants_Color, - 'Enums_Color' : _Prop_Enums_Color, - 'Functions_Color' : _Prop_Functions_Color, - 'Globals_Color' : _Prop_Globals_Color, - 'Macros_Color' : _Prop_Macros_Color, - 'Template_Commands_in_Menu' : _Prop_Template_Commands_in_Menu, - 'Templates_Color' : _Prop_Templates_Color, - 'Typedefs_Color' : _Prop_Typedefs_Color, -} -Browser_Coloring._privelemdict = { -} -Build_Settings._superclassnames = [] -Build_Settings._privpropdict = { - 'Build_Before_Running' : _Prop_Build_Before_Running, - 'Compiler_Thread_Stack_Size' : _Prop_Compiler_Thread_Stack_Size, - 'Completion_Sound' : _Prop_Completion_Sound, - 'Failure_Sound' : _Prop_Failure_Sound, - 'Include_Cache_Size' : _Prop_Include_Cache_Size, - 'Save_Before_Building' : _Prop_Save_Before_Building, - 'Success_Sound' : _Prop_Success_Sound, -} -Build_Settings._privelemdict = { -} -base_class._superclassnames = [] -base_class._privpropdict = { - 'access' : _Prop_access, - 'class_' : _Prop_class_, - 'virtual' : _Prop_virtual, -} -base_class._privelemdict = { -} -Custom_Keywords._superclassnames = [] -Custom_Keywords._privpropdict = { - 'Custom_Color_1' : _Prop_Custom_Color_1, - 'Custom_Color_2' : _Prop_Custom_Color_2, - 'Custom_Color_3' : _Prop_Custom_Color_3, - 'Custom_Color_4' : _Prop_Custom_Color_4, -} -Custom_Keywords._privelemdict = { -} -browser_catalog._superclassnames = [] -browser_catalog._privpropdict = { -} -browser_catalog._privelemdict = { - 'class_' : class_, -} -class_._superclassnames = [] -class_._privpropdict = { - 'all_subclasses' : _Prop_all_subclasses, - 'declaration_end_offset' : _Prop_declaration_end_offset, - 'declaration_file' : _Prop_declaration_file, - 'declaration_start_offset' : _Prop_declaration_start_offset, - 'language' : _Prop_language, - 'name' : _Prop_name, - 'subclasses' : _Prop_subclasses, -} -class_._privelemdict = { - 'base_class' : base_class, - 'data_member' : data_member, - 'member_function' : member_function, -} -Debugger_Display._superclassnames = [] -Debugger_Display._privpropdict = { - 'Default_Array_Size' : _Prop_Default_Array_Size, - 'Show_As_Decimal' : _Prop_Show_As_Decimal, - 'Show_Locals' : _Prop_Show_Locals, - 'Show_Variable_Types' : _Prop_Show_Variable_Types, - 'Sort_By_Method' : _Prop_Sort_By_Method, - 'Threads_in_Window' : _Prop_Threads_in_Window, - 'Use_RTTI' : _Prop_Use_RTTI, - 'Variable_Changed_Hilite' : _Prop_Variable_Changed_Hilite, - 'Variable_Hints' : _Prop_Variable_Hints, - 'Watchpoint_Hilite' : _Prop_Watchpoint_Hilite, -} -Debugger_Display._privelemdict = { -} -Debugger_Global._superclassnames = [] -Debugger_Global._privpropdict = { - 'Auto_Target_Libraries' : _Prop_Auto_Target_Libraries, - 'Cache_Edited_Files' : _Prop_Cache_Edited_Files, - 'Confirm_Kill' : _Prop_Confirm_Kill, - 'Dont_Step_in_Runtime' : _Prop_Dont_Step_in_Runtime, - 'File_Cache_Duration' : _Prop_File_Cache_Duration, - 'Ignore_Mod_Dates' : _Prop_Ignore_Mod_Dates, - 'Launch_Apps_on_Open' : _Prop_Launch_Apps_on_Open, - 'Open_All_Classes' : _Prop_Open_All_Classes, - 'Select_Stack_Crawl' : _Prop_Select_Stack_Crawl, - 'Stop_at_Main' : _Prop_Stop_at_Main, -} -Debugger_Global._privelemdict = { -} -Debugger_Target._superclassnames = [] -Debugger_Target._privpropdict = { - 'Auto_Target_Libraries' : _Prop_Auto_Target_Libraries, - 'Cache_symbolics' : _Prop_Cache_symbolics, - 'Data_Update_Interval' : _Prop_Data_Update_Interval, - 'Log_System_Messages' : _Prop_Log_System_Messages, - 'Relocated_Executable_Path' : _Prop_Relocated_Executable_Path, - 'Stop_at_temp_breakpoint' : _Prop_Stop_at_temp_breakpoint, - 'Temp_Breakpoint_Type' : _Prop_Temp_Breakpoint_Type, - 'Temp_breakpoint_names' : _Prop_Temp_breakpoint_names, - 'Update_Data_While_Running' : _Prop_Update_Data_While_Running, -} -Debugger_Target._privelemdict = { -} -Debugger_Windowing._superclassnames = [] -Debugger_Windowing._privpropdict = { - 'Debugging_Start_Action' : _Prop_Debugging_Start_Action, - 'Do_Nothing_To_Projects' : _Prop_Do_Nothing_To_Projects, -} -Debugger_Windowing._privelemdict = { -} -data_member._superclassnames = [] -data_member._privpropdict = { - 'access' : _Prop_access, - 'declaration_end_offset' : _Prop_declaration_end_offset, - 'declaration_start_offset' : _Prop_declaration_start_offset, - 'name' : _Prop_name, - 'static' : _Prop_static, -} -data_member._privelemdict = { -} -Editor._superclassnames = [] -Editor._privpropdict = { - 'Background_Color' : _Prop_Background_Color, - 'Balance' : _Prop_Balance, - 'Context_Popup_Delay' : _Prop_Context_Popup_Delay, - 'Default_Text_File_Format' : _Prop_Default_Text_File_Format, - 'Dynamic_Scroll' : _Prop_Dynamic_Scroll, - 'Flash_Delay' : _Prop_Flash_Delay, - 'Left_Margin_Line_Select' : _Prop_Left_Margin_Line_Select, - 'Main_Text_Color' : _Prop_Main_Text_Color, - 'Relaxed_C_Popup_Parsing' : _Prop_Relaxed_C_Popup_Parsing, - 'Remember_Font' : _Prop_Remember_Font, - 'Remember_Selection' : _Prop_Remember_Selection, - 'Remember_Window' : _Prop_Remember_Window, - 'Sort_Function_Popup' : _Prop_Sort_Function_Popup, - 'Use_Drag__26__Drop_Editing' : _Prop_Use_Drag__26__Drop_Editing, - 'Use_Multiple_Undo' : _Prop_Use_Multiple_Undo, -} -Editor._privelemdict = { -} -Environment_Variable._superclassnames = [] -Environment_Variable._privpropdict = { - 'name' : _Prop_name, - 'value' : _Prop_value, -} -Environment_Variable._privelemdict = { -} -Error_Information._superclassnames = [] -Error_Information._privpropdict = { - 'disk_file' : _Prop_disk_file, - 'lineNumber' : _Prop_lineNumber, - 'message' : _Prop_message, - 'messageKind' : _Prop_messageKind, -} -Error_Information._privelemdict = { -} -Function_Information._superclassnames = [] -Function_Information._privpropdict = { - 'disk_file' : _Prop_disk_file, - 'lineNumber' : _Prop_lineNumber, -} -Function_Information._privelemdict = { -} -File_Mappings._superclassnames = [] -File_Mappings._privpropdict = { - 'Mappings' : _Prop_Mappings, -} -File_Mappings._privelemdict = { -} -File_Mapping._superclassnames = [] -File_Mapping._privpropdict = { - 'Compiler' : _Prop_Compiler, - 'Extension' : _Prop_Extension, - 'File_Type' : _Prop_File_Type, - 'Ignored_by_Make' : _Prop_Ignored_by_Make, - 'Launchable' : _Prop_Launchable, - 'Precompiled' : _Prop_Precompiled, - 'Resource_File' : _Prop_Resource_File, -} -File_Mapping._privelemdict = { -} -Global_Source_Trees._superclassnames = [] -Global_Source_Trees._privpropdict = { - 'Source_Trees' : _Prop_Source_Trees, -} -Global_Source_Trees._privelemdict = { -} -Extras._superclassnames = [] -Extras._privpropdict = { - 'Automatic_Toolbar_Help' : _Prop_Automatic_Toolbar_Help, - 'External_Reference' : _Prop_External_Reference, - 'Full_Screen_Zoom' : _Prop_Full_Screen_Zoom, - 'Recent_Editor_Count' : _Prop_Recent_Editor_Count, - 'Recent_Project_Count' : _Prop_Recent_Project_Count, - 'Use_Editor_Extensions' : _Prop_Use_Editor_Extensions, - 'Use_External_Editor' : _Prop_Use_External_Editor, - 'Use_Script_Menu' : _Prop_Use_Script_Menu, - 'Use_ToolServer_Menu' : _Prop_Use_ToolServer_Menu, -} -Extras._privelemdict = { -} -Build_Extras._superclassnames = [] -Build_Extras._privpropdict = { - 'Browser_Active' : _Prop_Browser_Active, - 'Cache_Subproject_Data' : _Prop_Cache_Subproject_Data, - 'Dump_Browser_Info' : _Prop_Dump_Browser_Info, - 'Modification_Date_Caching' : _Prop_Modification_Date_Caching, -} -Build_Extras._privelemdict = { -} -member_function._superclassnames = [] -member_function._privpropdict = { - 'access' : _Prop_access, - 'declaration_end_offset' : _Prop_declaration_end_offset, - 'declaration_file' : _Prop_declaration_file, - 'declaration_start_offset' : _Prop_declaration_start_offset, - 'implementation_end_offset' : _Prop_implementation_end_offset, - 'implementation_file' : _Prop_implementation_file, - 'implementation_start_offset' : _Prop_implementation_start_offset, - 'name' : _Prop_name, - 'static' : _Prop_static, - 'virtual' : _Prop_virtual, -} -member_function._privelemdict = { -} -Access_Paths._superclassnames = [] -Access_Paths._privpropdict = { - 'Always_Full_Search' : _Prop_Always_Full_Search, - 'Convert_Paths' : _Prop_Convert_Paths, - 'Require_Framework_Includes' : _Prop_Require_Framework_Includes, - 'System_Paths' : _Prop_System_Paths, - 'User_Paths' : _Prop_User_Paths, -} -Access_Paths._privelemdict = { -} -Path_Information._superclassnames = [] -Path_Information._privpropdict = { - 'format' : _Prop_format, - 'framework' : _Prop_framework, - 'host_flags' : _Prop_host_flags, - 'name' : _Prop_name, - 'origin' : _Prop_origin, - 'recursive' : _Prop_recursive, - 'root' : _Prop_root, -} -Path_Information._privelemdict = { -} -Plugin_Settings._superclassnames = [] -Plugin_Settings._privpropdict = { - 'Disable_Third_Party_COM_Plugins' : _Prop_Disable_Third_Party_COM_Plugins, - 'Plugin_Diagnostics_Level' : _Prop_Plugin_Diagnostics_Level, -} -Plugin_Settings._privelemdict = { -} -Runtime_Settings._superclassnames = [] -Runtime_Settings._privpropdict = { - 'Command_Line_Arguments' : _Prop_Command_Line_Arguments, - 'Environment_Variables' : _Prop_Environment_Variables, - 'Host_Application' : _Prop_Host_Application, - 'Working_Directory' : _Prop_Working_Directory, -} -Runtime_Settings._privelemdict = { -} -Relative_Path._superclassnames = [] -Relative_Path._privpropdict = { - 'format' : _Prop_format, - 'name' : _Prop_name, - 'origin' : _Prop_origin, - 'root' : _Prop_root, -} -Relative_Path._privelemdict = { -} -Shielded_Folder._superclassnames = [] -Shielded_Folder._privpropdict = { - 'Expression_To_Match' : _Prop_Expression_To_Match, - 'Skip_Find_And_Compare_Operations' : _Prop_Skip_Find_And_Compare_Operations, - 'Skip_Project_Operations' : _Prop_Skip_Project_Operations, -} -Shielded_Folder._privelemdict = { -} -Shielded_Folders._superclassnames = [] -Shielded_Folders._privpropdict = { - 'Shielded_Items' : _Prop_Shielded_Items, -} -Shielded_Folders._privelemdict = { -} -Syntax_Coloring._superclassnames = [] -Syntax_Coloring._privpropdict = { - 'Comment_Color' : _Prop_Comment_Color, - 'Custom_Color_1' : _Prop_Custom_Color_1, - 'Custom_Color_2' : _Prop_Custom_Color_2, - 'Custom_Color_3' : _Prop_Custom_Color_3, - 'Custom_Color_4' : _Prop_Custom_Color_4, - 'Keyword_Color' : _Prop_Keyword_Color, - 'String_Color' : _Prop_String_Color, - 'Syntax_Coloring' : _Prop_Syntax_Coloring, -} -Syntax_Coloring._privelemdict = { -} -Segment._superclassnames = [] -Segment._privpropdict = { - 'filecount' : _Prop_filecount, - 'name' : _Prop_name, - 'seg_2d_locked' : _Prop_seg_2d_locked, - 'seg_2d_preloaded' : _Prop_seg_2d_preloaded, - 'seg_2d_protected' : _Prop_seg_2d_protected, - 'seg_2d_purgeable' : _Prop_seg_2d_purgeable, - 'seg_2d_system_heap' : _Prop_seg_2d_system_heap, -} -Segment._privelemdict = { -} -ProjectFile._superclassnames = [] -ProjectFile._privpropdict = { - 'codesize' : _Prop_codesize, - 'datasize' : _Prop_datasize, - 'disk_file' : _Prop_disk_file, - 'filetype' : _Prop_filetype, - 'includes' : _Prop_includes, - 'initialize_before' : _Prop_initialize_before, - 'name' : _Prop_name, - 'symbols' : _Prop_symbols, - 'up_to_date' : _Prop_up_to_date, - 'weak_link' : _Prop_weak_link, -} -ProjectFile._privelemdict = { -} -Source_Tree._superclassnames = [] -Source_Tree._privpropdict = { - 'format' : _Prop_format, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'path_kind' : _Prop_path_kind, -} -Source_Tree._privelemdict = { -} -Target_Settings._superclassnames = [] -Target_Settings._privpropdict = { - 'Linker' : _Prop_Linker, - 'Output_Directory_Location' : _Prop_Output_Directory_Location, - 'Output_Directory_Origin' : _Prop_Output_Directory_Origin, - 'Output_Directory_Path' : _Prop_Output_Directory_Path, - 'Post_Linker' : _Prop_Post_Linker, - 'Pre_Linker' : _Prop_Pre_Linker, - 'Target_Name' : _Prop_Target_Name, - 'Use_Relative_Paths' : _Prop_Use_Relative_Paths, -} -Target_Settings._privelemdict = { -} -Target_Source_Trees._superclassnames = [] -Target_Source_Trees._privpropdict = { - 'Source_Trees' : _Prop_Source_Trees, -} -Target_Source_Trees._privelemdict = { -} -VCS_Setup._superclassnames = [] -VCS_Setup._privpropdict = { - 'Always_Prompt' : _Prop_Always_Prompt, - 'Auto_Connect' : _Prop_Auto_Connect, - 'Connection_Method' : _Prop_Connection_Method, - 'Database_Path' : _Prop_Database_Path, - 'Local_Path' : _Prop_Local_Path, - 'Mount_Volume' : _Prop_Mount_Volume, - 'Password' : _Prop_Password, - 'Store_Password' : _Prop_Store_Password, - 'Use_Global_Settings' : _Prop_Use_Global_Settings, - 'Username' : _Prop_Username, - 'VCS_Active' : _Prop_VCS_Active, -} -VCS_Setup._privelemdict = { -} -Font._superclassnames = [] -Font._privpropdict = { - 'Auto_Indent' : _Prop_Auto_Indent, - 'Tab_Indents_Selection' : _Prop_Tab_Indents_Selection, - 'Tab_Inserts_Spaces' : _Prop_Tab_Inserts_Spaces, - 'Tab_Size' : _Prop_Tab_Size, - 'Text_Font' : _Prop_Text_Font, - 'Text_Size' : _Prop_Text_Size, -} -Font._privelemdict = { -} -_Enum_Acce = { - 'public' : 'Publ', # - 'protected' : 'Prot', # - 'private' : 'Priv', # -} - -_Enum_BXbr = { - 'Always_Build' : 'BXb1', # Always build the target before running. - 'Ask_Build' : 'BXb2', # Ask before building the target when running. - 'Never_Build' : 'BXb3', # Never before building the target before running. -} - -_Enum_DbSA = { - 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows - 'Hide_Windows' : 'DSA2', # Hide non-debugging windows - 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows - 'Close_Windows' : 'DSA4', # Close non-debugging windows -} - -_Enum_DgBL = { - 'Always' : 'DgB0', # Always build before debugging. - 'Never' : 'DgB1', # Never build before debugging. - 'Ask' : 'DgB2', # Ask about building before debugging. -} - -_Enum_ErrT = { - 'information' : 'ErIn', # - 'compiler_warning' : 'ErCW', # - 'compiler_error' : 'ErCE', # - 'definition' : 'ErDf', # - 'linker_warning' : 'ErLW', # - 'linker_error' : 'ErLE', # - 'find_result' : 'ErFn', # - 'generic_error' : 'ErGn', # -} - -_Enum_Inte = { - 'never_interact' : 'eNvr', # Never allow user interactions - 'interact_with_self' : 'eInS', # Allow user interaction only when an AppleEvent is sent from within CodeWarrior - 'interact_with_local' : 'eInL', # Allow user interaction when AppleEvents are sent from applications on the same machine (default) - 'interact_with_all' : 'eInA', # Allow user interaction from both local and remote AppleEvents -} - -_Enum_Lang = { - 'C' : 'LC ', # - 'C_2b__2b_' : 'LC++', # - 'Pascal' : 'LP ', # - 'Object_Pascal' : 'LP++', # - 'Java' : 'LJav', # - 'Assembler' : 'LAsm', # - 'Unknown' : 'L? ', # -} - -_Enum_PPrm = { - 'absolute' : 'Abso', # An absolute path name, including volume name. - 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. - 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. - 'system_relative' : 'YRel', # A path relative to the system folder - 'root_relative' : 'RRel', # -} - -_Enum_PXdg = { - 'Diagnose_None' : 'PXd1', # No Plugin Diagnostics. - 'Diagnose_Errors' : 'PXd2', # Plugin Diagnostics for errors only. - 'Diagnose_All' : 'PXd3', # Plugin Diagnostics for everything. -} - -_Enum_PthF = { - 'Generic_Path' : 'PFGn', # - 'MacOS_Path' : 'PFMc', # MacOS path using colon as separator - 'Windows_Path' : 'PFWn', # Windows path using backslash as separator - 'Unix_Path' : 'PFUx', # Unix path using slash as separator -} - -_Enum_RefP = { - 'Think_Reference' : 'DanR', # - 'QuickView' : 'ALTV', # -} - -_Enum_STKd = { - 'Absolute_Path' : 'STK0', # The \xd2path\xd3 property is an absolute path to the location of the source tree. - 'Registry_Key' : 'STK1', # The \xd2path\xd3 property is the name of a registry key that contains the path to the root. - 'Environment_Variable' : 'STK2', # The \xd2path\xd3 property is the name of an environment variable that contains the path to the root. -} - -_Enum_SrcT = { - 'source' : 'FTxt', # A source file (.c, .cp, .p, etc). - 'unknown' : 'FUnk', # An unknown file type. -} - -_Enum_TmpB = { - 'User_Specified' : 'Usrs', # Use user specified symbols when setting temporary breakpoints on program launch. - 'Default' : 'Dflt', # Use system default symbols when setting temporary breakpoints on program launch. -} - -_Enum_TxtF = { - 'MacOS' : 'TxF0', # MacOS text format - 'DOS' : 'TxF1', # DOS text format - 'Unix' : 'TxF2', # Unix text format -} - -_Enum_savo = { - 'yes' : 'yes ', # Save changes - 'no' : 'no ', # Do not save changes - 'ask' : 'ask ', # Ask the user whether to save -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'BRKW' : Browser_Coloring, - 'BSTG' : Build_Settings, - 'BsCl' : base_class, - 'CUKW' : Custom_Keywords, - 'Cata' : browser_catalog, - 'Clas' : class_, - 'DbDS' : Debugger_Display, - 'DbGL' : Debugger_Global, - 'DbTG' : Debugger_Target, - 'DbWN' : Debugger_Windowing, - 'DtMb' : data_member, - 'EDTR' : Editor, - 'EnvV' : Environment_Variable, - 'ErrM' : Error_Information, - 'FDef' : Function_Information, - 'FLMP' : File_Mappings, - 'FMap' : File_Mapping, - 'GSTs' : Global_Source_Trees, - 'GXTR' : Extras, - 'LXTR' : Build_Extras, - 'MbFn' : member_function, - 'PATH' : Access_Paths, - 'PInf' : Path_Information, - 'PSTG' : Plugin_Settings, - 'RSTG' : Runtime_Settings, - 'RlPt' : Relative_Path, - 'SFit' : Shielded_Folder, - 'SHFL' : Shielded_Folders, - 'SNTX' : Syntax_Coloring, - 'Seg ' : Segment, - 'SrcF' : ProjectFile, - 'SrcT' : Source_Tree, - 'TARG' : Target_Settings, - 'TSTs' : Target_Source_Trees, - 'VCSs' : VCS_Setup, - 'mFNT' : Font, -} - -_propdeclarations = { - 'Acce' : _Prop_access, - 'BW00' : _Prop_Browser_Keywords, - 'BW01' : _Prop_Classes_Color, - 'BW02' : _Prop_Constants_Color, - 'BW03' : _Prop_Enums_Color, - 'BW04' : _Prop_Functions_Color, - 'BW05' : _Prop_Globals_Color, - 'BW06' : _Prop_Macros_Color, - 'BW07' : _Prop_Templates_Color, - 'BW08' : _Prop_Typedefs_Color, - 'BW10' : _Prop_Template_Commands_in_Menu, - 'BX01' : _Prop_Completion_Sound, - 'BX02' : _Prop_Success_Sound, - 'BX03' : _Prop_Failure_Sound, - 'BX04' : _Prop_Build_Before_Running, - 'BX05' : _Prop_Include_Cache_Size, - 'BX06' : _Prop_Compiler_Thread_Stack_Size, - 'BX07' : _Prop_Save_Before_Building, - 'Bfor' : _Prop_initialize_before, - 'CSiz' : _Prop_codesize, - 'Clas' : _Prop_class_, - 'DSiz' : _Prop_datasize, - 'Db01' : _Prop_Show_Variable_Types, - 'Db02' : _Prop_Sort_By_Method, - 'Db03' : _Prop_Use_RTTI, - 'Db04' : _Prop_Threads_in_Window, - 'Db05' : _Prop_Variable_Hints, - 'Db06' : _Prop_Watchpoint_Hilite, - 'Db07' : _Prop_Variable_Changed_Hilite, - 'Db08' : _Prop_Default_Array_Size, - 'Db09' : _Prop_Show_Locals, - 'Db10' : _Prop_Show_As_Decimal, - 'DcEn' : _Prop_declaration_end_offset, - 'DcFl' : _Prop_declaration_file, - 'DcSt' : _Prop_declaration_start_offset, - 'DfEn' : _Prop_implementation_end_offset, - 'DfFl' : _Prop_implementation_file, - 'DfSt' : _Prop_implementation_start_offset, - 'Dg01' : _Prop_Ignore_Mod_Dates, - 'Dg02' : _Prop_Open_All_Classes, - 'Dg03' : _Prop_Launch_Apps_on_Open, - 'Dg04' : _Prop_Confirm_Kill, - 'Dg05' : _Prop_Stop_at_Main, - 'Dg06' : _Prop_Select_Stack_Crawl, - 'Dg07' : _Prop_Dont_Step_in_Runtime, - 'Dg11' : _Prop_Auto_Target_Libraries, - 'Dg12' : _Prop_Cache_Edited_Files, - 'Dg13' : _Prop_File_Cache_Duration, - 'Dt02' : _Prop_Log_System_Messages, - 'Dt08' : _Prop_Update_Data_While_Running, - 'Dt09' : _Prop_Data_Update_Interval, - 'Dt10' : _Prop_Relocated_Executable_Path, - 'Dt13' : _Prop_Stop_at_temp_breakpoint, - 'Dt14' : _Prop_Temp_breakpoint_names, - 'Dt15' : _Prop_Cache_symbolics, - 'Dt16' : _Prop_Temp_Breakpoint_Type, - 'Dw01' : _Prop_Debugging_Start_Action, - 'Dw02' : _Prop_Do_Nothing_To_Projects, - 'ED01' : _Prop_Flash_Delay, - 'ED02' : _Prop_Dynamic_Scroll, - 'ED03' : _Prop_Balance, - 'ED04' : _Prop_Use_Drag__26__Drop_Editing, - 'ED06' : _Prop_Sort_Function_Popup, - 'ED07' : _Prop_Use_Multiple_Undo, - 'ED08' : _Prop_Remember_Font, - 'ED09' : _Prop_Remember_Selection, - 'ED10' : _Prop_Remember_Window, - 'ED12' : _Prop_Main_Text_Color, - 'ED13' : _Prop_Background_Color, - 'ED14' : _Prop_Context_Popup_Delay, - 'ED15' : _Prop_Relaxed_C_Popup_Parsing, - 'ED16' : _Prop_Left_Margin_Line_Select, - 'ED17' : _Prop_Default_Text_File_Format, - 'EX04' : _Prop_Modification_Date_Caching, - 'EX07' : _Prop_Full_Screen_Zoom, - 'EX08' : _Prop_External_Reference, - 'EX09' : _Prop_Browser_Active, - 'EX10' : _Prop_Use_Editor_Extensions, - 'EX11' : _Prop_Use_External_Editor, - 'EX12' : _Prop_Use_Script_Menu, - 'EX16' : _Prop_Recent_Editor_Count, - 'EX17' : _Prop_Recent_Project_Count, - 'EX18' : _Prop_Use_ToolServer_Menu, - 'EX19' : _Prop_Automatic_Toolbar_Help, - 'EX30' : _Prop_Dump_Browser_Info, - 'EX31' : _Prop_Cache_Subproject_Data, - 'ErrL' : _Prop_lineNumber, - 'ErrS' : _Prop_message, - 'ErrT' : _Prop_messageKind, - 'FMps' : _Prop_Mappings, - 'FN01' : _Prop_Auto_Indent, - 'FN02' : _Prop_Tab_Size, - 'FN03' : _Prop_Tab_Indents_Selection, - 'FN04' : _Prop_Tab_Inserts_Spaces, - 'Frmt' : _Prop_format, - 'Frmw' : _Prop_framework, - 'GH01' : _Prop_Syntax_Coloring, - 'GH02' : _Prop_Comment_Color, - 'GH03' : _Prop_Keyword_Color, - 'GH04' : _Prop_String_Color, - 'GH05' : _Prop_Custom_Color_1, - 'GH06' : _Prop_Custom_Color_2, - 'GH07' : _Prop_Custom_Color_3, - 'GH08' : _Prop_Custom_Color_4, - 'HstF' : _Prop_host_flags, - 'IncF' : _Prop_includes, - 'Kind' : _Prop_path_kind, - 'Lang' : _Prop_language, - 'NumF' : _Prop_filecount, - 'Orig' : _Prop_origin, - 'PA01' : _Prop_User_Paths, - 'PA02' : _Prop_Always_Full_Search, - 'PA03' : _Prop_System_Paths, - 'PA04' : _Prop_Convert_Paths, - 'PA05' : _Prop_Require_Framework_Includes, - 'PLck' : _Prop_seg_2d_locked, - 'PR04' : _Prop_File_Type, - 'PX01' : _Prop_Plugin_Diagnostics_Level, - 'PX02' : _Prop_Disable_Third_Party_COM_Plugins, - 'Path' : _Prop_path, - 'Prel' : _Prop_seg_2d_preloaded, - 'Prot' : _Prop_seg_2d_protected, - 'Purg' : _Prop_seg_2d_purgeable, - 'RS01' : _Prop_Host_Application, - 'RS02' : _Prop_Command_Line_Arguments, - 'RS03' : _Prop_Working_Directory, - 'RS04' : _Prop_Environment_Variables, - 'Recu' : _Prop_recursive, - 'Root' : _Prop_root, - 'SF01' : _Prop_Expression_To_Match, - 'SF02' : _Prop_Skip_Project_Operations, - 'SF03' : _Prop_Skip_Find_And_Compare_Operations, - 'SFis' : _Prop_Shielded_Items, - 'ST01' : _Prop_Source_Trees, - 'SrcT' : _Prop_filetype, - 'Stat' : _Prop_static, - 'SubA' : _Prop_all_subclasses, - 'SubC' : _Prop_subclasses, - 'SymG' : _Prop_symbols, - 'SysH' : _Prop_seg_2d_system_heap, - 'TA01' : _Prop_Linker, - 'TA02' : _Prop_Extension, - 'TA03' : _Prop_Precompiled, - 'TA04' : _Prop_Resource_File, - 'TA05' : _Prop_Launchable, - 'TA06' : _Prop_Ignored_by_Make, - 'TA07' : _Prop_Compiler, - 'TA09' : _Prop_Post_Linker, - 'TA10' : _Prop_Target_Name, - 'TA11' : _Prop_Output_Directory_Path, - 'TA12' : _Prop_Output_Directory_Origin, - 'TA13' : _Prop_Pre_Linker, - 'TA15' : _Prop_Use_Relative_Paths, - 'TA16' : _Prop_Output_Directory_Location, - 'UpTD' : _Prop_up_to_date, - 'VC01' : _Prop_VCS_Active, - 'VC02' : _Prop_Connection_Method, - 'VC03' : _Prop_Username, - 'VC04' : _Prop_Password, - 'VC05' : _Prop_Auto_Connect, - 'VC06' : _Prop_Store_Password, - 'VC07' : _Prop_Always_Prompt, - 'VC08' : _Prop_Mount_Volume, - 'VC09' : _Prop_Database_Path, - 'VC10' : _Prop_Local_Path, - 'VC11' : _Prop_Use_Global_Settings, - 'Valu' : _Prop_value, - 'Virt' : _Prop_virtual, - 'Weak' : _Prop_weak_link, - 'file' : _Prop_disk_file, - 'pnam' : _Prop_name, - 'ptps' : _Prop_Text_Size, - 'ptxf' : _Prop_Text_Font, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'Acce' : _Enum_Acce, - 'BXbr' : _Enum_BXbr, - 'DbSA' : _Enum_DbSA, - 'DgBL' : _Enum_DgBL, - 'ErrT' : _Enum_ErrT, - 'Inte' : _Enum_Inte, - 'Lang' : _Enum_Lang, - 'PPrm' : _Enum_PPrm, - 'PXdg' : _Enum_PXdg, - 'PthF' : _Enum_PthF, - 'RefP' : _Enum_RefP, - 'STKd' : _Enum_STKd, - 'SrcT' : _Enum_SrcT, - 'TmpB' : _Enum_TmpB, - 'TxtF' : _Enum_TxtF, - 'savo' : _Enum_savo, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Required.py b/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Required.py deleted file mode 100644 index b0749e873..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Required.py +++ /dev/null @@ -1,62 +0,0 @@ -"""Suite Required: Terms that every application should support -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'reqd' - -from StdSuites.Required_Suite import * -class Required_Events(Required_Suite_Events): - - _argmap_open = { - 'converting' : 'Conv', - } - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument converting: Whether to convert project to latest version (yes/no; default is ask). - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - aetools.keysubst(_arguments, self._argmap_open) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'Conv', _Enum_Conv) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - -_Enum_Conv = { - 'yes' : 'yes ', # Convert the project if necessary on open - 'no' : 'no ', # Do not convert the project if needed on open -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'Conv' : _Enum_Conv, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py deleted file mode 100644 index ae277a276..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py +++ /dev/null @@ -1,408 +0,0 @@ -"""Suite Standard Suite: Common terms for most applications -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'CoRe' - -from StdSuites.Standard_Suite import * -class Standard_Suite_Events(Standard_Suite_Events): - - _argmap_close = { - 'saving' : 'savo', - 'saving_in' : 'kfil', - } - - def close(self, _object, _attributes={}, **_arguments): - """close: close an object - Required argument: the object to close - Keyword argument saving: specifies whether or not changes should be saved before closing - Keyword argument saving_in: the file in which to save the object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - aetools.keysubst(_arguments, self._argmap_close) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_count = { - 'each' : 'kocl', - } - - def count(self, _object, _attributes={}, **_arguments): - """count: return the number of elements of a particular class within an object - Required argument: the object whose elements are to be counted - Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of elements - """ - _code = 'core' - _subcode = 'cnte' - - aetools.keysubst(_arguments, self._argmap_count) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_get = { - 'as' : 'rtyp', - } - - def get(self, _object, _attributes={}, **_arguments): - """get: get the data for an object - Required argument: the object whose data is to be returned - Keyword argument as: the desired types for the data, in order of preference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: The data from the object - """ - _code = 'core' - _subcode = 'getd' - - aetools.keysubst(_arguments, self._argmap_get) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_make = { - 'new' : 'kocl', - 'as' : 'rtyp', - 'at' : 'insh', - 'with_data' : 'data', - 'with_properties' : 'prdt', - } - - def make(self, _no_object=None, _attributes={}, **_arguments): - """make: make a new element - Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript - Keyword argument as: the desired types for the data, in order of preference - Keyword argument at: the location at which to insert the element - Keyword argument with_data: the initial data for the element - Keyword argument with_properties: the initial values for the properties of the element - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the new object(s) - """ - _code = 'core' - _subcode = 'crel' - - aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def select(self, _object=None, _attributes={}, **_arguments): - """select: select the specified object - Required argument: the object to select - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'slct' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_set = { - 'to' : 'data', - } - - def set(self, _object, _attributes={}, **_arguments): - """set: set an object's data - Required argument: the object to change - Keyword argument to: the new value - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'setd' - - aetools.keysubst(_arguments, self._argmap_set) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - an application program """ - want = 'capp' -class _Prop_user_interaction(aetools.NProperty): - """user interaction - user interaction level """ - which = 'inte' - want = 'Inte' -user_interaction = _Prop_user_interaction() -# element 'cwin' as ['indx', 'name', 'rang'] -# element 'docu' as ['indx', 'name', 'rang'] - -class character(aetools.ComponentItem): - """character - a character """ - want = 'cha ' -class _Prop_length(aetools.NProperty): - """length - length in characters of this object """ - which = 'pLen' - want = 'long' -class _Prop_offset(aetools.NProperty): - """offset - offset of a text object from the beginning of the document (first char has offset 1) """ - which = 'pOff' - want = 'long' - -class insertion_point(aetools.ComponentItem): - """insertion point - An insertion location between two objects """ - want = 'cins' - -class line(aetools.ComponentItem): - """line - lines of text """ - want = 'clin' -class _Prop_index(aetools.NProperty): - """index - index of a line object from the beginning of the document (first line has index 1) """ - which = 'pidx' - want = 'long' -# element 'cha ' as ['indx', 'rang', 'rele'] - -lines = line - -class selection_2d_object(aetools.ComponentItem): - """selection-object - the selection visible to the user """ - want = 'csel' -class _Prop_contents(aetools.NProperty): - """contents - the contents of the selection """ - which = 'pcnt' - want = 'type' -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'clin' as ['indx', 'rang', 'rele'] -# element 'ctxt' as ['rang'] - -class text(aetools.ComponentItem): - """text - Text """ - want = 'ctxt' -# element 'cha ' as ['indx', 'rele', 'rang'] -# element 'cins' as ['rele'] -# element 'clin' as ['indx', 'rang', 'rele'] -# element 'ctxt' as ['rang'] - -class window(aetools.ComponentItem): - """window - A window """ - want = 'cwin' -class _Prop_bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window """ - which = 'pbnd' - want = 'qdrt' -class _Prop_document(aetools.NProperty): - """document - the document that owns this window """ - which = 'docu' - want = 'docu' -class _Prop_name(aetools.NProperty): - """name - the title of the window """ - which = 'pnam' - want = 'itxt' -class _Prop_position(aetools.NProperty): - """position - upper left coordinates of window """ - which = 'ppos' - want = 'QDpt' -class _Prop_visible(aetools.NProperty): - """visible - is the window visible? """ - which = 'pvis' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' - -windows = window - -class document(aetools.ComponentItem): - """document - a document """ - want = 'docu' -class _Prop_file_permissions(aetools.NProperty): - """file permissions - the file permissions for the document """ - which = 'PERM' - want = 'PERM' -class _Prop_kind(aetools.NProperty): - """kind - the kind of document """ - which = 'DKND' - want = 'DKND' -class _Prop_location(aetools.NProperty): - """location - the file of the document """ - which = 'FILE' - want = 'fss ' -class _Prop_window(aetools.NProperty): - """window - the window of the document. """ - which = 'cwin' - want = 'cwin' - -documents = document - -class files(aetools.ComponentItem): - """files - Every file """ - want = 'file' - -file = files -application._superclassnames = [] -application._privpropdict = { - 'user_interaction' : _Prop_user_interaction, -} -application._privelemdict = { - 'document' : document, - 'window' : window, -} -character._superclassnames = [] -character._privpropdict = { - 'length' : _Prop_length, - 'offset' : _Prop_offset, -} -character._privelemdict = { -} -insertion_point._superclassnames = [] -insertion_point._privpropdict = { - 'length' : _Prop_length, - 'offset' : _Prop_offset, -} -insertion_point._privelemdict = { -} -line._superclassnames = [] -line._privpropdict = { - 'index' : _Prop_index, - 'length' : _Prop_length, - 'offset' : _Prop_offset, -} -line._privelemdict = { - 'character' : character, -} -selection_2d_object._superclassnames = [] -selection_2d_object._privpropdict = { - 'contents' : _Prop_contents, - 'length' : _Prop_length, - 'offset' : _Prop_offset, -} -selection_2d_object._privelemdict = { - 'character' : character, - 'line' : line, - 'text' : text, -} -text._superclassnames = [] -text._privpropdict = { - 'length' : _Prop_length, - 'offset' : _Prop_offset, -} -text._privelemdict = { - 'character' : character, - 'insertion_point' : insertion_point, - 'line' : line, - 'text' : text, -} -window._superclassnames = [] -window._privpropdict = { - 'bounds' : _Prop_bounds, - 'document' : _Prop_document, - 'index' : _Prop_index, - 'name' : _Prop_name, - 'position' : _Prop_position, - 'visible' : _Prop_visible, - 'zoomed' : _Prop_zoomed, -} -window._privelemdict = { -} -document._superclassnames = [] -document._privpropdict = { - 'file_permissions' : _Prop_file_permissions, - 'index' : _Prop_index, - 'kind' : _Prop_kind, - 'location' : _Prop_location, - 'name' : _Prop_name, - 'window' : _Prop_window, -} -document._privelemdict = { -} -files._superclassnames = [] -files._privpropdict = { -} -files._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cha ' : character, - 'cins' : insertion_point, - 'clin' : line, - 'csel' : selection_2d_object, - 'ctxt' : text, - 'cwin' : window, - 'docu' : document, - 'file' : files, -} - -_propdeclarations = { - 'DKND' : _Prop_kind, - 'FILE' : _Prop_location, - 'PERM' : _Prop_file_permissions, - 'cwin' : _Prop_window, - 'docu' : _Prop_document, - 'inte' : _Prop_user_interaction, - 'pLen' : _Prop_length, - 'pOff' : _Prop_offset, - 'pbnd' : _Prop_bounds, - 'pcnt' : _Prop_contents, - 'pidx' : _Prop_index, - 'pnam' : _Prop_name, - 'ppos' : _Prop_position, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py deleted file mode 100644 index 5ef7ca964..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py +++ /dev/null @@ -1,189 +0,0 @@ -""" -Package generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 -""" -import aetools -Error = aetools.Error -import CodeWarrior_suite -import Standard_Suite -import Metrowerks_Shell_Suite -import Required - - -_code_to_module = { - 'CWIE' : CodeWarrior_suite, - 'CoRe' : Standard_Suite, - 'MMPR' : Metrowerks_Shell_Suite, - 'reqd' : Required, -} - - - -_code_to_fullname = { - 'CWIE' : ('CodeWarrior.CodeWarrior_suite', 'CodeWarrior_suite'), - 'CoRe' : ('CodeWarrior.Standard_Suite', 'Standard_Suite'), - 'MMPR' : ('CodeWarrior.Metrowerks_Shell_Suite', 'Metrowerks_Shell_Suite'), - 'reqd' : ('CodeWarrior.Required', 'Required'), -} - -from CodeWarrior_suite import * -from Standard_Suite import * -from Metrowerks_Shell_Suite import * -from Required import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(character) -getbaseclasses(selection_2d_object) -getbaseclasses(application) -getbaseclasses(document) -getbaseclasses(text) -getbaseclasses(window) -getbaseclasses(file) -getbaseclasses(line) -getbaseclasses(insertion_point) -getbaseclasses(single_class_browser) -getbaseclasses(project_document) -getbaseclasses(symbol_browser) -getbaseclasses(editor_document) -getbaseclasses(file_compare_document) -getbaseclasses(class_browser) -getbaseclasses(subtarget) -getbaseclasses(message_document) -getbaseclasses(project_inspector) -getbaseclasses(text_document) -getbaseclasses(catalog_document) -getbaseclasses(class_hierarchy) -getbaseclasses(target) -getbaseclasses(build_progress_document) -getbaseclasses(target_file) -getbaseclasses(ToolServer_worksheet) -getbaseclasses(single_class_hierarchy) -getbaseclasses(File_Mapping) -getbaseclasses(browser_catalog) -getbaseclasses(Build_Settings) -getbaseclasses(ProjectFile) -getbaseclasses(VCS_Setup) -getbaseclasses(data_member) -getbaseclasses(Shielded_Folder) -getbaseclasses(Custom_Keywords) -getbaseclasses(Path_Information) -getbaseclasses(Segment) -getbaseclasses(Source_Tree) -getbaseclasses(Access_Paths) -getbaseclasses(Debugger_Windowing) -getbaseclasses(Relative_Path) -getbaseclasses(Environment_Variable) -getbaseclasses(base_class) -getbaseclasses(Debugger_Display) -getbaseclasses(Build_Extras) -getbaseclasses(Error_Information) -getbaseclasses(Editor) -getbaseclasses(Shielded_Folders) -getbaseclasses(Extras) -getbaseclasses(File_Mappings) -getbaseclasses(Function_Information) -getbaseclasses(Debugger_Target) -getbaseclasses(Syntax_Coloring) -getbaseclasses(class_) -getbaseclasses(Global_Source_Trees) -getbaseclasses(Target_Settings) -getbaseclasses(Debugger_Global) -getbaseclasses(member_function) -getbaseclasses(Runtime_Settings) -getbaseclasses(Plugin_Settings) -getbaseclasses(Browser_Coloring) -getbaseclasses(Font) -getbaseclasses(Target_Source_Trees) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cha ' : character, - 'csel' : selection_2d_object, - 'capp' : application, - 'docu' : document, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'cins' : insertion_point, - '1BRW' : single_class_browser, - 'PRJD' : project_document, - 'SYMB' : symbol_browser, - 'EDIT' : editor_document, - 'COMP' : file_compare_document, - 'BROW' : class_browser, - 'SBTG' : subtarget, - 'MSSG' : message_document, - 'INSP' : project_inspector, - 'TXTD' : text_document, - 'CTLG' : catalog_document, - 'HIER' : class_hierarchy, - 'TRGT' : target, - 'PRGS' : build_progress_document, - 'SRCF' : target_file, - 'TOOL' : ToolServer_worksheet, - '1HIR' : single_class_hierarchy, - 'FMap' : File_Mapping, - 'Cata' : browser_catalog, - 'BSTG' : Build_Settings, - 'SrcF' : ProjectFile, - 'VCSs' : VCS_Setup, - 'DtMb' : data_member, - 'SFit' : Shielded_Folder, - 'CUKW' : Custom_Keywords, - 'PInf' : Path_Information, - 'Seg ' : Segment, - 'SrcT' : Source_Tree, - 'PATH' : Access_Paths, - 'DbWN' : Debugger_Windowing, - 'RlPt' : Relative_Path, - 'EnvV' : Environment_Variable, - 'BsCl' : base_class, - 'DbDS' : Debugger_Display, - 'LXTR' : Build_Extras, - 'ErrM' : Error_Information, - 'EDTR' : Editor, - 'SHFL' : Shielded_Folders, - 'GXTR' : Extras, - 'FLMP' : File_Mappings, - 'FDef' : Function_Information, - 'DbTG' : Debugger_Target, - 'SNTX' : Syntax_Coloring, - 'Clas' : class_, - 'GSTs' : Global_Source_Trees, - 'TARG' : Target_Settings, - 'DbGL' : Debugger_Global, - 'MbFn' : member_function, - 'RSTG' : Runtime_Settings, - 'PSTG' : Plugin_Settings, - 'BRKW' : Browser_Coloring, - 'mFNT' : Font, - 'TSTs' : Target_Source_Trees, -} - - -class CodeWarrior(CodeWarrior_suite_Events, - Standard_Suite_Events, - Metrowerks_Shell_Suite_Events, - Required_Events, - aetools.TalkTo): - _signature = 'CWIE' - - _moduleName = 'CodeWarrior' diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py deleted file mode 100644 index bce9e7698..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py +++ /dev/null @@ -1,96 +0,0 @@ -"""Suite Microsoft Internet Explorer Suite: Events defined by Internet Explorer -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'MSIE' - -class Microsoft_Internet_Explorer_Events: - - def GetSource(self, _object=None, _attributes={}, **_arguments): - """GetSource: Get the HTML source of a browser window - Required argument: Window Identifier of window from which to get the source. No value means get the source from the frontmost window. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'TEXT' - """ - _code = 'MSIE' - _subcode = 'SORC' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def PrintBrowserWindow(self, _object=None, _attributes={}, **_arguments): - """PrintBrowserWindow: Print contents of browser window (HTML) - Required argument: Window Identifier of the window to print. No value means print the frontmost browser window. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'pWND' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_do_script = { - 'window' : 'WIND', - } - - def do_script(self, _object, _attributes={}, **_arguments): - """do script: Execute script commands - Required argument: JavaScript text to execute - Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Return value - """ - _code = 'misc' - _subcode = 'dosc' - - aetools.keysubst(_arguments, self._argmap_do_script) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py deleted file mode 100644 index c274e70d1..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py +++ /dev/null @@ -1,49 +0,0 @@ -"""Suite Netscape Suite: Events defined by Netscape -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'MOSS' - -class Netscape_Suite_Events: - - def Open_bookmark(self, _object=None, _attributes={}, **_arguments): - """Open bookmark: Opens a bookmark file - Required argument: If not available, reloads the current bookmark file - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'book' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py deleted file mode 100644 index 0a985d123..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py +++ /dev/null @@ -1,108 +0,0 @@ -"""Suite Required Suite: Events that every application should support -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'reqd' - -from StdSuites.Required_Suite import * -class Required_Suite_Events(Required_Suite_Events): - - def open(self, _object, _attributes={}, **_arguments): - """open: Open documents - Required argument: undocumented, typecode 'alis' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def print_(self, _object, _attributes={}, **_arguments): - """print: Print documents - Required argument: undocumented, typecode 'alis' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit application - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run(self, _no_object=None, _attributes={}, **_arguments): - """run: - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'oapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py deleted file mode 100644 index 7ead98af9..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Suite Standard Suite: Common terms for most applications -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = '****' - -class Standard_Suite_Events: - - _argmap_get = { - 'as' : 'rtyp', - } - - def get(self, _object, _attributes={}, **_arguments): - """get: - Required argument: an AE object reference - Keyword argument as: undocumented, typecode 'type' - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'core' - _subcode = 'getd' - - aetools.keysubst(_arguments, self._argmap_get) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - An application program """ - want = 'capp' -class _Prop_selected_text(aetools.NProperty): - """selected text - the selected text """ - which = 'stxt' - want = 'TEXT' -selected_text = _Prop_selected_text() -application._superclassnames = [] -application._privpropdict = { - 'selected_text' : _Prop_selected_text, -} -application._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, -} - -_propdeclarations = { - 'stxt' : _Prop_selected_text, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py deleted file mode 100644 index e234546ce..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Suite URL Suite: Standard suite for Uniform Resource Locators -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'GURL' - -class URL_Suite_Events: - - _argmap_GetURL = { - 'to' : 'dest', - } - - def GetURL(self, _object, _attributes={}, **_arguments): - """GetURL: Open the URL (and optionally save it to disk) - Required argument: URL to open - Keyword argument to: File into which to save resource located at URL. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'GURL' - _subcode = 'GURL' - - aetools.keysubst(_arguments, self._argmap_GetURL) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py deleted file mode 100644 index ff808eb96..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py +++ /dev/null @@ -1,226 +0,0 @@ -"""Suite Web Browser Suite: Class of events supported by Web Browser applications -Level 1, version 1 - -Generated from /Applications/Internet Explorer.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'WWW!' - -class Web_Browser_Suite_Events: - - def Activate(self, _object=None, _attributes={}, **_arguments): - """Activate: Activate Internet Explorer and optionally select window designated by Window Identifier. - Required argument: Window Identifier - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Window Identifier of window to activate - """ - _code = 'WWW!' - _subcode = 'ACTV' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): - """CloseAllWindows: Closes all windows - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Success - """ - _code = 'WWW!' - _subcode = 'CLSA' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_CloseWindow = { - 'ID' : 'WIND', - 'Title' : 'TITL', - } - - def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): - """CloseWindow: Close the window specified by either Window Identifier or Title. If no parameter is specified, close the top window. - Keyword argument ID: ID of the window to close. (Can use -1 for top window) - Keyword argument Title: Title of the window to close - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Success - """ - _code = 'WWW!' - _subcode = 'CLOS' - - aetools.keysubst(_arguments, self._argmap_CloseWindow) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def GetWindowInfo(self, _object, _attributes={}, **_arguments): - """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. - Required argument: Window Identifier of the window - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: - """ - _code = 'WWW!' - _subcode = 'WNFO' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def ListWindows(self, _no_object=None, _attributes={}, **_arguments): - """ListWindows: Returns list of Window Identifiers for all open windows. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'WWW!' - _subcode = 'LSTW' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_OpenURL = { - 'to' : 'INTO', - 'toWindow' : 'WIND', - 'Flags' : 'FLGS', - 'FormData' : 'POST', - 'MIME_Type' : 'MIME', - } - - def OpenURL(self, _object, _attributes={}, **_arguments): - """OpenURL: Retrieves URL off the Web. - Required argument: Fully-qualified URL - Keyword argument to: Target file for saving downloaded data - Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) - Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. - Keyword argument FormData: data to post - Keyword argument MIME_Type: MIME type of data being posted - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'OURL' - - aetools.keysubst(_arguments, self._argmap_OpenURL) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_ParseAnchor = { - 'withURL' : 'RELA', - } - - def ParseAnchor(self, _object, _attributes={}, **_arguments): - """ParseAnchor: Combines a base URL and a relative URL to produce a fully-qualified URL - Required argument: Base URL - Keyword argument withURL: Relative URL that is combined with the Base URL (in the direct object) to produce a fully-qualified URL. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Fully-qualified URL - """ - _code = 'WWW!' - _subcode = 'PRSA' - - aetools.keysubst(_arguments, self._argmap_ParseAnchor) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_ShowFile = { - 'MIME_Type' : 'MIME', - 'Window_Identifier' : 'WIND', - 'URL' : 'URL ', - } - - def ShowFile(self, _object, _attributes={}, **_arguments): - """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. - Required argument: The file - Keyword argument MIME_Type: MIME type - Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) - Keyword argument URL: URL that allows this document to be reloaded. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'SHWF' - - aetools.keysubst(_arguments, self._argmap_ShowFile) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/__init__.py deleted file mode 100644 index a9b09b041..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Explorer/__init__.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -Package generated from /Applications/Internet Explorer.app -""" -import aetools -Error = aetools.Error -import Standard_Suite -import URL_Suite -import Netscape_Suite -import Microsoft_Internet_Explorer -import Web_Browser_Suite -import Required_Suite - - -_code_to_module = { - '****' : Standard_Suite, - 'GURL' : URL_Suite, - 'MOSS' : Netscape_Suite, - 'MSIE' : Microsoft_Internet_Explorer, - 'WWW!' : Web_Browser_Suite, - 'reqd' : Required_Suite, -} - - - -_code_to_fullname = { - '****' : ('Explorer.Standard_Suite', 'Standard_Suite'), - 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), - 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), - 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), - 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), - 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), -} - -from Standard_Suite import * -from URL_Suite import * -from Netscape_Suite import * -from Microsoft_Internet_Explorer import * -from Web_Browser_Suite import * -from Required_Suite import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(application) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, -} - - -class Explorer(Standard_Suite_Events, - URL_Suite_Events, - Netscape_Suite_Events, - Microsoft_Internet_Explorer_Events, - Web_Browser_Suite_Events, - Required_Suite_Events, - aetools.TalkTo): - _signature = 'MSIE' - - _moduleName = 'Explorer' - - _elemdict = application._elemdict - _propdict = application._propdict diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py deleted file mode 100644 index e495ef496..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py +++ /dev/null @@ -1,279 +0,0 @@ -"""Suite Containers and folders: Classes that can contain other file system items -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fndr' - -class Containers_and_folders_Events: - - pass - - -class disk(aetools.ComponentItem): - """disk - A disk """ - want = 'cdis' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - inherits some of its properties from the container class """ - which = 'c@#^' - want = 'ctnr' -class _Prop_capacity(aetools.NProperty): - """capacity - the total number of bytes (free or used) on the disk """ - which = 'capa' - want = 'comp' -class _Prop_ejectable(aetools.NProperty): - """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ - which = 'isej' - want = 'bool' -class _Prop_format(aetools.NProperty): - """format - the filesystem format of this disk """ - which = 'dfmt' - want = 'edfm' -class _Prop_free_space(aetools.NProperty): - """free space - the number of free bytes left on the disk """ - which = 'frsp' - want = 'comp' -class _Prop_ignore_privileges(aetools.NProperty): - """ignore privileges - Ignore permissions on this disk? """ - which = 'igpr' - want = 'bool' -class _Prop_local_volume(aetools.NProperty): - """local volume - Is the media a local volume (as opposed to a file server)? """ - which = 'isrv' - want = 'bool' -class _Prop_startup(aetools.NProperty): - """startup - Is this disk the boot disk? """ - which = 'istd' - want = 'bool' -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'name'] -# element 'ctnr' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] - -disks = disk - -class desktop_2d_object(aetools.ComponentItem): - """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ - want = 'cdsk' -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'cdis' as ['indx', 'name'] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'name'] -# element 'ctnr' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] - -class folder(aetools.ComponentItem): - """folder - A folder """ - want = 'cfol' -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'name'] -# element 'ctnr' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] - -folders = folder - -class container(aetools.ComponentItem): - """container - An item that contains other items """ - want = 'ctnr' -class _Prop_completely_expanded(aetools.NProperty): - """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ - which = 'pexc' - want = 'bool' -class _Prop_container_window(aetools.NProperty): - """container window - the container window for this folder """ - which = 'cwnd' - want = 'obj ' -class _Prop_entire_contents(aetools.NProperty): - """entire contents - the entire contents of the container, including the contents of its children """ - which = 'ects' - want = 'obj ' -class _Prop_expandable(aetools.NProperty): - """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ - which = 'pexa' - want = 'bool' -class _Prop_expanded(aetools.NProperty): - """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ - which = 'pexp' - want = 'bool' -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'name'] -# element 'ctnr' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] - -containers = container - -class trash_2d_object(aetools.ComponentItem): - """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ - want = 'ctrs' -class _Prop_warns_before_emptying(aetools.NProperty): - """warns before emptying - Display a dialog when emptying the trash? """ - which = 'warn' - want = 'bool' -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'name'] -# element 'ctnr' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] -disk._superclassnames = ['container'] -import Files -import Finder_items -disk._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'capacity' : _Prop_capacity, - 'ejectable' : _Prop_ejectable, - 'format' : _Prop_format, - 'free_space' : _Prop_free_space, - 'ignore_privileges' : _Prop_ignore_privileges, - 'local_volume' : _Prop_local_volume, - 'startup' : _Prop_startup, -} -disk._privelemdict = { - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'container' : container, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, -} -desktop_2d_object._superclassnames = ['container'] -desktop_2d_object._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -desktop_2d_object._privelemdict = { - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'container' : container, - 'disk' : disk, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, -} -folder._superclassnames = ['container'] -folder._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -folder._privelemdict = { - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'container' : container, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, -} -container._superclassnames = ['item'] -container._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'completely_expanded' : _Prop_completely_expanded, - 'container_window' : _Prop_container_window, - 'entire_contents' : _Prop_entire_contents, - 'expandable' : _Prop_expandable, - 'expanded' : _Prop_expanded, -} -container._privelemdict = { - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'container' : container, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, -} -trash_2d_object._superclassnames = ['container'] -trash_2d_object._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'warns_before_emptying' : _Prop_warns_before_emptying, -} -trash_2d_object._privelemdict = { - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'container' : container, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cdis' : disk, - 'cdsk' : desktop_2d_object, - 'cfol' : folder, - 'ctnr' : container, - 'ctrs' : trash_2d_object, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'capa' : _Prop_capacity, - 'cwnd' : _Prop_container_window, - 'dfmt' : _Prop_format, - 'ects' : _Prop_entire_contents, - 'frsp' : _Prop_free_space, - 'igpr' : _Prop_ignore_privileges, - 'isej' : _Prop_ejectable, - 'isrv' : _Prop_local_volume, - 'istd' : _Prop_startup, - 'pexa' : _Prop_expandable, - 'pexc' : _Prop_completely_expanded, - 'pexp' : _Prop_expanded, - 'warn' : _Prop_warns_before_emptying, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Enumerations.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Enumerations.py deleted file mode 100644 index 558d7ff23..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Enumerations.py +++ /dev/null @@ -1,145 +0,0 @@ -"""Suite Enumerations: Enumerations for the Finder -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'tpnm' - -from StdSuites.Type_Names_Suite import * -class Enumerations_Events(Type_Names_Suite_Events): - - pass - -_Enum_earr = { - 'not_arranged' : 'narr', # - 'snap_to_grid' : 'grda', # - 'arranged_by_name' : 'nama', # - 'arranged_by_modification_date' : 'mdta', # - 'arranged_by_creation_date' : 'cdta', # - 'arranged_by_size' : 'siza', # - 'arranged_by_kind' : 'kina', # - 'arranged_by_label' : 'laba', # -} - -_Enum_ecvw = { - 'icon_view' : 'icnv', # - 'list_view' : 'lsvw', # - 'column_view' : 'clvw', # -} - -_Enum_edfm = { - 'Mac_OS_format' : 'dfhf', # - 'Mac_OS_Extended_format' : 'dfh+', # - 'UFS_format' : 'dfuf', # - 'NFS_format' : 'dfnf', # - 'audio_format' : 'dfau', # - 'ProDOS_format' : 'dfpr', # - 'MS_2d_DOS_format' : 'dfms', # - 'ISO_9660_format' : 'df96', # - 'High_Sierra_format' : 'dfhs', # - 'QuickTake_format' : 'dfqt', # - 'Apple_Photo_format' : 'dfph', # - 'AppleShare_format' : 'dfas', # - 'UDF_format' : 'dfud', # - 'WebDAV_format' : 'dfwd', # - 'FTP_format' : 'dfft', # - 'Packet_2d_written_UDF_format' : 'dfpu', # - 'unknown_format' : 'df??', # -} - -_Enum_elsv = { - 'name_column' : 'elsn', # - 'modification_date_column' : 'elsm', # - 'creation_date_column' : 'elsc', # - 'size_column' : 'elss', # - 'kind_column' : 'elsk', # - 'label_column' : 'elsl', # - 'version_column' : 'elsv', # - 'comment_column' : 'elsC', # -} - -_Enum_ipnl = { - 'General_Information_panel' : 'gpnl', # - 'Sharing_panel' : 'spnl', # - 'Memory_panel' : 'mpnl', # - 'Preview_panel' : 'vpnl', # - 'Application_panel' : 'apnl', # - 'Languages_panel' : 'pklg', # - 'Plugins_panel' : 'pkpg', # - 'Name__26__Extension_panel' : 'npnl', # - 'Comments_panel' : 'cpnl', # - 'Content_Index_panel' : 'cinl', # -} - -_Enum_isiz = { - 'mini' : 'miic', # - 'small' : 'smic', # - 'large' : 'lgic', # -} - -_Enum_lvic = { - 'small_icon' : 'smic', # - 'large_icon' : 'lgic', # -} - -_Enum_priv = { - 'read_only' : 'read', # - 'read_write' : 'rdwr', # - 'write_only' : 'writ', # - 'none' : 'none', # -} - -_Enum_sodr = { - 'normal' : 'snrm', # - 'reversed' : 'srvs', # -} - -_Enum_vwby = { - 'conflicts' : 'cflc', # - 'existing_items' : 'exsi', # - 'small_icon' : 'smic', # - 'icon' : 'iimg', # - 'name' : 'pnam', # - 'modification_date' : 'asmo', # - 'size' : 'ptsz', # - 'kind' : 'kind', # - 'comment' : 'comt', # - 'label' : 'labi', # - 'version' : 'vers', # - 'creation_date' : 'ascd', # - 'small_button' : 'smbu', # - 'large_button' : 'lgbu', # - 'grid' : 'grid', # - 'all' : 'kyal', # -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'earr' : _Enum_earr, - 'ecvw' : _Enum_ecvw, - 'edfm' : _Enum_edfm, - 'elsv' : _Enum_elsv, - 'ipnl' : _Enum_ipnl, - 'isiz' : _Enum_isiz, - 'lvic' : _Enum_lvic, - 'priv' : _Enum_priv, - 'sodr' : _Enum_sodr, - 'vwby' : _Enum_vwby, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Files.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Files.py deleted file mode 100644 index ddbe1bafb..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Files.py +++ /dev/null @@ -1,212 +0,0 @@ -"""Suite Files: Classes representing files -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fndr' - -class Files_Events: - - pass - - -class alias_file(aetools.ComponentItem): - """alias file - An alias file (created with \xd2Make Alias\xd3) """ - want = 'alia' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - inherits some of its properties from the file class """ - which = 'c@#^' - want = 'file' -class _Prop_original_item(aetools.NProperty): - """original item - the original item pointed to by the alias """ - which = 'orig' - want = 'obj ' - -alias_files = alias_file - -class application_file(aetools.ComponentItem): - """application file - An application's file on disk """ - want = 'appf' -class _Prop_accepts_high_level_events(aetools.NProperty): - """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ - which = 'isab' - want = 'bool' -class _Prop_has_scripting_terminology(aetools.NProperty): - """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ - which = 'hscr' - want = 'bool' -class _Prop_minimum_size(aetools.NProperty): - """minimum size - the smallest memory size with which the application can be launched """ - which = 'mprt' - want = 'long' -class _Prop_opens_in_Classic(aetools.NProperty): - """opens in Classic - Should the application launch in the Classic environment? """ - which = 'Clsc' - want = 'bool' -class _Prop_preferred_size(aetools.NProperty): - """preferred size - the memory size with which the application will be launched """ - which = 'appt' - want = 'long' -class _Prop_suggested_size(aetools.NProperty): - """suggested size - the memory size with which the developer recommends the application be launched """ - which = 'sprt' - want = 'long' - -application_files = application_file - -class clipping(aetools.ComponentItem): - """clipping - A clipping """ - want = 'clpf' -class _Prop_clipping_window(aetools.NProperty): - """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ - which = 'lwnd' - want = 'obj ' - -clippings = clipping - -class document_file(aetools.ComponentItem): - """document file - A document file """ - want = 'docf' - -document_files = document_file - -class file(aetools.ComponentItem): - """file - A file """ - want = 'file' -class _Prop_creator_type(aetools.NProperty): - """creator type - the OSType identifying the application that created the item """ - which = 'fcrt' - want = 'type' -class _Prop_file_type(aetools.NProperty): - """file type - the OSType identifying the type of data contained in the item """ - which = 'asty' - want = 'type' -class _Prop_product_version(aetools.NProperty): - """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ - which = 'ver2' - want = 'utxt' -class _Prop_stationery(aetools.NProperty): - """stationery - Is the file a stationery pad? """ - which = 'pspd' - want = 'bool' -class _Prop_version(aetools.NProperty): - """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ - which = 'vers' - want = 'utxt' - -files = file - -class internet_location_file(aetools.ComponentItem): - """internet location file - An file containing an internet location """ - want = 'inlf' -class _Prop_location(aetools.NProperty): - """location - the internet location """ - which = 'iloc' - want = 'utxt' - -internet_location_files = internet_location_file - -class package(aetools.ComponentItem): - """package - A package """ - want = 'pack' - -packages = package -alias_file._superclassnames = ['file'] -alias_file._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'original_item' : _Prop_original_item, -} -alias_file._privelemdict = { -} -application_file._superclassnames = ['file'] -application_file._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'accepts_high_level_events' : _Prop_accepts_high_level_events, - 'has_scripting_terminology' : _Prop_has_scripting_terminology, - 'minimum_size' : _Prop_minimum_size, - 'opens_in_Classic' : _Prop_opens_in_Classic, - 'preferred_size' : _Prop_preferred_size, - 'suggested_size' : _Prop_suggested_size, -} -application_file._privelemdict = { -} -clipping._superclassnames = ['file'] -clipping._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'clipping_window' : _Prop_clipping_window, -} -clipping._privelemdict = { -} -document_file._superclassnames = ['file'] -document_file._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -document_file._privelemdict = { -} -import Finder_items -file._superclassnames = ['item'] -file._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'creator_type' : _Prop_creator_type, - 'file_type' : _Prop_file_type, - 'product_version' : _Prop_product_version, - 'stationery' : _Prop_stationery, - 'version' : _Prop_version, -} -file._privelemdict = { -} -internet_location_file._superclassnames = ['file'] -internet_location_file._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'location' : _Prop_location, -} -internet_location_file._privelemdict = { -} -package._superclassnames = ['item'] -package._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -package._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'alia' : alias_file, - 'appf' : application_file, - 'clpf' : clipping, - 'docf' : document_file, - 'file' : file, - 'inlf' : internet_location_file, - 'pack' : package, -} - -_propdeclarations = { - 'Clsc' : _Prop_opens_in_Classic, - 'appt' : _Prop_preferred_size, - 'asty' : _Prop_file_type, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'fcrt' : _Prop_creator_type, - 'hscr' : _Prop_has_scripting_terminology, - 'iloc' : _Prop_location, - 'isab' : _Prop_accepts_high_level_events, - 'lwnd' : _Prop_clipping_window, - 'mprt' : _Prop_minimum_size, - 'orig' : _Prop_original_item, - 'pspd' : _Prop_stationery, - 'sprt' : _Prop_suggested_size, - 'ver2' : _Prop_product_version, - 'vers' : _Prop_version, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py deleted file mode 100644 index c0a7b2005..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py +++ /dev/null @@ -1,207 +0,0 @@ -"""Suite Finder Basics: Commonly-used Finder commands and object classes -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fndr' - -class Finder_Basics_Events: - - def copy(self, _no_object=None, _attributes={}, **_arguments): - """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application) - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'copy' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_sort = { - 'by' : 'by ', - } - - def sort(self, _object, _attributes={}, **_arguments): - """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list - Required argument: a list of finder objects to sort - Keyword argument by: the property to sort the items by (name, index, date, etc.) - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the sorted items in their new order - """ - _code = 'DATA' - _subcode = 'SORT' - - aetools.keysubst(_arguments, self._argmap_sort) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The Finder """ - want = 'capp' -class _Prop_Finder_preferences(aetools.NProperty): - """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ - which = 'pfrp' - want = 'cprf' -Finder_preferences = _Prop_Finder_preferences() -class _Prop_clipboard(aetools.NProperty): - """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ - which = 'pcli' - want = 'obj ' -clipboard = _Prop_clipboard() -class _Prop_desktop(aetools.NProperty): - """desktop - the desktop """ - which = 'desk' - want = 'cdsk' -desktop = _Prop_desktop() -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is the Finder the frontmost process? """ - which = 'pisf' - want = 'bool' -frontmost = _Prop_frontmost() -class _Prop_home(aetools.NProperty): - """home - the home directory """ - which = 'home' - want = 'cfol' -home = _Prop_home() -class _Prop_insertion_location(aetools.NProperty): - """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ - which = 'pins' - want = 'obj ' -insertion_location = _Prop_insertion_location() -class _Prop_name(aetools.NProperty): - """name - the Finder\xd5s name """ - which = 'pnam' - want = 'itxt' -name = _Prop_name() -class _Prop_product_version(aetools.NProperty): - """product version - the version of the System software running on this computer """ - which = 'ver2' - want = 'utxt' -product_version = _Prop_product_version() -class _Prop_selection(aetools.NProperty): - """selection - the selection in the frontmost Finder window """ - which = 'sele' - want = 'obj ' -selection = _Prop_selection() -class _Prop_startup_disk(aetools.NProperty): - """startup disk - the startup disk """ - which = 'sdsk' - want = 'cdis' -startup_disk = _Prop_startup_disk() -class _Prop_trash(aetools.NProperty): - """trash - the trash """ - which = 'trsh' - want = 'ctrs' -trash = _Prop_trash() -class _Prop_version(aetools.NProperty): - """version - the version of the Finder """ - which = 'vers' - want = 'utxt' -version = _Prop_version() -class _Prop_visible(aetools.NProperty): - """visible - Is the Finder\xd5s layer visible? """ - which = 'pvis' - want = 'bool' -visible = _Prop_visible() -# element 'alia' as ['indx', 'name'] -# element 'appf' as ['indx', 'name', 'ID '] -# element 'brow' as ['indx', 'ID '] -# element 'cdis' as ['indx', 'name', 'ID '] -# element 'cfol' as ['indx', 'name', 'ID '] -# element 'clpf' as ['indx', 'name'] -# element 'cobj' as ['indx', 'rele', 'name', 'rang', 'test'] -# element 'ctnr' as ['indx', 'name'] -# element 'cwin' as ['indx', 'name'] -# element 'docf' as ['indx', 'name'] -# element 'file' as ['indx', 'name'] -# element 'inlf' as ['indx', 'name'] -# element 'lwnd' as ['indx', 'name'] -# element 'pack' as ['indx', 'name'] -application._superclassnames = [] -import Files -import Window_classes -import Containers_and_folders -import Finder_items -application._privpropdict = { - 'Finder_preferences' : _Prop_Finder_preferences, - 'clipboard' : _Prop_clipboard, - 'desktop' : _Prop_desktop, - 'frontmost' : _Prop_frontmost, - 'home' : _Prop_home, - 'insertion_location' : _Prop_insertion_location, - 'name' : _Prop_name, - 'product_version' : _Prop_product_version, - 'selection' : _Prop_selection, - 'startup_disk' : _Prop_startup_disk, - 'trash' : _Prop_trash, - 'version' : _Prop_version, - 'visible' : _Prop_visible, -} -application._privelemdict = { - 'Finder_window' : Window_classes.Finder_window, - 'alias_file' : Files.alias_file, - 'application_file' : Files.application_file, - 'clipping' : Files.clipping, - 'clipping_window' : Window_classes.clipping_window, - 'container' : Containers_and_folders.container, - 'disk' : Containers_and_folders.disk, - 'document_file' : Files.document_file, - 'file' : Files.file, - 'folder' : Containers_and_folders.folder, - 'internet_location_file' : Files.internet_location_file, - 'item' : Finder_items.item, - 'package' : Files.package, - 'window' : Window_classes.window, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, -} - -_propdeclarations = { - 'desk' : _Prop_desktop, - 'home' : _Prop_home, - 'pcli' : _Prop_clipboard, - 'pfrp' : _Prop_Finder_preferences, - 'pins' : _Prop_insertion_location, - 'pisf' : _Prop_frontmost, - 'pnam' : _Prop_name, - 'pvis' : _Prop_visible, - 'sdsk' : _Prop_startup_disk, - 'sele' : _Prop_selection, - 'trsh' : _Prop_trash, - 'ver2' : _Prop_product_version, - 'vers' : _Prop_version, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_items.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_items.py deleted file mode 100644 index 7120ea6c5..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Finder_items.py +++ /dev/null @@ -1,355 +0,0 @@ -"""Suite Finder items: Commands used with file system items, and basic item definition -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fndr' - -class Finder_items_Events: - - def add_to_favorites(self, _object, _attributes={}, **_arguments): - """add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites - Required argument: the items to add to the collection of Favorites - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'ffav' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_clean_up = { - 'by' : 'by ', - } - - def clean_up(self, _object, _attributes={}, **_arguments): - """clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged) - Required argument: the window to clean up - Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'fclu' - - aetools.keysubst(_arguments, self._argmap_clean_up) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def eject(self, _object=None, _attributes={}, **_arguments): - """eject: Eject the specified disk(s) - Required argument: the disk(s) to eject - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'ejct' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def empty(self, _object=None, _attributes={}, **_arguments): - """empty: Empty the trash - Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'empt' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def erase(self, _object, _attributes={}, **_arguments): - """erase: (NOT AVAILABLE) Erase the specified disk(s) - Required argument: the items to erase - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'fera' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def reveal(self, _object, _attributes={}, **_arguments): - """reveal: Bring the specified object(s) into view - Required argument: the object to be made visible - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'mvis' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_update = { - 'necessity' : 'nec?', - 'registering_applications' : 'reg?', - } - - def update(self, _object, _attributes={}, **_arguments): - """update: Update the display of the specified object(s) to match their on-disk representation - Required argument: the item to update - Keyword argument necessity: only update if necessary (i.e. a finder window is open). default is false - Keyword argument registering_applications: register applications. default is true - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'fupd' - - aetools.keysubst(_arguments, self._argmap_update) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class item(aetools.ComponentItem): - """item - An item """ - want = 'cobj' -class _Prop_bounds(aetools.NProperty): - """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ - which = 'pbnd' - want = 'qdrt' -class _Prop_comment(aetools.NProperty): - """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ - which = 'comt' - want = 'utxt' -class _Prop_container(aetools.NProperty): - """container - the container of the item """ - which = 'ctnr' - want = 'obj ' -class _Prop_creation_date(aetools.NProperty): - """creation date - the date on which the item was created """ - which = 'ascd' - want = 'ldt ' -class _Prop_description(aetools.NProperty): - """description - a description of the item """ - which = 'dscr' - want = 'utxt' -class _Prop_disk(aetools.NProperty): - """disk - the disk on which the item is stored """ - which = 'cdis' - want = 'obj ' -class _Prop_displayed_name(aetools.NProperty): - """displayed name - the user-visible name of the item """ - which = 'dnam' - want = 'utxt' -class _Prop_everyones_privileges(aetools.NProperty): - """everyones privileges - """ - which = 'gstp' - want = 'priv' -class _Prop_extension_hidden(aetools.NProperty): - """extension hidden - Is the item's extension hidden from the user? """ - which = 'hidx' - want = 'bool' -class _Prop_group(aetools.NProperty): - """group - the user or group that has special access to the container """ - which = 'sgrp' - want = 'utxt' -class _Prop_group_privileges(aetools.NProperty): - """group privileges - """ - which = 'gppr' - want = 'priv' -class _Prop_icon(aetools.NProperty): - """icon - the icon bitmap of the item """ - which = 'iimg' - want = 'ifam' -class _Prop_index(aetools.NProperty): - """index - the index in the front-to-back ordering within its container """ - which = 'pidx' - want = 'long' -class _Prop_information_window(aetools.NProperty): - """information window - the information window for the item """ - which = 'iwnd' - want = 'obj ' -class _Prop_kind(aetools.NProperty): - """kind - the kind of the item """ - which = 'kind' - want = 'utxt' -class _Prop_label_index(aetools.NProperty): - """label index - the label of the item """ - which = 'labi' - want = 'long' -class _Prop_locked(aetools.NProperty): - """locked - Is the file locked? """ - which = 'aslk' - want = 'bool' -class _Prop_modification_date(aetools.NProperty): - """modification date - the date on which the item was last modified """ - which = 'asmo' - want = 'ldt ' -class _Prop_name(aetools.NProperty): - """name - the name of the item """ - which = 'pnam' - want = 'utxt' -class _Prop_name_extension(aetools.NProperty): - """name extension - the name extension of the item (such as \xd2txt\xd3) """ - which = 'nmxt' - want = 'utxt' -class _Prop_owner(aetools.NProperty): - """owner - the user that owns the container """ - which = 'sown' - want = 'utxt' -class _Prop_owner_privileges(aetools.NProperty): - """owner privileges - """ - which = 'ownr' - want = 'priv' -class _Prop_physical_size(aetools.NProperty): - """physical size - the actual space used by the item on disk """ - which = 'phys' - want = 'comp' -class _Prop_position(aetools.NProperty): - """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ - which = 'posn' - want = 'QDpt' -class _Prop_properties(aetools.NProperty): - """properties - every property of an item """ - which = 'pALL' - want = 'reco' -class _Prop_size(aetools.NProperty): - """size - the logical size of the item """ - which = 'ptsz' - want = 'comp' -class _Prop_url(aetools.NProperty): - """url - the url of the item """ - which = 'pURL' - want = 'utxt' - -items = item -item._superclassnames = [] -item._privpropdict = { - 'bounds' : _Prop_bounds, - 'comment' : _Prop_comment, - 'container' : _Prop_container, - 'creation_date' : _Prop_creation_date, - 'description' : _Prop_description, - 'disk' : _Prop_disk, - 'displayed_name' : _Prop_displayed_name, - 'everyones_privileges' : _Prop_everyones_privileges, - 'extension_hidden' : _Prop_extension_hidden, - 'group' : _Prop_group, - 'group_privileges' : _Prop_group_privileges, - 'icon' : _Prop_icon, - 'index' : _Prop_index, - 'information_window' : _Prop_information_window, - 'kind' : _Prop_kind, - 'label_index' : _Prop_label_index, - 'locked' : _Prop_locked, - 'modification_date' : _Prop_modification_date, - 'name' : _Prop_name, - 'name_extension' : _Prop_name_extension, - 'owner' : _Prop_owner, - 'owner_privileges' : _Prop_owner_privileges, - 'physical_size' : _Prop_physical_size, - 'position' : _Prop_position, - 'properties' : _Prop_properties, - 'size' : _Prop_size, - 'url' : _Prop_url, -} -item._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cobj' : item, -} - -_propdeclarations = { - 'ascd' : _Prop_creation_date, - 'aslk' : _Prop_locked, - 'asmo' : _Prop_modification_date, - 'cdis' : _Prop_disk, - 'comt' : _Prop_comment, - 'ctnr' : _Prop_container, - 'dnam' : _Prop_displayed_name, - 'dscr' : _Prop_description, - 'gppr' : _Prop_group_privileges, - 'gstp' : _Prop_everyones_privileges, - 'hidx' : _Prop_extension_hidden, - 'iimg' : _Prop_icon, - 'iwnd' : _Prop_information_window, - 'kind' : _Prop_kind, - 'labi' : _Prop_label_index, - 'nmxt' : _Prop_name_extension, - 'ownr' : _Prop_owner_privileges, - 'pALL' : _Prop_properties, - 'pURL' : _Prop_url, - 'pbnd' : _Prop_bounds, - 'phys' : _Prop_physical_size, - 'pidx' : _Prop_index, - 'pnam' : _Prop_name, - 'posn' : _Prop_position, - 'ptsz' : _Prop_size, - 'sgrp' : _Prop_group, - 'sown' : _Prop_owner, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py deleted file mode 100644 index 69da62668..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Suite Legacy suite: Operations formerly handled by the Finder, but now automatically delegated to other applications -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fleg' - -class Legacy_suite_Events: - - def restart(self, _no_object=None, _attributes={}, **_arguments): - """restart: Restart the computer - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'rest' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def shut_down(self, _no_object=None, _attributes={}, **_arguments): - """shut down: Shut Down the computer - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'shut' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def sleep(self, _no_object=None, _attributes={}, **_arguments): - """sleep: Put the computer to sleep - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'slep' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The Finder """ - want = 'capp' -class _Prop_desktop_picture(aetools.NProperty): - """desktop picture - the desktop picture of the main monitor """ - which = 'dpic' - want = 'file' -desktop_picture = _Prop_desktop_picture() - -class application_process(aetools.ComponentItem): - """application process - A process launched from an application file """ - want = 'pcap' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - inherits some of its properties from the process class """ - which = 'c@#^' - want = 'prcs' -class _Prop_application_file(aetools.NProperty): - """application file - the application file from which this process was launched """ - which = 'appf' - want = 'appf' - -application_processes = application_process - -class desk_accessory_process(aetools.ComponentItem): - """desk accessory process - A process launched from a desk accessory file """ - want = 'pcda' -class _Prop_desk_accessory_file(aetools.NProperty): - """desk accessory file - the desk accessory file from which this process was launched """ - which = 'dafi' - want = 'obj ' - -desk_accessory_processes = desk_accessory_process - -class process(aetools.ComponentItem): - """process - A process running on this computer """ - want = 'prcs' -class _Prop_accepts_high_level_events(aetools.NProperty): - """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ - which = 'isab' - want = 'bool' -class _Prop_accepts_remote_events(aetools.NProperty): - """accepts remote events - Does the process accept remote events? """ - which = 'revt' - want = 'bool' -class _Prop_creator_type(aetools.NProperty): - """creator type - the OSType of the creator of the process (the signature) """ - which = 'fcrt' - want = 'type' -class _Prop_file(aetools.NProperty): - """file - the file from which the process was launched """ - which = 'file' - want = 'obj ' -class _Prop_file_type(aetools.NProperty): - """file type - the OSType of the file type of the process """ - which = 'asty' - want = 'type' -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is the process the frontmost process? """ - which = 'pisf' - want = 'bool' -class _Prop_has_scripting_terminology(aetools.NProperty): - """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ - which = 'hscr' - want = 'bool' -class _Prop_name(aetools.NProperty): - """name - the name of the process """ - which = 'pnam' - want = 'itxt' -class _Prop_partition_space_used(aetools.NProperty): - """partition space used - the number of bytes currently used in the process' partition """ - which = 'pusd' - want = 'long' -class _Prop_total_partition_size(aetools.NProperty): - """total partition size - the size of the partition with which the process was launched """ - which = 'appt' - want = 'long' -class _Prop_visible(aetools.NProperty): - """visible - Is the process' layer visible? """ - which = 'pvis' - want = 'bool' - -processes = process -application._superclassnames = [] -application._privpropdict = { - 'desktop_picture' : _Prop_desktop_picture, -} -application._privelemdict = { -} -application_process._superclassnames = ['process'] -application_process._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'application_file' : _Prop_application_file, -} -application_process._privelemdict = { -} -desk_accessory_process._superclassnames = ['process'] -desk_accessory_process._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'desk_accessory_file' : _Prop_desk_accessory_file, -} -desk_accessory_process._privelemdict = { -} -process._superclassnames = [] -process._privpropdict = { - 'accepts_high_level_events' : _Prop_accepts_high_level_events, - 'accepts_remote_events' : _Prop_accepts_remote_events, - 'creator_type' : _Prop_creator_type, - 'file' : _Prop_file, - 'file_type' : _Prop_file_type, - 'frontmost' : _Prop_frontmost, - 'has_scripting_terminology' : _Prop_has_scripting_terminology, - 'name' : _Prop_name, - 'partition_space_used' : _Prop_partition_space_used, - 'total_partition_size' : _Prop_total_partition_size, - 'visible' : _Prop_visible, -} -process._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'prcs' : process, -} - -_propdeclarations = { - 'appf' : _Prop_application_file, - 'appt' : _Prop_total_partition_size, - 'asty' : _Prop_file_type, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'dafi' : _Prop_desk_accessory_file, - 'dpic' : _Prop_desktop_picture, - 'fcrt' : _Prop_creator_type, - 'file' : _Prop_file, - 'hscr' : _Prop_has_scripting_terminology, - 'isab' : _Prop_accepts_high_level_events, - 'pisf' : _Prop_frontmost, - 'pnam' : _Prop_name, - 'pusd' : _Prop_partition_space_used, - 'pvis' : _Prop_visible, - 'revt' : _Prop_accepts_remote_events, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py deleted file mode 100644 index 830f58c83..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py +++ /dev/null @@ -1,335 +0,0 @@ -"""Suite Standard Suite: Common terms that most applications should support -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'CoRe' - -from StdSuites.Standard_Suite import * -class Standard_Suite_Events(Standard_Suite_Events): - - def close(self, _object, _attributes={}, **_arguments): - """close: Close an object - Required argument: the object to close - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_count = { - 'each' : 'kocl', - } - - def count(self, _object, _attributes={}, **_arguments): - """count: Return the number of elements of a particular class within an object - Required argument: the object whose elements are to be counted - Keyword argument each: the class of the elements to be counted - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of elements - """ - _code = 'core' - _subcode = 'cnte' - - aetools.keysubst(_arguments, self._argmap_count) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_data_size = { - 'as' : 'rtyp', - } - - def data_size(self, _object, _attributes={}, **_arguments): - """data size: Return the size in bytes of an object - Required argument: the object whose data size is to be returned - Keyword argument as: the data type for which the size is calculated - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the size of the object in bytes - """ - _code = 'core' - _subcode = 'dsiz' - - aetools.keysubst(_arguments, self._argmap_data_size) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def delete(self, _object, _attributes={}, **_arguments): - """delete: Move an item from its container to the trash - Required argument: the item to delete - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the item that was just deleted - """ - _code = 'core' - _subcode = 'delo' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_duplicate = { - 'to' : 'insh', - 'replacing' : 'alrp', - 'routing_suppressed' : 'rout', - } - - def duplicate(self, _object, _attributes={}, **_arguments): - """duplicate: Duplicate one or more object(s) - Required argument: the object(s) to duplicate - Keyword argument to: the new location for the object(s) - Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being duplicated - Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when copying to the system folder. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the duplicated object(s) - """ - _code = 'core' - _subcode = 'clon' - - aetools.keysubst(_arguments, self._argmap_duplicate) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'alrp', _Enum_bool) - aetools.enumsubst(_arguments, 'rout', _Enum_bool) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def exists(self, _object, _attributes={}, **_arguments): - """exists: Verify if an object exists - Required argument: the object in question - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: true if it exists, false if not - """ - _code = 'core' - _subcode = 'doex' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_make = { - 'new' : 'kocl', - 'at' : 'insh', - 'to' : 'to ', - 'with_properties' : 'prdt', - } - - def make(self, _no_object=None, _attributes={}, **_arguments): - """make: Make a new element - Keyword argument new: the class of the new element - Keyword argument at: the location at which to insert the element - Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window - Keyword argument with_properties: the initial values for the properties of the element - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the new object(s) - """ - _code = 'core' - _subcode = 'crel' - - aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_move = { - 'to' : 'insh', - 'replacing' : 'alrp', - 'positioned_at' : 'mvpl', - 'routing_suppressed' : 'rout', - } - - def move(self, _object, _attributes={}, **_arguments): - """move: Move object(s) to a new location - Required argument: the object(s) to move - Keyword argument to: the new location for the object(s) - Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being moved - Keyword argument positioned_at: Gives a list (in local window coordinates) of positions for the destination items - Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when moving to the system folder. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the object(s) after they have been moved - """ - _code = 'core' - _subcode = 'move' - - aetools.keysubst(_arguments, self._argmap_move) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'alrp', _Enum_bool) - aetools.enumsubst(_arguments, 'mvpl', _Enum_list) - aetools.enumsubst(_arguments, 'rout', _Enum_bool) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_open = { - 'using' : 'usin', - 'with_properties' : 'prdt', - } - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument using: the application file to open the object with - Keyword argument with_properties: the initial values for the properties, to be included with the open command sent to the application that opens the direct object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - aetools.keysubst(_arguments, self._argmap_open) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_print_ = { - 'with_properties' : 'prdt', - } - - def print_(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument with_properties: optional properties to be included with the print command sent to the application that prints the direct object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - aetools.keysubst(_arguments, self._argmap_print_) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit the Finder - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def select(self, _object, _attributes={}, **_arguments): - """select: Select the specified object(s) - Required argument: the object to select - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'slct' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - -_Enum_list = None # XXXX enum list not found!! -_Enum_bool = None # XXXX enum bool not found!! - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py deleted file mode 100644 index 3e7d81799..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py +++ /dev/null @@ -1,346 +0,0 @@ -"""Suite Type Definitions: Definitions of records used in scripting the Finder -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'tpdf' - -class Type_Definitions_Events: - - pass - - -class alias_list(aetools.ComponentItem): - """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ - want = 'alst' - -class label(aetools.ComponentItem): - """label - (NOT AVAILABLE YET) A Finder label (name and color) """ - want = 'clbl' -class _Prop_color(aetools.NProperty): - """color - the color associated with the label """ - which = 'colr' - want = 'cRGB' -class _Prop_index(aetools.NProperty): - """index - the index in the front-to-back ordering within its container """ - which = 'pidx' - want = 'long' -class _Prop_name(aetools.NProperty): - """name - the name associated with the label """ - which = 'pnam' - want = 'utxt' - -class preferences(aetools.ComponentItem): - """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ - want = 'cprf' -class _Prop_button_view_arrangement(aetools.NProperty): - """button view arrangement - the method of arrangement of icons in default Finder button view windows """ - which = 'barr' - want = 'earr' -class _Prop_button_view_icon_size(aetools.NProperty): - """button view icon size - the size of icons displayed in Finder button view windows. """ - which = 'bisz' - want = 'long' -class _Prop_calculates_folder_sizes(aetools.NProperty): - """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ - which = 'sfsz' - want = 'bool' -class _Prop_delay_before_springing(aetools.NProperty): - """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ - which = 'dela' - want = 'shor' -class _Prop_list_view_icon_size(aetools.NProperty): - """list view icon size - the size of icons displayed in Finder list view windows. """ - which = 'lisz' - want = 'long' -class _Prop_shows_comments(aetools.NProperty): - """shows comments - Are comments displayed in default Finder list view windows? """ - which = 'scom' - want = 'bool' -class _Prop_shows_creation_date(aetools.NProperty): - """shows creation date - Are creation dates displayed in default Finder list view windows? """ - which = 'scda' - want = 'bool' -class _Prop_shows_kind(aetools.NProperty): - """shows kind - Are document kinds displayed in default Finder list view windows? """ - which = 'sknd' - want = 'bool' -class _Prop_shows_label(aetools.NProperty): - """shows label - Are labels displayed in default Finder list view windows? """ - which = 'slbl' - want = 'bool' -class _Prop_shows_modification_date(aetools.NProperty): - """shows modification date - Are modification dates displayed in default Finder list view windows? """ - which = 'sdat' - want = 'bool' -class _Prop_shows_size(aetools.NProperty): - """shows size - Are file sizes displayed in default Finder list view windows? """ - which = 'ssiz' - want = 'bool' -class _Prop_shows_version(aetools.NProperty): - """shows version - Are file versions displayed in default Finder list view windows? """ - which = 'svrs' - want = 'bool' -class _Prop_spatial_view_arrangement(aetools.NProperty): - """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ - which = 'iarr' - want = 'earr' -class _Prop_spatial_view_icon_size(aetools.NProperty): - """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ - which = 'iisz' - want = 'long' -class _Prop_spring_open_folders(aetools.NProperty): - """spring open folders - Spring open folders after the specified delay? """ - which = 'sprg' - want = 'bool' -class _Prop_uses_relative_dates(aetools.NProperty): - """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ - which = 'urdt' - want = 'bool' -class _Prop_uses_simple_menus(aetools.NProperty): - """uses simple menus - Use simplified Finder menus? """ - which = 'usme' - want = 'bool' -class _Prop_uses_wide_grid(aetools.NProperty): - """uses wide grid - Space icons on a wide grid? """ - which = 'uswg' - want = 'bool' -class _Prop_view_font(aetools.NProperty): - """view font - the id of the font used in Finder views. """ - which = 'vfnt' - want = 'long' -class _Prop_view_font_size(aetools.NProperty): - """view font size - the size of the font used in Finder views """ - which = 'vfsz' - want = 'long' -class _Prop_window(aetools.NProperty): - """window - the window that would open if Finder preferences was opened """ - which = 'cwin' - want = 'pwnd' -# element 'clbl' as ['indx', 'name'] - -class icon_view_options(aetools.ComponentItem): - """icon view options - the icon view options """ - want = 'icop' - -_Prop_arrangement = _Prop_spatial_view_arrangement -class _Prop_icon_size(aetools.NProperty): - """icon size - the size of icons displayed in the icon view """ - which = 'lvis' - want = 'shor' - -class icon_family(aetools.ComponentItem): - """icon family - (NOT AVAILABLE YET) A family of icons """ - want = 'ifam' -class _Prop_large_32_bit_icon(aetools.NProperty): - """large 32 bit icon - the large 32-bit color icon """ - which = 'il32' - want = 'il32' -class _Prop_large_4_bit_icon(aetools.NProperty): - """large 4 bit icon - the large 4-bit color icon """ - which = 'icl4' - want = 'icl4' -class _Prop_large_8_bit_icon(aetools.NProperty): - """large 8 bit icon - the large 8-bit color icon """ - which = 'icl8' - want = 'icl8' -class _Prop_large_8_bit_mask(aetools.NProperty): - """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ - which = 'l8mk' - want = 'l8mk' -class _Prop_large_monochrome_icon_and_mask(aetools.NProperty): - """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ - which = 'ICN#' - want = 'ICN#' -class _Prop_small_32_bit_icon(aetools.NProperty): - """small 32 bit icon - the small 32-bit color icon """ - which = 'is32' - want = 'is32' -class _Prop_small_4_bit_icon(aetools.NProperty): - """small 4 bit icon - the small 4-bit color icon """ - which = 'ics4' - want = 'ics4' -class _Prop_small_8_bit_icon(aetools.NProperty): - """small 8 bit icon - the small 8-bit color icon """ - which = 'ics8' - want = 'ics8' - -_Prop_small_8_bit_mask = _Prop_small_8_bit_icon -class _Prop_small_monochrome_icon_and_mask(aetools.NProperty): - """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ - which = 'ics#' - want = 'ics#' - -class column(aetools.ComponentItem): - """column - a column of a list view """ - want = 'lvcl' -class _Prop_sort_direction(aetools.NProperty): - """sort direction - The direction in which the window is sorted """ - which = 'sord' - want = 'sodr' -class _Prop_visible(aetools.NProperty): - """visible - is this column visible """ - which = 'pvis' - want = 'bool' -class _Prop_width(aetools.NProperty): - """width - the width of this column """ - which = 'clwd' - want = 'shor' - -columns = column - -class list_view_options(aetools.ComponentItem): - """list view options - the list view options """ - want = 'lvop' -class _Prop_sort_column(aetools.NProperty): - """sort column - the column that the list view is sorted on """ - which = 'srtc' - want = 'lvcl' -# element 'lvcl' as ['indx', 'rele', 'rang', 'test'] -alias_list._superclassnames = [] -alias_list._privpropdict = { -} -alias_list._privelemdict = { -} -label._superclassnames = [] -label._privpropdict = { - 'color' : _Prop_color, - 'index' : _Prop_index, - 'name' : _Prop_name, -} -label._privelemdict = { -} -preferences._superclassnames = [] -preferences._privpropdict = { - 'button_view_arrangement' : _Prop_button_view_arrangement, - 'button_view_icon_size' : _Prop_button_view_icon_size, - 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, - 'delay_before_springing' : _Prop_delay_before_springing, - 'list_view_icon_size' : _Prop_list_view_icon_size, - 'shows_comments' : _Prop_shows_comments, - 'shows_creation_date' : _Prop_shows_creation_date, - 'shows_kind' : _Prop_shows_kind, - 'shows_label' : _Prop_shows_label, - 'shows_modification_date' : _Prop_shows_modification_date, - 'shows_size' : _Prop_shows_size, - 'shows_version' : _Prop_shows_version, - 'spatial_view_arrangement' : _Prop_spatial_view_arrangement, - 'spatial_view_icon_size' : _Prop_spatial_view_icon_size, - 'spring_open_folders' : _Prop_spring_open_folders, - 'uses_relative_dates' : _Prop_uses_relative_dates, - 'uses_simple_menus' : _Prop_uses_simple_menus, - 'uses_wide_grid' : _Prop_uses_wide_grid, - 'view_font' : _Prop_view_font, - 'view_font_size' : _Prop_view_font_size, - 'window' : _Prop_window, -} -preferences._privelemdict = { - 'label' : label, -} -icon_view_options._superclassnames = [] -icon_view_options._privpropdict = { - 'arrangement' : _Prop_arrangement, - 'icon_size' : _Prop_icon_size, -} -icon_view_options._privelemdict = { -} -icon_family._superclassnames = [] -icon_family._privpropdict = { - 'large_32_bit_icon' : _Prop_large_32_bit_icon, - 'large_4_bit_icon' : _Prop_large_4_bit_icon, - 'large_8_bit_icon' : _Prop_large_8_bit_icon, - 'large_8_bit_mask' : _Prop_large_8_bit_mask, - 'large_monochrome_icon_and_mask' : _Prop_large_monochrome_icon_and_mask, - 'small_32_bit_icon' : _Prop_small_32_bit_icon, - 'small_4_bit_icon' : _Prop_small_4_bit_icon, - 'small_8_bit_icon' : _Prop_small_8_bit_icon, - 'small_8_bit_mask' : _Prop_small_8_bit_mask, - 'small_monochrome_icon_and_mask' : _Prop_small_monochrome_icon_and_mask, -} -icon_family._privelemdict = { -} -column._superclassnames = [] -column._privpropdict = { - 'index' : _Prop_index, - 'name' : _Prop_name, - 'sort_direction' : _Prop_sort_direction, - 'visible' : _Prop_visible, - 'width' : _Prop_width, -} -column._privelemdict = { -} -list_view_options._superclassnames = [] -list_view_options._privpropdict = { - 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, - 'icon_size' : _Prop_icon_size, - 'sort_column' : _Prop_sort_column, - 'uses_relative_dates' : _Prop_uses_relative_dates, -} -list_view_options._privelemdict = { - 'column' : column, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'alst' : alias_list, - 'clbl' : label, - 'cprf' : preferences, - 'icop' : icon_view_options, - 'ifam' : icon_family, - 'lvcl' : column, - 'lvop' : list_view_options, -} - -_propdeclarations = { - 'ICN#' : _Prop_large_monochrome_icon_and_mask, - 'barr' : _Prop_button_view_arrangement, - 'bisz' : _Prop_button_view_icon_size, - 'clwd' : _Prop_width, - 'colr' : _Prop_color, - 'cwin' : _Prop_window, - 'dela' : _Prop_delay_before_springing, - 'iarr' : _Prop_spatial_view_arrangement, - 'icl4' : _Prop_large_4_bit_icon, - 'icl8' : _Prop_large_8_bit_icon, - 'ics#' : _Prop_small_monochrome_icon_and_mask, - 'ics4' : _Prop_small_4_bit_icon, - 'ics8' : _Prop_small_8_bit_icon, - 'iisz' : _Prop_spatial_view_icon_size, - 'il32' : _Prop_large_32_bit_icon, - 'is32' : _Prop_small_32_bit_icon, - 'l8mk' : _Prop_large_8_bit_mask, - 'lisz' : _Prop_list_view_icon_size, - 'lvis' : _Prop_icon_size, - 'pidx' : _Prop_index, - 'pnam' : _Prop_name, - 'pvis' : _Prop_visible, - 'scda' : _Prop_shows_creation_date, - 'scom' : _Prop_shows_comments, - 'sdat' : _Prop_shows_modification_date, - 'sfsz' : _Prop_calculates_folder_sizes, - 'sknd' : _Prop_shows_kind, - 'slbl' : _Prop_shows_label, - 'sord' : _Prop_sort_direction, - 'sprg' : _Prop_spring_open_folders, - 'srtc' : _Prop_sort_column, - 'ssiz' : _Prop_shows_size, - 'svrs' : _Prop_shows_version, - 'urdt' : _Prop_uses_relative_dates, - 'usme' : _Prop_uses_simple_menus, - 'uswg' : _Prop_uses_wide_grid, - 'vfnt' : _Prop_view_font, - 'vfsz' : _Prop_view_font_size, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Window_classes.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Window_classes.py deleted file mode 100644 index 496968a64..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/Window_classes.py +++ /dev/null @@ -1,229 +0,0 @@ -"""Suite Window classes: Classes representing windows -Level 1, version 1 - -Generated from /System/Library/CoreServices/Finder.app -AETE/AEUT resource version 0/144, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'fndr' - -class Window_classes_Events: - - pass - - -class Finder_window(aetools.ComponentItem): - """Finder window - A file viewer window """ - want = 'brow' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - inherits some of its properties from the window class """ - which = 'c@#^' - want = 'cwin' -class _Prop_current_view(aetools.NProperty): - """current view - the current view for the container window """ - which = 'pvew' - want = 'ecvw' -class _Prop_icon_view_options(aetools.NProperty): - """icon view options - the icon view options for the container window """ - which = 'icop' - want = 'icop' -class _Prop_list_view_options(aetools.NProperty): - """list view options - the list view options for the container window """ - which = 'lvop' - want = 'lvop' -class _Prop_target(aetools.NProperty): - """target - the container at which this file viewer is targeted """ - which = 'fvtg' - want = 'obj ' - -Finder_windows = Finder_window - -class window(aetools.ComponentItem): - """window - A window """ - want = 'cwin' -class _Prop_bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window """ - which = 'pbnd' - want = 'qdrt' -class _Prop_closeable(aetools.NProperty): - """closeable - Does the window have a close box? """ - which = 'hclb' - want = 'bool' -class _Prop_collapsed(aetools.NProperty): - """collapsed - Is the window collapsed """ - which = 'wshd' - want = 'bool' -class _Prop_floating(aetools.NProperty): - """floating - Does the window have a title bar? """ - which = 'isfl' - want = 'bool' -class _Prop_id(aetools.NProperty): - """id - the unique id for this window """ - which = 'ID ' - want = 'magn' -class _Prop_index(aetools.NProperty): - """index - the number of the window in the front-to-back layer ordering """ - which = 'pidx' - want = 'long' -class _Prop_modal(aetools.NProperty): - """modal - Is the window modal? """ - which = 'pmod' - want = 'bool' -class _Prop_name(aetools.NProperty): - """name - the name of the window """ - which = 'pnam' - want = 'utxt' -class _Prop_position(aetools.NProperty): - """position - the upper left position of the window """ - which = 'posn' - want = 'QDpt' -class _Prop_properties(aetools.NProperty): - """properties - every property of a window """ - which = 'pALL' - want = 'reco' -class _Prop_resizable(aetools.NProperty): - """resizable - Is the window resizable? """ - which = 'prsz' - want = 'bool' -class _Prop_titled(aetools.NProperty): - """titled - Does the window have a title bar? """ - which = 'ptit' - want = 'bool' -class _Prop_visible(aetools.NProperty): - """visible - Is the window visible (always true for open Finder windows)? """ - which = 'pvis' - want = 'bool' -class _Prop_zoomable(aetools.NProperty): - """zoomable - Is the window zoomable? """ - which = 'iszm' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' -class _Prop_zoomed_full_size(aetools.NProperty): - """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ - which = 'zumf' - want = 'bool' - -windows = window - -class information_window(aetools.ComponentItem): - """information window - An inspector window (opened by \xd2Show Info\xd3) """ - want = 'iwnd' -class _Prop_current_panel(aetools.NProperty): - """current panel - the current panel in the information window """ - which = 'panl' - want = 'ipnl' -class _Prop_item(aetools.NProperty): - """item - the item from which this window was opened """ - which = 'cobj' - want = 'obj ' - -class clipping_window(aetools.ComponentItem): - """clipping window - The window containing a clipping """ - want = 'lwnd' - -clipping_windows = clipping_window - -class preferences_window(aetools.ComponentItem): - """preferences window - (NOT AVAILABLE YET) The Finder Preferences window """ - want = 'pwnd' -Finder_window._superclassnames = ['window'] -Finder_window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'current_view' : _Prop_current_view, - 'icon_view_options' : _Prop_icon_view_options, - 'list_view_options' : _Prop_list_view_options, - 'target' : _Prop_target, -} -Finder_window._privelemdict = { -} -window._superclassnames = [] -window._privpropdict = { - 'bounds' : _Prop_bounds, - 'closeable' : _Prop_closeable, - 'collapsed' : _Prop_collapsed, - 'floating' : _Prop_floating, - 'id' : _Prop_id, - 'index' : _Prop_index, - 'modal' : _Prop_modal, - 'name' : _Prop_name, - 'position' : _Prop_position, - 'properties' : _Prop_properties, - 'resizable' : _Prop_resizable, - 'titled' : _Prop_titled, - 'visible' : _Prop_visible, - 'zoomable' : _Prop_zoomable, - 'zoomed' : _Prop_zoomed, - 'zoomed_full_size' : _Prop_zoomed_full_size, -} -window._privelemdict = { -} -information_window._superclassnames = ['window'] -information_window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'current_panel' : _Prop_current_panel, - 'item' : _Prop_item, -} -information_window._privelemdict = { -} -clipping_window._superclassnames = ['window'] -clipping_window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -clipping_window._privelemdict = { -} -preferences_window._superclassnames = ['window'] -preferences_window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'current_panel' : _Prop_current_panel, -} -preferences_window._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'brow' : Finder_window, - 'cwin' : window, - 'iwnd' : information_window, - 'lwnd' : clipping_window, - 'pwnd' : preferences_window, -} - -_propdeclarations = { - 'ID ' : _Prop_id, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'cobj' : _Prop_item, - 'fvtg' : _Prop_target, - 'hclb' : _Prop_closeable, - 'icop' : _Prop_icon_view_options, - 'isfl' : _Prop_floating, - 'iszm' : _Prop_zoomable, - 'lvop' : _Prop_list_view_options, - 'pALL' : _Prop_properties, - 'panl' : _Prop_current_panel, - 'pbnd' : _Prop_bounds, - 'pidx' : _Prop_index, - 'pmod' : _Prop_modal, - 'pnam' : _Prop_name, - 'posn' : _Prop_position, - 'prsz' : _Prop_resizable, - 'ptit' : _Prop_titled, - 'pvew' : _Prop_current_view, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, - 'wshd' : _Prop_collapsed, - 'zumf' : _Prop_zoomed_full_size, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/Finder/__init__.py deleted file mode 100644 index 8782a4f81..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Finder/__init__.py +++ /dev/null @@ -1,233 +0,0 @@ -""" -Package generated from /System/Library/CoreServices/Finder.app -""" -import aetools -Error = aetools.Error -import Standard_Suite -import Legacy_suite -import Containers_and_folders -import Files -import Finder_Basics -import Finder_items -import Window_classes -import Type_Definitions -import Enumerations - - -_code_to_module = { - 'CoRe' : Standard_Suite, - 'fleg' : Legacy_suite, - 'fndr' : Containers_and_folders, - 'fndr' : Files, - 'fndr' : Finder_Basics, - 'fndr' : Finder_items, - 'fndr' : Window_classes, - 'tpdf' : Type_Definitions, - 'tpnm' : Enumerations, -} - - - -_code_to_fullname = { - 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), - 'fleg' : ('Finder.Legacy_suite', 'Legacy_suite'), - 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), - 'fndr' : ('Finder.Files', 'Files'), - 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), - 'fndr' : ('Finder.Finder_items', 'Finder_items'), - 'fndr' : ('Finder.Window_classes', 'Window_classes'), - 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), - 'tpnm' : ('Finder.Enumerations', 'Enumerations'), -} - -from Standard_Suite import * -from Legacy_suite import * -from Containers_and_folders import * -from Files import * -from Finder_Basics import * -from Finder_items import * -from Window_classes import * -from Type_Definitions import * -from Enumerations import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(StdSuites.Type_Names_Suite.small_integer) -getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) -getbaseclasses(StdSuites.Type_Names_Suite.color_table) -getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) -getbaseclasses(StdSuites.Type_Names_Suite.string) -getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) -getbaseclasses(StdSuites.Type_Names_Suite.machine_location) -getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) -getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) -getbaseclasses(StdSuites.Type_Names_Suite.menu_item) -getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) -getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) -getbaseclasses(StdSuites.Type_Names_Suite.null) -getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) -getbaseclasses(StdSuites.Type_Names_Suite.rotation) -getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) -getbaseclasses(StdSuites.Type_Names_Suite.long_point) -getbaseclasses(StdSuites.Type_Names_Suite.target_id) -getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) -getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) -getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) -getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) -getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) -getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) -getbaseclasses(StdSuites.Type_Names_Suite.version) -getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) -getbaseclasses(StdSuites.Type_Names_Suite.double_integer) -getbaseclasses(StdSuites.Type_Names_Suite.location_reference) -getbaseclasses(StdSuites.Type_Names_Suite.point) -getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) -getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) -getbaseclasses(StdSuites.Type_Names_Suite.menu) -getbaseclasses(StdSuites.Type_Names_Suite.small_real) -getbaseclasses(StdSuites.Type_Names_Suite.fixed) -getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) -getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) -getbaseclasses(StdSuites.Type_Names_Suite.dash_style) -getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) -getbaseclasses(StdSuites.Type_Names_Suite.extended_real) -getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) -getbaseclasses(process) -getbaseclasses(application_process) -getbaseclasses(desk_accessory_process) -getbaseclasses(application) -getbaseclasses(trash_2d_object) -getbaseclasses(desktop_2d_object) -getbaseclasses(container) -getbaseclasses(folder) -getbaseclasses(disk) -getbaseclasses(application) -getbaseclasses(alias_file) -getbaseclasses(package) -getbaseclasses(file) -getbaseclasses(application_file) -getbaseclasses(internet_location_file) -getbaseclasses(document_file) -getbaseclasses(clipping) -getbaseclasses(preferences_window) -getbaseclasses(Finder_window) -getbaseclasses(window) -getbaseclasses(clipping_window) -getbaseclasses(information_window) -getbaseclasses(item) -getbaseclasses(icon_view_options) -getbaseclasses(preferences) -getbaseclasses(alias_list) -getbaseclasses(icon_family) -getbaseclasses(label) -getbaseclasses(column) -getbaseclasses(list_view_options) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'shor' : StdSuites.Type_Names_Suite.small_integer, - 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, - 'clrt' : StdSuites.Type_Names_Suite.color_table, - 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, - 'TEXT' : StdSuites.Type_Names_Suite.string, - 'elin' : StdSuites.Type_Names_Suite.type_element_info, - 'mLoc' : StdSuites.Type_Names_Suite.machine_location, - 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, - 'pinf' : StdSuites.Type_Names_Suite.type_property_info, - 'cmen' : StdSuites.Type_Names_Suite.menu_item, - 'styl' : StdSuites.Type_Names_Suite.scrap_styles, - 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, - 'null' : StdSuites.Type_Names_Suite.null, - 'evin' : StdSuites.Type_Names_Suite.type_event_info, - 'trot' : StdSuites.Type_Names_Suite.rotation, - 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, - 'lpnt' : StdSuites.Type_Names_Suite.long_point, - 'targ' : StdSuites.Type_Names_Suite.target_id, - 'suin' : StdSuites.Type_Names_Suite.type_suite_info, - 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, - 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, - 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, - 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, - 'vers' : StdSuites.Type_Names_Suite.version, - 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, - 'comp' : StdSuites.Type_Names_Suite.double_integer, - 'insl' : StdSuites.Type_Names_Suite.location_reference, - 'QDpt' : StdSuites.Type_Names_Suite.point, - 'aete' : StdSuites.Type_Names_Suite.application_dictionary, - 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, - 'cmnu' : StdSuites.Type_Names_Suite.menu, - 'sing' : StdSuites.Type_Names_Suite.small_real, - 'fixd' : StdSuites.Type_Names_Suite.fixed, - 'gcli' : StdSuites.Type_Names_Suite.type_class_info, - 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, - 'tdas' : StdSuites.Type_Names_Suite.dash_style, - 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, - 'exte' : StdSuites.Type_Names_Suite.extended_real, - 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, - 'prcs' : process, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'capp' : application, - 'ctrs' : trash_2d_object, - 'cdsk' : desktop_2d_object, - 'ctnr' : container, - 'cfol' : folder, - 'cdis' : disk, - 'capp' : application, - 'alia' : alias_file, - 'pack' : package, - 'file' : file, - 'appf' : application_file, - 'inlf' : internet_location_file, - 'docf' : document_file, - 'clpf' : clipping, - 'pwnd' : preferences_window, - 'brow' : Finder_window, - 'cwin' : window, - 'lwnd' : clipping_window, - 'iwnd' : information_window, - 'cobj' : item, - 'icop' : icon_view_options, - 'cprf' : preferences, - 'alst' : alias_list, - 'ifam' : icon_family, - 'clbl' : label, - 'lvcl' : column, - 'lvop' : list_view_options, -} - - -class Finder(Standard_Suite_Events, - Legacy_suite_Events, - Containers_and_folders_Events, - Files_Events, - Finder_Basics_Events, - Finder_items_Events, - Window_classes_Events, - Type_Definitions_Events, - Enumerations_Events, - aetools.TalkTo): - _signature = 'MACS' - - _moduleName = 'Finder' - - _elemdict = application._elemdict - _propdict = application._propdict diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py deleted file mode 100644 index f4aea730c..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py +++ /dev/null @@ -1,269 +0,0 @@ -"""Suite Mozilla suite: Experimental Mozilla suite -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'MOSS' - -class Mozilla_suite_Events: - - def Get_Import_Data(self, _no_object=None, _attributes={}, **_arguments): - """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) - """ - _code = 'MOSS' - _subcode = 'Impt' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_Profile_Name(self, _no_object=None, _attributes={}, **_arguments): - """Get Profile Name: Get the current User Profile - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. - """ - _code = 'MOSS' - _subcode = 'upro' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_workingURL(self, _no_object=None, _attributes={}, **_arguments): - """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 - """ - _code = 'MOSS' - _subcode = 'wurl' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Go = { - 'direction' : 'dire', - } - - def Go(self, _object, _attributes={}, **_arguments): - """Go: navigate a window: back, forward, again(reload), home) - Required argument: window - Keyword argument direction: undocumented, typecode 'dire' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'gogo' - - aetools.keysubst(_arguments, self._argmap_Go) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'dire', _Enum_dire) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Handle_command(self, _object, _attributes={}, **_arguments): - """Handle command: Handle a command - Required argument: The command to handle - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'hcmd' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): - """Open Address Book: Opens the address book - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'addr' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Open_Component(self, _object, _attributes={}, **_arguments): - """Open Component: Open a Communicator component - Required argument: The component to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'cpnt' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Open_Profile_Manager(self, _no_object=None, _attributes={}, **_arguments): - """Open Profile Manager: Open the user profile manager (obsolete) - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'prfl' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Open_bookmark(self, _object=None, _attributes={}, **_arguments): - """Open bookmark: Reads in a bookmark file - Required argument: If not available, reloads the current bookmark file - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'book' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Read_help_file = { - 'with_index' : 'idid', - 'search_text' : 'sear', - } - - def Read_help_file(self, _object, _attributes={}, **_arguments): - """Read help file: Reads in the help file (file should be in the help file format) - Required argument: undocumented, typecode 'alis' - Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) - Keyword argument search_text: Optional text to search for - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MOSS' - _subcode = 'help' - - aetools.keysubst(_arguments, self._argmap_Read_help_file) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - -_Enum_comp = { - 'Navigator' : 'navg', # The Navigator component - 'InBox' : 'inbx', # The InBox component - 'Newsgroups' : 'colb', # The Newsgroups component - 'Composer' : 'cpsr', # The Page Composer component - 'Conference' : 'conf', # The Conference Component - 'Calendar' : 'cald', # The Calendar Component -} - -_Enum_dire = { - 'again' : 'agai', # Again (reload) - 'home' : 'home', # Home - 'backward' : 'prev', # Previous page - 'forward' : 'next', # Next page -} - -_Enum_ncmd = { - 'Get_new_mail' : '\x00\x00\x04W', # - 'Send_queued_messages' : '\x00\x00\x04X', # - 'Read_newsgroups' : '\x00\x00\x04\x04', # - 'Show_Inbox' : '\x00\x00\x04\x05', # - 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # - 'Show_History_window' : '\x00\x00\x04\x07', # - 'Show_Address_Book_window' : '\x00\x00\x04\t', # -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'comp' : _Enum_comp, - 'dire' : _Enum_dire, - 'ncmd' : _Enum_ncmd, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py deleted file mode 100644 index 7767305cb..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py +++ /dev/null @@ -1,86 +0,0 @@ -"""Suite PowerPlant: -Level 0, version 0 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'ppnt' - -class PowerPlant_Events: - - _argmap_SwitchTellTarget = { - 'to' : 'data', - } - - def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): - """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents - Keyword argument to: reference to new focus of AppleEvents - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ppnt' - _subcode = 'sttg' - - aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_select = { - 'data' : 'data', - } - - def select(self, _object, _attributes={}, **_arguments): - """select: Sets the present selection - Required argument: object to select or container of sub-objects to select - Keyword argument data: sub-object(s) to select - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'slct' - - aetools.keysubst(_arguments, self._argmap_select) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - -_Enum_dbac = { - 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. - 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. - 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). - 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'dbac' : _Enum_dbac, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Required_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Required_suite.py deleted file mode 100644 index b5c411048..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Required_suite.py +++ /dev/null @@ -1,108 +0,0 @@ -"""Suite Required suite: -Level 0, version 0 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'reqd' - -from StdSuites.Required_Suite import * -class Required_suite_Events(Required_Suite_Events): - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def print_(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit Navigator - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run(self, _no_object=None, _attributes={}, **_arguments): - """run: Sent to an application when it is double-clicked - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'oapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py deleted file mode 100644 index 5c3e92789..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py +++ /dev/null @@ -1,243 +0,0 @@ -"""Suite Standard Suite: Common terms for most applications -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'CoRe' - -from StdSuites.Standard_Suite import * -class Standard_Suite_Events(Standard_Suite_Events): - - def close(self, _object, _attributes={}, **_arguments): - """close: Close an object - Required argument: the objects to close - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def data_size(self, _object, _attributes={}, **_arguments): - """data size: Return the size in bytes of an object - Required argument: the object whose data size is to be returned - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the size of the object in bytes - """ - _code = 'core' - _subcode = 'dsiz' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def get(self, _object, _attributes={}, **_arguments): - """get: Get the data for an object - Required argument: the object whose data is to be returned - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: The data from the object - """ - _code = 'core' - _subcode = 'getd' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_set = { - 'to' : 'data', - } - - def set(self, _object, _attributes={}, **_arguments): - """set: Set an object\xd5s data - Required argument: the object to change - Keyword argument to: the new value - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'setd' - - aetools.keysubst(_arguments, self._argmap_set) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - An application program """ - want = 'capp' -class _Prop_alert_application(aetools.NProperty): - """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ - which = 'ALAP' - want = 'type' -alert_application = _Prop_alert_application() -class _Prop_kiosk_mode(aetools.NProperty): - """kiosk mode - Kiosk mode leaves very few menus enabled """ - which = 'KOSK' - want = 'long' -kiosk_mode = _Prop_kiosk_mode() -# element 'cwin' as ['indx', 'name', 'ID '] - -class window(aetools.ComponentItem): - """window - A Window """ - want = 'cwin' -class _Prop_URL(aetools.NProperty): - """URL - Current URL """ - which = 'curl' - want = 'TEXT' -class _Prop_bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window """ - which = 'pbnd' - want = 'qdrt' -class _Prop_busy(aetools.NProperty): - """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ - which = 'busy' - want = 'long' -class _Prop_closeable(aetools.NProperty): - """closeable - Does the window have a close box? """ - which = 'hclb' - want = 'bool' -class _Prop_floating(aetools.NProperty): - """floating - Does the window float? """ - which = 'isfl' - want = 'bool' -class _Prop_index(aetools.NProperty): - """index - the number of the window """ - which = 'pidx' - want = 'long' -class _Prop_modal(aetools.NProperty): - """modal - Is the window modal? """ - which = 'pmod' - want = 'bool' -class _Prop_name(aetools.NProperty): - """name - the title of the window """ - which = 'pnam' - want = 'itxt' -class _Prop_position(aetools.NProperty): - """position - upper left coordinates of window """ - which = 'ppos' - want = 'QDpt' -class _Prop_resizable(aetools.NProperty): - """resizable - Is the window resizable? """ - which = 'prsz' - want = 'bool' -class _Prop_titled(aetools.NProperty): - """titled - Does the window have a title bar? """ - which = 'ptit' - want = 'bool' -class _Prop_unique_ID(aetools.NProperty): - """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ - which = 'wiid' - want = 'long' -class _Prop_visible(aetools.NProperty): - """visible - is the window visible? """ - which = 'pvis' - want = 'bool' -class _Prop_zoomable(aetools.NProperty): - """zoomable - Is the window zoomable? """ - which = 'iszm' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' -application._superclassnames = [] -application._privpropdict = { - 'alert_application' : _Prop_alert_application, - 'kiosk_mode' : _Prop_kiosk_mode, -} -application._privelemdict = { - 'window' : window, -} -window._superclassnames = [] -window._privpropdict = { - 'URL' : _Prop_URL, - 'bounds' : _Prop_bounds, - 'busy' : _Prop_busy, - 'closeable' : _Prop_closeable, - 'floating' : _Prop_floating, - 'index' : _Prop_index, - 'modal' : _Prop_modal, - 'name' : _Prop_name, - 'position' : _Prop_position, - 'resizable' : _Prop_resizable, - 'titled' : _Prop_titled, - 'unique_ID' : _Prop_unique_ID, - 'visible' : _Prop_visible, - 'zoomable' : _Prop_zoomable, - 'zoomed' : _Prop_zoomed, -} -window._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cwin' : window, -} - -_propdeclarations = { - 'ALAP' : _Prop_alert_application, - 'KOSK' : _Prop_kiosk_mode, - 'busy' : _Prop_busy, - 'curl' : _Prop_URL, - 'hclb' : _Prop_closeable, - 'isfl' : _Prop_floating, - 'iszm' : _Prop_zoomable, - 'pbnd' : _Prop_bounds, - 'pidx' : _Prop_index, - 'pmod' : _Prop_modal, - 'pnam' : _Prop_name, - 'ppos' : _Prop_position, - 'prsz' : _Prop_resizable, - 'ptit' : _Prop_titled, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, - 'wiid' : _Prop_unique_ID, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py deleted file mode 100644 index de4a01c9e..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py +++ /dev/null @@ -1,60 +0,0 @@ -"""Suite Standard URL suite: Mac URL standard, supported by many apps - - -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'GURL' - -class Standard_URL_suite_Events: - - _argmap_GetURL = { - 'to' : 'dest', - 'inside' : 'HWIN', - 'from_' : 'refe', - } - - def GetURL(self, _object, _attributes={}, **_arguments): - """GetURL: Loads the URL (optionally to disk) - Required argument: The url - Keyword argument to: file the URL should be loaded into - Keyword argument inside: Window the URL should be loaded to - Keyword argument from_: Referrer, to be sent with the HTTP request - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'GURL' - _subcode = 'GURL' - - aetools.keysubst(_arguments, self._argmap_GetURL) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Text.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Text.py deleted file mode 100644 index 2360d949a..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/Text.py +++ /dev/null @@ -1,122 +0,0 @@ -"""Suite Text: -Level 0, version 0 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'TEXT' - -from StdSuites.Text_Suite import * -class Text_Events(Text_Suite_Events): - - pass - - -class text(aetools.ComponentItem): - """text - independent text view objects """ - want = 'ctxt' -class _Prop_beginning(aetools.NProperty): - """beginning - Beginning of element """ - which = 'bgng' - want = 'obj ' -class _Prop_end(aetools.NProperty): - """end - Ending of element """ - which = 'end ' - want = 'obj ' -class _Prop_infront(aetools.NProperty): - """infront - Immediately before element """ - which = 'pBef' - want = 'obj ' -class _Prop_justbehind(aetools.NProperty): - """justbehind - Immediately after element """ - which = 'pAft' - want = 'obj ' -class _Prop_updateLevel(aetools.NProperty): - """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ - which = 'pUpL' - want = 'long' -# element 'stys' as ['indx', 'name'] - -class styleset(aetools.ComponentItem): - """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ - want = 'stys' -class _Prop_color(aetools.NProperty): - """color - the color """ - which = 'colr' - want = 'RGB ' -class _Prop_font(aetools.NProperty): - """font - font name """ - which = 'font' - want = 'TEXT' -class _Prop_name(aetools.NProperty): - """name - style name """ - which = 'pnam' - want = 'TEXT' -class _Prop_size(aetools.NProperty): - """size - the size in points """ - which = 'ptsz' - want = 'long' -class _Prop_style(aetools.NProperty): - """style - the text styles or face attributes """ - which = 'txst' - want = 'tsty' -class _Prop_writing_code(aetools.NProperty): - """writing code - the script system and language """ - which = 'psct' - want = 'tsty' - -stylesets = styleset -text._superclassnames = [] -text._privpropdict = { - 'beginning' : _Prop_beginning, - 'end' : _Prop_end, - 'infront' : _Prop_infront, - 'justbehind' : _Prop_justbehind, - 'updateLevel' : _Prop_updateLevel, -} -text._privelemdict = { - 'styleset' : styleset, -} -styleset._superclassnames = [] -styleset._privpropdict = { - 'color' : _Prop_color, - 'font' : _Prop_font, - 'name' : _Prop_name, - 'size' : _Prop_size, - 'style' : _Prop_style, - 'writing_code' : _Prop_writing_code, -} -styleset._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'ctxt' : text, - 'stys' : styleset, -} - -_propdeclarations = { - 'bgng' : _Prop_beginning, - 'colr' : _Prop_color, - 'end ' : _Prop_end, - 'font' : _Prop_font, - 'pAft' : _Prop_justbehind, - 'pBef' : _Prop_infront, - 'pUpL' : _Prop_updateLevel, - 'pnam' : _Prop_name, - 'psct' : _Prop_writing_code, - 'ptsz' : _Prop_size, - 'txst' : _Prop_style, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py deleted file mode 100644 index 06cbfa7ac..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py +++ /dev/null @@ -1,426 +0,0 @@ -"""Suite WorldWideWeb suite, as defined in Spyglass spec.: -Level 1, version 1 - -Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'WWW!' - -class WorldWideWeb_suite_Events: - - _argmap_OpenURL = { - 'to' : 'INTO', - 'toWindow' : 'WIND', - 'flags' : 'FLGS', - 'post_data' : 'POST', - 'post_type' : 'MIME', - 'progressApp' : 'PROG', - } - - def OpenURL(self, _object, _attributes={}, **_arguments): - """OpenURL: Opens a URL. Allows for more options than GetURL event - Required argument: URL - Keyword argument to: file destination - Keyword argument toWindow: window iD - Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored - Keyword argument post_data: Form posting data - Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded - Keyword argument progressApp: Application that will display progress - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: ID of the loading window - """ - _code = 'WWW!' - _subcode = 'OURL' - - aetools.keysubst(_arguments, self._argmap_OpenURL) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_ShowFile = { - 'MIME_type' : 'MIME', - 'Window_ID' : 'WIND', - 'URL' : 'URL ', - } - - def ShowFile(self, _object, _attributes={}, **_arguments): - """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file - Required argument: File to open - Keyword argument MIME_type: MIME type - Keyword argument Window_ID: Window to open the file in - Keyword argument URL: Use this as a base URL - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser. - """ - _code = 'WWW!' - _subcode = 'SHWF' - - aetools.keysubst(_arguments, self._argmap_ShowFile) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_cancel_progress = { - 'in_window' : 'WIND', - } - - def cancel_progress(self, _object=None, _attributes={}, **_arguments): - """cancel progress: Interrupts the download of the document in the given window - Required argument: progress ID, obtained from the progress app - Keyword argument in_window: window ID of the progress to cancel - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'CNCL' - - aetools.keysubst(_arguments, self._argmap_cancel_progress) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def find_URL(self, _object, _attributes={}, **_arguments): - """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file. - Required argument: File spec - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: The URL - """ - _code = 'WWW!' - _subcode = 'FURL' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def get_window_info(self, _object=None, _attributes={}, **_arguments): - """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty. - Required argument: window ID - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'WWW!' - _subcode = 'WNFO' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def list_windows(self, _no_object=None, _attributes={}, **_arguments): - """list windows: Lists the IDs of all the hypertext windows - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: List of unique IDs of all the hypertext windows - """ - _code = 'WWW!' - _subcode = 'LSTW' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_parse_anchor = { - 'relative_to' : 'RELA', - } - - def parse_anchor(self, _object, _attributes={}, **_arguments): - """parse anchor: Resolves the relative URL - Required argument: Main URL - Keyword argument relative_to: Relative URL - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Parsed URL - """ - _code = 'WWW!' - _subcode = 'PRSA' - - aetools.keysubst(_arguments, self._argmap_parse_anchor) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def register_URL_echo(self, _object=None, _attributes={}, **_arguments): - """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application. - Required argument: Application signature - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'RGUE' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_register_protocol = { - 'for_protocol' : 'PROT', - } - - def register_protocol(self, _object=None, _attributes={}, **_arguments): - """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. - Required argument: Application sig - Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TRUE if registration has been successful - """ - _code = 'WWW!' - _subcode = 'RGPR' - - aetools.keysubst(_arguments, self._argmap_register_protocol) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_register_viewer = { - 'MIME_type' : 'MIME', - 'with_file_type' : 'FTYP', - } - - def register_viewer(self, _object, _attributes={}, **_arguments): - """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events - Required argument: Application sig - Keyword argument MIME_type: MIME type viewer is registering for - Keyword argument with_file_type: Mac file type for the downloaded files - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TRUE if registration has been successful - """ - _code = 'WWW!' - _subcode = 'RGVW' - - aetools.keysubst(_arguments, self._argmap_register_viewer) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_register_window_close = { - 'for_window' : 'WIND', - } - - def register_window_close(self, _object=None, _attributes={}, **_arguments): - """register window close: Netscape will notify registered application when this window closes - Required argument: Application signature - Keyword argument for_window: window ID - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: true if successful - """ - _code = 'WWW!' - _subcode = 'RGWC' - - aetools.keysubst(_arguments, self._argmap_register_window_close) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def unregister_URL_echo(self, _object, _attributes={}, **_arguments): - """unregister URL echo: cancels URL echo - Required argument: application signature - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'UNRU' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_unregister_protocol = { - 'for_protocol' : 'PROT', - } - - def unregister_protocol(self, _object=None, _attributes={}, **_arguments): - """unregister protocol: reverses the effects of \xd2register protocol\xd3 - Required argument: Application sig. - Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TRUE if successful - """ - _code = 'WWW!' - _subcode = 'UNRP' - - aetools.keysubst(_arguments, self._argmap_unregister_protocol) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_unregister_viewer = { - 'MIME_type' : 'MIME', - } - - def unregister_viewer(self, _object, _attributes={}, **_arguments): - """unregister viewer: Revert to the old way of handling this MIME type - Required argument: Application sig - Keyword argument MIME_type: MIME type to be unregistered - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TRUE if the event was successful - """ - _code = 'WWW!' - _subcode = 'UNRV' - - aetools.keysubst(_arguments, self._argmap_unregister_viewer) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_unregister_window_close = { - 'for_window' : 'WIND', - } - - def unregister_window_close(self, _object=None, _attributes={}, **_arguments): - """unregister window close: Undo for register window close - Required argument: Application signature - Keyword argument for_window: window ID - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: true if successful - """ - _code = 'WWW!' - _subcode = 'UNRC' - - aetools.keysubst(_arguments, self._argmap_unregister_window_close) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def webActivate(self, _object=None, _attributes={}, **_arguments): - """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead. - Required argument: window to bring to front - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'WWW!' - _subcode = 'ACTV' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/__init__.py deleted file mode 100644 index 0dc5398a0..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Netscape/__init__.py +++ /dev/null @@ -1,105 +0,0 @@ -""" -Package generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 -""" -import aetools -Error = aetools.Error -import Standard_Suite -import Standard_URL_suite -import Mozilla_suite -import Text -import WorldWideWeb_suite -import PowerPlant -import Required_suite - - -_code_to_module = { - 'CoRe' : Standard_Suite, - 'GURL' : Standard_URL_suite, - 'MOSS' : Mozilla_suite, - 'TEXT' : Text, - 'WWW!' : WorldWideWeb_suite, - 'ppnt' : PowerPlant, - 'reqd' : Required_suite, -} - - - -_code_to_fullname = { - 'CoRe' : ('Netscape.Standard_Suite', 'Standard_Suite'), - 'GURL' : ('Netscape.Standard_URL_suite', 'Standard_URL_suite'), - 'MOSS' : ('Netscape.Mozilla_suite', 'Mozilla_suite'), - 'TEXT' : ('Netscape.Text', 'Text'), - 'WWW!' : ('Netscape.WorldWideWeb_suite', 'WorldWideWeb_suite'), - 'ppnt' : ('Netscape.PowerPlant', 'PowerPlant'), - 'reqd' : ('Netscape.Required_suite', 'Required_suite'), -} - -from Standard_Suite import * -from Standard_URL_suite import * -from Mozilla_suite import * -from Text import * -from WorldWideWeb_suite import * -from PowerPlant import * -from Required_suite import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(text) -getbaseclasses(styleset) -getbaseclasses(StdSuites.Text_Suite.character) -getbaseclasses(StdSuites.Text_Suite.text_flow) -getbaseclasses(StdSuites.Text_Suite.word) -getbaseclasses(StdSuites.Text_Suite.paragraph) -getbaseclasses(StdSuites.Text_Suite.text_style_info) -getbaseclasses(StdSuites.Text_Suite.line) -getbaseclasses(StdSuites.Text_Suite.text) -getbaseclasses(window) -getbaseclasses(application) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'ctxt' : text, - 'stys' : styleset, - 'cha ' : StdSuites.Text_Suite.character, - 'cflo' : StdSuites.Text_Suite.text_flow, - 'cwor' : StdSuites.Text_Suite.word, - 'cpar' : StdSuites.Text_Suite.paragraph, - 'tsty' : StdSuites.Text_Suite.text_style_info, - 'clin' : StdSuites.Text_Suite.line, - 'ctxt' : StdSuites.Text_Suite.text, - 'cwin' : window, - 'capp' : application, -} - - -class Netscape(Standard_Suite_Events, - Standard_URL_suite_Events, - Mozilla_suite_Events, - Text_Events, - WorldWideWeb_suite_Events, - PowerPlant_Events, - Required_suite_Events, - aetools.TalkTo): - _signature = 'MOSS' - - _moduleName = 'Netscape' - - _elemdict = application._elemdict - _propdict = application._propdict diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py deleted file mode 100644 index 574043d4a..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py +++ /dev/null @@ -1,2215 +0,0 @@ -"""Suite AppleScript Suite: Standard terms for AppleScript -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'ascr' - -class AppleScript_Suite_Events: - - def _26_(self, _object, _attributes={}, **_arguments): - """&: Concatenation - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'ccat' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _2a_(self, _object, _attributes={}, **_arguments): - """*: Multiplication - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '* ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _2b_(self, _object, _attributes={}, **_arguments): - """+: Addition - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '+ ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _2d_(self, _object, _attributes={}, **_arguments): - """-: Subtraction - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '- ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _3c_(self, _object, _attributes={}, **_arguments): - """<: Less than - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '< ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _3d_(self, _object, _attributes={}, **_arguments): - """=: Equality - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '= ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _3e_(self, _object, _attributes={}, **_arguments): - """>: Greater than - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '> ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_Call_a5_subroutine = { - 'at' : 'at ', - 'from_' : 'from', - 'for_' : 'for ', - 'to' : 'to ', - 'thru' : 'thru', - 'through' : 'thgh', - 'by' : 'by ', - 'on' : 'on ', - 'into' : 'into', - 'onto' : 'onto', - 'between' : 'btwn', - 'against' : 'agst', - 'out_of' : 'outo', - 'instead_of' : 'isto', - 'aside_from' : 'asdf', - 'around' : 'arnd', - 'beside' : 'bsid', - 'beneath' : 'bnth', - 'under' : 'undr', - 'over' : 'over', - 'above' : 'abve', - 'below' : 'belw', - 'apart_from' : 'aprt', - 'about' : 'abou', - 'since' : 'snce', - 'given' : 'givn', - 'with' : 'with', - 'without' : 'wout', - } - - def Call_a5_subroutine(self, _object=None, _attributes={}, **_arguments): - """Call\xa5subroutine: A subroutine call - Required argument: anything - Keyword argument at: a preposition - Keyword argument from_: a preposition - Keyword argument for_: a preposition - Keyword argument to: a preposition - Keyword argument thru: a preposition - Keyword argument through: a preposition - Keyword argument by: a preposition - Keyword argument on: a preposition - Keyword argument into: a preposition - Keyword argument onto: a preposition - Keyword argument between: a preposition - Keyword argument against: a preposition - Keyword argument out_of: a preposition - Keyword argument instead_of: a preposition - Keyword argument aside_from: a preposition - Keyword argument around: a preposition - Keyword argument beside: a preposition - Keyword argument beneath: a preposition - Keyword argument under: a preposition - Keyword argument over: a preposition - Keyword argument above: a preposition - Keyword argument below: a preposition - Keyword argument apart_from: a preposition - Keyword argument about: a preposition - Keyword argument since: a preposition - Keyword argument given: parameter:value pairs, comma-separated - Keyword argument with: formal parameter set to true if matching actual parameter is provided - Keyword argument without: formal parameter set to false if matching actual parmeter is provided - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'psbr' - - aetools.keysubst(_arguments, self._argmap_Call_a5_subroutine) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _5e_(self, _object, _attributes={}, **_arguments): - """^: Exponentiation - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '^ ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def activate(self, _no_object=None, _attributes={}, **_arguments): - """activate: Bring the targeted application program to the front - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'actv' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def and_(self, _object, _attributes={}, **_arguments): - """and: Logical conjunction - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'AND ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def as(self, _object, _attributes={}, **_arguments): - """as: Coercion - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'coer' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def contains(self, _object, _attributes={}, **_arguments): - """contains: Containment - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'cont' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def div(self, _object, _attributes={}, **_arguments): - """div: Quotient - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'div ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def end_tell(self, _no_object=None, _attributes={}, **_arguments): - """end tell: Record or log an \xd4end tell\xd5 statement - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ascr' - _subcode = 'tend' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def ends_with(self, _object, _attributes={}, **_arguments): - """ends with: Ends with - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'ends' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_error = { - 'number' : 'errn', - 'partial_result' : 'ptlr', - 'from_' : 'erob', - 'to' : 'errt', - } - - def error(self, _object=None, _attributes={}, **_arguments): - """error: Raise an error - Required argument: anything - Keyword argument number: an error number - Keyword argument partial_result: any partial result occurring before the error - Keyword argument from_: the object that caused the error - Keyword argument to: the desired class for a failed coercion - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ascr' - _subcode = 'err ' - - aetools.keysubst(_arguments, self._argmap_error) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def idle(self, _no_object=None, _attributes={}, **_arguments): - """idle: Sent to a script application when it is idle - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of seconds to wait for next idle event - """ - _code = 'misc' - _subcode = 'idle' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def launch(self, _no_object=None, _attributes={}, **_arguments): - """launch: Start an application for scripting - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ascr' - _subcode = 'noop' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def log(self, _object, _attributes={}, **_arguments): - """log: Cause a comment to be logged - Required argument: undocumented, typecode 'TEXT' - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ascr' - _subcode = 'cmnt' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def mod(self, _object, _attributes={}, **_arguments): - """mod: Remainder - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'mod ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def negate(self, _object, _attributes={}, **_arguments): - """negate: Numeric negation - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'neg ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def not_(self, _object, _attributes={}, **_arguments): - """not: Logical negation - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'NOT ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def or_(self, _object, _attributes={}, **_arguments): - """or: Logical disjunction - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'OR ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def start_log(self, _no_object=None, _attributes={}, **_arguments): - """start log: Start event logging in the script editor - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ToyS' - _subcode = 'log1' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def starts_with(self, _object, _attributes={}, **_arguments): - """starts with: Starts with - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = 'bgwt' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def stop_log(self, _no_object=None, _attributes={}, **_arguments): - """stop log: Stop event logging in the script editor - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ToyS' - _subcode = 'log0' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def tell(self, _no_object=None, _attributes={}, **_arguments): - """tell: Record or log a \xd4tell\xd5 statement - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'ascr' - _subcode = 'tell' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _ad_(self, _object, _attributes={}, **_arguments): - """\xad: Inequality - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '\xad ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _b2_(self, _object, _attributes={}, **_arguments): - """\xb2: Less than or equal to - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '<= ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _b3_(self, _object, _attributes={}, **_arguments): - """\xb3: Greater than or equal to - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '>= ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _d6_(self, _object, _attributes={}, **_arguments): - """\xd6: Division - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: anything - """ - _code = 'ascr' - _subcode = '/ ' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class anything(aetools.ComponentItem): - """anything - any class or reference """ - want = '****' - -class pictures(aetools.ComponentItem): - """pictures - """ - want = 'PICT' - -picture = pictures - -class styled_text(aetools.ComponentItem): - """styled text - text with font, size, and style information """ - want = 'STXT' - -styled_text = styled_text - -class strings(aetools.ComponentItem): - """strings - """ - want = 'TEXT' - -string = strings - -class alias(aetools.ComponentItem): - """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ - want = 'alis' -class _Prop_POSIX_path(aetools.NProperty): - """POSIX path - the POSIX path of the file """ - which = 'psxp' - want = 'TEXT' - -aliases = alias - -class April(aetools.ComponentItem): - """April - the month of April """ - want = 'apr ' - -class August(aetools.ComponentItem): - """August - the month of August """ - want = 'aug ' - -class booleans(aetools.ComponentItem): - """booleans - """ - want = 'bool' - -boolean = booleans - -class RGB_colors(aetools.ComponentItem): - """RGB colors - """ - want = 'cRGB' - -RGB_color = RGB_colors - -class application(aetools.ComponentItem): - """application - specifies global properties of AppleScript """ - want = 'capp' -class _Prop_AppleScript(aetools.NProperty): - """AppleScript - the top-level script object """ - which = 'ascr' - want = 'scpt' -AppleScript = _Prop_AppleScript() -class _Prop_days(aetools.NProperty): - """days - the number of seconds in a day """ - which = 'days' - want = 'long' -days = _Prop_days() -class _Prop_hours(aetools.NProperty): - """hours - the number of seconds in an hour """ - which = 'hour' - want = 'long' -hours = _Prop_hours() -class _Prop_minutes(aetools.NProperty): - """minutes - the number of seconds in a minute """ - which = 'min ' - want = 'long' -minutes = _Prop_minutes() -class _Prop_pi(aetools.NProperty): - """pi - the constant pi """ - which = 'pi ' - want = 'doub' -pi = _Prop_pi() -class _Prop_print_depth(aetools.NProperty): - """print depth - the maximum depth to print """ - which = 'prdp' - want = 'long' -print_depth = _Prop_print_depth() -class _Prop_print_length(aetools.NProperty): - """print length - the maximum length to print """ - which = 'prln' - want = 'long' -print_length = _Prop_print_length() -class _Prop_result(aetools.NProperty): - """result - the last result of evaluation """ - which = 'rslt' - want = '****' -result = _Prop_result() -class _Prop_return_(aetools.NProperty): - """return - a return character """ - which = 'ret ' - want = 'cha ' -return_ = _Prop_return_() -class _Prop_space(aetools.NProperty): - """space - a space character """ - which = 'spac' - want = 'cha ' -space = _Prop_space() -class _Prop_tab(aetools.NProperty): - """tab - a tab character """ - which = 'tab ' - want = 'cha ' -tab = _Prop_tab() -class _Prop_text_item_delimiters(aetools.NProperty): - """text item delimiters - the text item delimiters of a string """ - which = 'txdl' - want = 'list' -text_item_delimiters = _Prop_text_item_delimiters() -class _Prop_weeks(aetools.NProperty): - """weeks - the number of seconds in a week """ - which = 'week' - want = 'long' -weeks = _Prop_weeks() - -applications = application - -app = application - -class upper_case(aetools.ComponentItem): - """upper case - Text with lower case converted to upper case """ - want = 'case' - -class cubic_centimeters(aetools.ComponentItem): - """cubic centimeters - a volume measurement in SI cubic centimeters """ - want = 'ccmt' - -cubic_centimetres = cubic_centimeters - -class cubic_feet(aetools.ComponentItem): - """cubic feet - a volume measurement in Imperial cubic feet """ - want = 'cfet' - -class characters(aetools.ComponentItem): - """characters - """ - want = 'cha ' - -character = characters - -class writing_code_info(aetools.ComponentItem): - """writing code info - script code and language code of text run """ - want = 'citl' -class _Prop_language_code(aetools.NProperty): - """language code - the language code for the text """ - which = 'plcd' - want = 'shor' -class _Prop_script_code(aetools.NProperty): - """script code - the script code for the text """ - which = 'pscd' - want = 'shor' - -writing_code_infos = writing_code_info - -class text_items(aetools.ComponentItem): - """text items - """ - want = 'citm' - -text_item = text_items - -class cubic_meters(aetools.ComponentItem): - """cubic meters - a volume measurement in SI cubic meters """ - want = 'cmet' - -cubic_metres = cubic_meters - -class centimeters(aetools.ComponentItem): - """centimeters - a distance measurement in SI centimeters """ - want = 'cmtr' - -centimetres = centimeters - -class item(aetools.ComponentItem): - """item - An item of any type """ - want = 'cobj' -class _Prop_id(aetools.NProperty): - """id - the unique ID number of this object """ - which = 'ID ' - want = 'long' - -items = item - -class C_strings(aetools.ComponentItem): - """C strings - """ - want = 'cstr' - -C_string = C_strings - -class text(aetools.ComponentItem): - """text - text with language and style information """ - want = 'ctxt' - -class cubic_inches(aetools.ComponentItem): - """cubic inches - a volume measurement in Imperial cubic inches """ - want = 'cuin' - -class cubic_yards(aetools.ComponentItem): - """cubic yards - a distance measurement in Imperial cubic yards """ - want = 'cyrd' - -class December(aetools.ComponentItem): - """December - the month of December """ - want = 'dec ' - -class degrees_Celsius(aetools.ComponentItem): - """degrees Celsius - a temperature measurement in SI degrees Celsius """ - want = 'degc' - -class degrees_Fahrenheit(aetools.ComponentItem): - """degrees Fahrenheit - a temperature measurement in degrees Fahrenheit """ - want = 'degf' - -class degrees_Kelvin(aetools.ComponentItem): - """degrees Kelvin - a temperature measurement in degrees Kelvin """ - want = 'degk' - -class reals(aetools.ComponentItem): - """reals - """ - want = 'doub' - -real = reals - -class encoded_strings(aetools.ComponentItem): - """encoded strings - """ - want = 'encs' - -encoded_string = encoded_strings - -class constants(aetools.ComponentItem): - """constants - """ - want = 'enum' - -constant = constants - -class events(aetools.ComponentItem): - """events - """ - want = 'evnt' - -event = events - -class February(aetools.ComponentItem): - """February - the month of February """ - want = 'feb ' - -class feet(aetools.ComponentItem): - """feet - a distance measurement in Imperial feet """ - want = 'feet' - -class Friday(aetools.ComponentItem): - """Friday - Friday """ - want = 'fri ' - -class file_specification(aetools.ComponentItem): - """file specification - a file specification as used by the operating system """ - want = 'fss ' - -file_specifications = file_specification - -class gallons(aetools.ComponentItem): - """gallons - a volume measurement in Imperial gallons """ - want = 'galn' - -class grams(aetools.ComponentItem): - """grams - a mass measurement in SI meters """ - want = 'gram' - -class handlers(aetools.ComponentItem): - """handlers - """ - want = 'hand' - -handler = handlers - -class inches(aetools.ComponentItem): - """inches - a distance measurement in Imperial inches """ - want = 'inch' - -class international_text(aetools.ComponentItem): - """international text - text that begins with a writing code """ - want = 'itxt' - -international_text = international_text - -class January(aetools.ComponentItem): - """January - the month of January """ - want = 'jan ' - -class July(aetools.ComponentItem): - """July - the month of July """ - want = 'jul ' - -class June(aetools.ComponentItem): - """June - the month of June """ - want = 'jun ' - -class reference_forms(aetools.ComponentItem): - """reference forms - """ - want = 'kfrm' - -reference_form = reference_forms - -class kilograms(aetools.ComponentItem): - """kilograms - a mass measurement in SI kilograms """ - want = 'kgrm' - -class kilometers(aetools.ComponentItem): - """kilometers - a distance measurement in SI kilometers """ - want = 'kmtr' - -kilometres = kilometers - -class keystroke(aetools.ComponentItem): - """keystroke - a press of a key combination on a Macintosh keyboard """ - want = 'kprs' -class _Prop_key(aetools.NProperty): - """key - the character for the key was pressed (ignoring modifiers) """ - which = 'kMsg' - want = 'cha ' -class _Prop_key_kind(aetools.NProperty): - """key kind - the kind of key that was pressed """ - which = 'kknd' - want = 'ekst' -class _Prop_modifiers(aetools.NProperty): - """modifiers - the modifier keys pressed in combination """ - which = 'kMod' - want = 'eMds' - -keystrokes = keystroke - -class pounds(aetools.ComponentItem): - """pounds - a weight measurement in SI meters """ - want = 'lbs ' - -class date(aetools.ComponentItem): - """date - Absolute date and time values """ - want = 'ldt ' -class _Prop_date_string(aetools.NProperty): - """date string - the date portion of a date-time value as text """ - which = 'dstr' - want = 'TEXT' -class _Prop_day(aetools.NProperty): - """day - the day of the month of a date """ - which = 'day ' - want = 'long' -class _Prop_month(aetools.NProperty): - """month - the month of a date """ - which = 'mnth' - want = 'mnth' -class _Prop_time(aetools.NProperty): - """time - the time since midnight of a date """ - which = 'time' - want = 'long' -class _Prop_time_string(aetools.NProperty): - """time string - the time portion of a date-time value as text """ - which = 'tstr' - want = 'TEXT' -class _Prop_weekday(aetools.NProperty): - """weekday - the day of a week of a date """ - which = 'wkdy' - want = 'wkdy' -class _Prop_year(aetools.NProperty): - """year - the year of a date """ - which = 'year' - want = 'long' - -dates = date - -class list(aetools.ComponentItem): - """list - An ordered collection of items """ - want = 'list' -class _Prop_length(aetools.NProperty): - """length - the length of a list """ - which = 'leng' - want = 'long' -class _Prop_rest(aetools.NProperty): - """rest - all items of the list excluding first """ - which = 'rest' - want = 'list' -class _Prop_reverse(aetools.NProperty): - """reverse - the items of the list in reverse order """ - which = 'rvse' - want = 'list' - -lists = list - -class liters(aetools.ComponentItem): - """liters - a volume measurement in SI liters """ - want = 'litr' - -litres = liters - -class linked_list(aetools.ComponentItem): - """linked list - An ordered collection of items """ - want = 'llst' - -linked_lists = linked_list - -class integers(aetools.ComponentItem): - """integers - """ - want = 'long' - -integer = integers - -class list_or_record(aetools.ComponentItem): - """list or record - a list or record """ - want = 'lr ' - -class list_2c__record_or_text(aetools.ComponentItem): - """list, record or text - a list, record or text """ - want = 'lrs ' - -class list_or_string(aetools.ComponentItem): - """list or string - a list or string """ - want = 'ls ' - -class machines(aetools.ComponentItem): - """machines - """ - want = 'mach' - -machine = machines - -class March(aetools.ComponentItem): - """March - the month of March """ - want = 'mar ' - -class May(aetools.ComponentItem): - """May - the month of May """ - want = 'may ' - -class meters(aetools.ComponentItem): - """meters - a distance measurement in SI meters """ - want = 'metr' - -metres = meters - -class miles(aetools.ComponentItem): - """miles - a distance measurement in Imperial miles """ - want = 'mile' - -class months(aetools.ComponentItem): - """months - """ - want = 'mnth' - -month = months - -class Monday(aetools.ComponentItem): - """Monday - Monday """ - want = 'mon ' - -class missing_values(aetools.ComponentItem): - """missing values - """ - want = 'msng' - -missing_value = missing_values - -class number_or_date(aetools.ComponentItem): - """number or date - a number or date """ - want = 'nd ' - -class number_2c__date_or_text(aetools.ComponentItem): - """number, date or text - a number, date or text """ - want = 'nds ' - -class numbers(aetools.ComponentItem): - """numbers - """ - want = 'nmbr' - -number = numbers - -class November(aetools.ComponentItem): - """November - the month of November """ - want = 'nov ' - -class number_or_string(aetools.ComponentItem): - """number or string - a number or string """ - want = 'ns ' - -class references(aetools.ComponentItem): - """references - """ - want = 'obj ' - -reference = references - -class October(aetools.ComponentItem): - """October - the month of October """ - want = 'oct ' - -class ounces(aetools.ComponentItem): - """ounces - a weight measurement in SI meters """ - want = 'ozs ' - -class class_(aetools.ComponentItem): - """class - the type of a value """ - want = 'pcls' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - inherits some of its properties from this class """ - which = 'c@#^' - want = 'type' - -classes = class_ - -class prepositions(aetools.ComponentItem): - """prepositions - """ - want = 'prep' - -preposition = prepositions - -class properties(aetools.ComponentItem): - """properties - """ - want = 'prop' - -property = properties - -class writing_code(aetools.ComponentItem): - """writing code - codes that identify the language and script system """ - want = 'psct' - -class Pascal_strings(aetools.ComponentItem): - """Pascal strings - """ - want = 'pstr' - -Pascal_string = Pascal_strings - -class quarts(aetools.ComponentItem): - """quarts - a volume measurement in Imperial quarts """ - want = 'qrts' - -class data(aetools.ComponentItem): - """data - an AppleScript raw data object """ - want = 'rdat' - -class records(aetools.ComponentItem): - """records - """ - want = 'reco' - -record = records - -class Saturday(aetools.ComponentItem): - """Saturday - Saturday """ - want = 'sat ' - -class seconds(aetools.ComponentItem): - """seconds - more than one second """ - want = 'scnd' - -class script(aetools.ComponentItem): - """script - An AppleScript script """ - want = 'scpt' -class _Prop_name(aetools.NProperty): - """name - the name of the script """ - which = 'pnam' - want = 'TEXT' -class _Prop_parent(aetools.NProperty): - """parent - its parent, i.e. the script that will handle events that this script doesn\xd5t """ - which = 'pare' - want = 'scpt' - -scripts = script - -class September(aetools.ComponentItem): - """September - the month of September """ - want = 'sep ' - -class alias_or_string(aetools.ComponentItem): - """alias or string - an alias or string """ - want = 'sf ' - -class sounds(aetools.ComponentItem): - """sounds - """ - want = 'snd ' - -sound = sounds - -class square_feet(aetools.ComponentItem): - """square feet - an area measurement in Imperial square feet """ - want = 'sqft' - -class square_kilometers(aetools.ComponentItem): - """square kilometers - an area measurement in SI square kilometers """ - want = 'sqkm' - -square_kilometres = square_kilometers - -class square_miles(aetools.ComponentItem): - """square miles - an area measurement in Imperial square miles """ - want = 'sqmi' - -class square_meters(aetools.ComponentItem): - """square meters - an area measurement in SI square meters """ - want = 'sqrm' - -square_metres = square_meters - -class square_yards(aetools.ComponentItem): - """square yards - an area measurement in Imperial square yards """ - want = 'sqyd' - -class styled_Clipboard_text(aetools.ComponentItem): - """styled Clipboard text - clipboard text with font, size, and style information """ - want = 'styl' - -styled_Clipboard_text = styled_Clipboard_text - -class Sunday(aetools.ComponentItem): - """Sunday - Sunday """ - want = 'sun ' - -class styled_Unicode_text(aetools.ComponentItem): - """styled Unicode text - styled text in the Unicode format """ - want = 'sutx' - -styled_Unicode_text = styled_Unicode_text - -class Thursday(aetools.ComponentItem): - """Thursday - Thursday """ - want = 'thu ' - -class Tuesday(aetools.ComponentItem): - """Tuesday - Tuesday """ - want = 'tue ' - -class type_class(aetools.ComponentItem): - """type class - the name of a particular class (or any four-character code) """ - want = 'type' - -class empty_ae_name_(aetools.ComponentItem): - """ - the undefined value """ - want = 'undf' - -class Unicode_text(aetools.ComponentItem): - """Unicode text - text in the Unicode format (cannot be viewed without conversion) """ - want = 'utxt' - -Unicode_text = Unicode_text - -class vector(aetools.ComponentItem): - """vector - An ordered collection of items """ - want = 'vect' - -vectors = vector - -class version(aetools.ComponentItem): - """version - a version value """ - want = 'vers' - -class Wednesday(aetools.ComponentItem): - """Wednesday - Wednesday """ - want = 'wed ' - -class weekdays(aetools.ComponentItem): - """weekdays - """ - want = 'wkdy' - -weekday = weekdays - -class yards(aetools.ComponentItem): - """yards - a distance measurement in Imperial yards """ - want = 'yard' - -class zones(aetools.ComponentItem): - """zones - """ - want = 'zone' - -zone = zones -anything._superclassnames = [] -anything._privpropdict = { -} -anything._privelemdict = { -} -pictures._superclassnames = [] -pictures._privpropdict = { -} -pictures._privelemdict = { -} -styled_text._superclassnames = [] -styled_text._privpropdict = { -} -styled_text._privelemdict = { -} -styled_text._superclassnames = [] -styled_text._privpropdict = { -} -styled_text._privelemdict = { -} -strings._superclassnames = [] -strings._privpropdict = { -} -strings._privelemdict = { -} -alias._superclassnames = [] -alias._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, -} -alias._privelemdict = { -} -April._superclassnames = [] -April._privpropdict = { -} -April._privelemdict = { -} -August._superclassnames = [] -August._privpropdict = { -} -August._privelemdict = { -} -booleans._superclassnames = [] -booleans._privpropdict = { -} -booleans._privelemdict = { -} -RGB_colors._superclassnames = [] -RGB_colors._privpropdict = { -} -RGB_colors._privelemdict = { -} -application._superclassnames = [] -application._privpropdict = { - 'AppleScript' : _Prop_AppleScript, - 'days' : _Prop_days, - 'hours' : _Prop_hours, - 'minutes' : _Prop_minutes, - 'pi' : _Prop_pi, - 'print_depth' : _Prop_print_depth, - 'print_length' : _Prop_print_length, - 'result' : _Prop_result, - 'return_' : _Prop_return_, - 'space' : _Prop_space, - 'tab' : _Prop_tab, - 'text_item_delimiters' : _Prop_text_item_delimiters, - 'weeks' : _Prop_weeks, -} -application._privelemdict = { -} -upper_case._superclassnames = [] -upper_case._privpropdict = { -} -upper_case._privelemdict = { -} -cubic_centimeters._superclassnames = [] -cubic_centimeters._privpropdict = { -} -cubic_centimeters._privelemdict = { -} -cubic_feet._superclassnames = [] -cubic_feet._privpropdict = { -} -cubic_feet._privelemdict = { -} -characters._superclassnames = [] -characters._privpropdict = { -} -characters._privelemdict = { -} -writing_code_info._superclassnames = [] -writing_code_info._privpropdict = { - 'language_code' : _Prop_language_code, - 'script_code' : _Prop_script_code, -} -writing_code_info._privelemdict = { -} -text_items._superclassnames = [] -text_items._privpropdict = { -} -text_items._privelemdict = { -} -cubic_meters._superclassnames = [] -cubic_meters._privpropdict = { -} -cubic_meters._privelemdict = { -} -centimeters._superclassnames = [] -centimeters._privpropdict = { -} -centimeters._privelemdict = { -} -item._superclassnames = [] -item._privpropdict = { - 'id' : _Prop_id, -} -item._privelemdict = { -} -C_strings._superclassnames = [] -C_strings._privpropdict = { -} -C_strings._privelemdict = { -} -text._superclassnames = [] -text._privpropdict = { -} -text._privelemdict = { -} -cubic_inches._superclassnames = [] -cubic_inches._privpropdict = { -} -cubic_inches._privelemdict = { -} -cubic_yards._superclassnames = [] -cubic_yards._privpropdict = { -} -cubic_yards._privelemdict = { -} -December._superclassnames = [] -December._privpropdict = { -} -December._privelemdict = { -} -degrees_Celsius._superclassnames = [] -degrees_Celsius._privpropdict = { -} -degrees_Celsius._privelemdict = { -} -degrees_Fahrenheit._superclassnames = [] -degrees_Fahrenheit._privpropdict = { -} -degrees_Fahrenheit._privelemdict = { -} -degrees_Kelvin._superclassnames = [] -degrees_Kelvin._privpropdict = { -} -degrees_Kelvin._privelemdict = { -} -reals._superclassnames = [] -reals._privpropdict = { -} -reals._privelemdict = { -} -encoded_strings._superclassnames = [] -encoded_strings._privpropdict = { -} -encoded_strings._privelemdict = { -} -constants._superclassnames = [] -constants._privpropdict = { -} -constants._privelemdict = { -} -events._superclassnames = [] -events._privpropdict = { -} -events._privelemdict = { -} -February._superclassnames = [] -February._privpropdict = { -} -February._privelemdict = { -} -feet._superclassnames = [] -feet._privpropdict = { -} -feet._privelemdict = { -} -Friday._superclassnames = [] -Friday._privpropdict = { -} -Friday._privelemdict = { -} -file_specification._superclassnames = [] -file_specification._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, -} -file_specification._privelemdict = { -} -gallons._superclassnames = [] -gallons._privpropdict = { -} -gallons._privelemdict = { -} -grams._superclassnames = [] -grams._privpropdict = { -} -grams._privelemdict = { -} -handlers._superclassnames = [] -handlers._privpropdict = { -} -handlers._privelemdict = { -} -inches._superclassnames = [] -inches._privpropdict = { -} -inches._privelemdict = { -} -international_text._superclassnames = [] -international_text._privpropdict = { -} -international_text._privelemdict = { -} -international_text._superclassnames = [] -international_text._privpropdict = { -} -international_text._privelemdict = { -} -January._superclassnames = [] -January._privpropdict = { -} -January._privelemdict = { -} -July._superclassnames = [] -July._privpropdict = { -} -July._privelemdict = { -} -June._superclassnames = [] -June._privpropdict = { -} -June._privelemdict = { -} -reference_forms._superclassnames = [] -reference_forms._privpropdict = { -} -reference_forms._privelemdict = { -} -kilograms._superclassnames = [] -kilograms._privpropdict = { -} -kilograms._privelemdict = { -} -kilometers._superclassnames = [] -kilometers._privpropdict = { -} -kilometers._privelemdict = { -} -keystroke._superclassnames = [] -keystroke._privpropdict = { - 'key' : _Prop_key, - 'key_kind' : _Prop_key_kind, - 'modifiers' : _Prop_modifiers, -} -keystroke._privelemdict = { -} -pounds._superclassnames = [] -pounds._privpropdict = { -} -pounds._privelemdict = { -} -date._superclassnames = [] -date._privpropdict = { - 'date_string' : _Prop_date_string, - 'day' : _Prop_day, - 'month' : _Prop_month, - 'time' : _Prop_time, - 'time_string' : _Prop_time_string, - 'weekday' : _Prop_weekday, - 'year' : _Prop_year, -} -date._privelemdict = { -} -list._superclassnames = [] -list._privpropdict = { - 'length' : _Prop_length, - 'rest' : _Prop_rest, - 'reverse' : _Prop_reverse, -} -list._privelemdict = { -} -liters._superclassnames = [] -liters._privpropdict = { -} -liters._privelemdict = { -} -linked_list._superclassnames = [] -linked_list._privpropdict = { - 'length' : _Prop_length, -} -linked_list._privelemdict = { -} -integers._superclassnames = [] -integers._privpropdict = { -} -integers._privelemdict = { -} -list_or_record._superclassnames = [] -list_or_record._privpropdict = { -} -list_or_record._privelemdict = { -} -list_2c__record_or_text._superclassnames = [] -list_2c__record_or_text._privpropdict = { -} -list_2c__record_or_text._privelemdict = { -} -list_or_string._superclassnames = [] -list_or_string._privpropdict = { -} -list_or_string._privelemdict = { -} -machines._superclassnames = [] -machines._privpropdict = { -} -machines._privelemdict = { -} -March._superclassnames = [] -March._privpropdict = { -} -March._privelemdict = { -} -May._superclassnames = [] -May._privpropdict = { -} -May._privelemdict = { -} -meters._superclassnames = [] -meters._privpropdict = { -} -meters._privelemdict = { -} -miles._superclassnames = [] -miles._privpropdict = { -} -miles._privelemdict = { -} -months._superclassnames = [] -months._privpropdict = { -} -months._privelemdict = { -} -Monday._superclassnames = [] -Monday._privpropdict = { -} -Monday._privelemdict = { -} -missing_values._superclassnames = [] -missing_values._privpropdict = { -} -missing_values._privelemdict = { -} -number_or_date._superclassnames = [] -number_or_date._privpropdict = { -} -number_or_date._privelemdict = { -} -number_2c__date_or_text._superclassnames = [] -number_2c__date_or_text._privpropdict = { -} -number_2c__date_or_text._privelemdict = { -} -numbers._superclassnames = [] -numbers._privpropdict = { -} -numbers._privelemdict = { -} -November._superclassnames = [] -November._privpropdict = { -} -November._privelemdict = { -} -number_or_string._superclassnames = [] -number_or_string._privpropdict = { -} -number_or_string._privelemdict = { -} -references._superclassnames = [] -references._privpropdict = { -} -references._privelemdict = { -} -October._superclassnames = [] -October._privpropdict = { -} -October._privelemdict = { -} -ounces._superclassnames = [] -ounces._privpropdict = { -} -ounces._privelemdict = { -} -class_._superclassnames = ['type_class'] -class_._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -class_._privelemdict = { -} -prepositions._superclassnames = [] -prepositions._privpropdict = { -} -prepositions._privelemdict = { -} -properties._superclassnames = [] -properties._privpropdict = { -} -properties._privelemdict = { -} -writing_code._superclassnames = [] -writing_code._privpropdict = { -} -writing_code._privelemdict = { -} -Pascal_strings._superclassnames = [] -Pascal_strings._privpropdict = { -} -Pascal_strings._privelemdict = { -} -quarts._superclassnames = [] -quarts._privpropdict = { -} -quarts._privelemdict = { -} -data._superclassnames = [] -data._privpropdict = { -} -data._privelemdict = { -} -records._superclassnames = [] -records._privpropdict = { -} -records._privelemdict = { -} -Saturday._superclassnames = [] -Saturday._privpropdict = { -} -Saturday._privelemdict = { -} -seconds._superclassnames = [] -seconds._privpropdict = { -} -seconds._privelemdict = { -} -script._superclassnames = [] -script._privpropdict = { - 'name' : _Prop_name, - 'parent' : _Prop_parent, -} -script._privelemdict = { -} -September._superclassnames = [] -September._privpropdict = { -} -September._privelemdict = { -} -alias_or_string._superclassnames = [] -alias_or_string._privpropdict = { -} -alias_or_string._privelemdict = { -} -sounds._superclassnames = [] -sounds._privpropdict = { -} -sounds._privelemdict = { -} -square_feet._superclassnames = [] -square_feet._privpropdict = { -} -square_feet._privelemdict = { -} -square_kilometers._superclassnames = [] -square_kilometers._privpropdict = { -} -square_kilometers._privelemdict = { -} -square_miles._superclassnames = [] -square_miles._privpropdict = { -} -square_miles._privelemdict = { -} -square_meters._superclassnames = [] -square_meters._privpropdict = { -} -square_meters._privelemdict = { -} -square_yards._superclassnames = [] -square_yards._privpropdict = { -} -square_yards._privelemdict = { -} -styled_Clipboard_text._superclassnames = [] -styled_Clipboard_text._privpropdict = { -} -styled_Clipboard_text._privelemdict = { -} -styled_Clipboard_text._superclassnames = [] -styled_Clipboard_text._privpropdict = { -} -styled_Clipboard_text._privelemdict = { -} -Sunday._superclassnames = [] -Sunday._privpropdict = { -} -Sunday._privelemdict = { -} -styled_Unicode_text._superclassnames = [] -styled_Unicode_text._privpropdict = { -} -styled_Unicode_text._privelemdict = { -} -styled_Unicode_text._superclassnames = [] -styled_Unicode_text._privpropdict = { -} -styled_Unicode_text._privelemdict = { -} -Thursday._superclassnames = [] -Thursday._privpropdict = { -} -Thursday._privelemdict = { -} -Tuesday._superclassnames = [] -Tuesday._privpropdict = { -} -Tuesday._privelemdict = { -} -type_class._superclassnames = [] -type_class._privpropdict = { -} -type_class._privelemdict = { -} -empty_ae_name_._superclassnames = [] -empty_ae_name_._privpropdict = { -} -empty_ae_name_._privelemdict = { -} -Unicode_text._superclassnames = [] -Unicode_text._privpropdict = { -} -Unicode_text._privelemdict = { -} -Unicode_text._superclassnames = [] -Unicode_text._privpropdict = { -} -Unicode_text._privelemdict = { -} -vector._superclassnames = [] -vector._privpropdict = { - 'length' : _Prop_length, -} -vector._privelemdict = { -} -version._superclassnames = [] -version._privpropdict = { -} -version._privelemdict = { -} -Wednesday._superclassnames = [] -Wednesday._privpropdict = { -} -Wednesday._privelemdict = { -} -weekdays._superclassnames = [] -weekdays._privpropdict = { -} -weekdays._privelemdict = { -} -yards._superclassnames = [] -yards._privpropdict = { -} -yards._privelemdict = { -} -zones._superclassnames = [] -zones._privpropdict = { -} -zones._privelemdict = { -} -_Enum_boov = { - 'true' : 'true', # the true boolean value - 'false' : 'fals', # the false boolean value -} - -_Enum_cons = { - 'case' : 'case', # case - 'diacriticals' : 'diac', # diacriticals - 'white_space' : 'whit', # white space - 'hyphens' : 'hyph', # hyphens - 'expansion' : 'expa', # expansion - 'punctuation' : 'punc', # punctuation - 'application_responses' : 'rmte', # remote event replies -} - -_Enum_eMds = { - 'option_down' : 'Kopt', # - 'command_down' : 'Kcmd', # - 'control_down' : 'Kctl', # - 'shift_down' : 'Ksft', # - 'caps_lock_down' : 'Kclk', # -} - -_Enum_ekst = { - 'escape_key' : 'ks5\x00', # - 'delete_key' : 'ks3\x00', # - 'tab_key' : 'ks0\x00', # - 'return_key' : 'ks$\x00', # - 'clear_key' : 'ksG\x00', # - 'enter_key' : 'ksL\x00', # - 'up_arrow_key' : 'ks~\x00', # - 'down_arrow_key' : 'ks}\x00', # - 'left_arrow_key' : 'ks{\x00', # - 'right_arrow_key' : 'ks|\x00', # - 'help_key' : 'ksr\x00', # - 'home_key' : 'kss\x00', # - 'page_up_key' : 'kst\x00', # - 'page_down_key' : 'ksy\x00', # - 'forward_del_key' : 'ksu\x00', # - 'end_key' : 'ksw\x00', # - 'F1_key' : 'ksz\x00', # - 'F2_key' : 'ksx\x00', # - 'F3_key' : 'ksc\x00', # - 'F4_key' : 'ksv\x00', # - 'F5_key' : 'ks`\x00', # - 'F6_key' : 'ksa\x00', # - 'F7_key' : 'ksb\x00', # - 'F8_key' : 'ksd\x00', # - 'F9_key' : 'kse\x00', # - 'F10_key' : 'ksm\x00', # - 'F11_key' : 'ksg\x00', # - 'F12_key' : 'kso\x00', # - 'F13_key' : 'ksi\x00', # - 'F14_key' : 'ksk\x00', # - 'F15_key' : 'ksq\x00', # -} - -_Enum_misc = { - 'current_application' : 'cura', # the current application -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - '****' : anything, - 'PICT' : pictures, - 'STXT' : styled_text, - 'TEXT' : strings, - 'alis' : alias, - 'apr ' : April, - 'aug ' : August, - 'bool' : booleans, - 'cRGB' : RGB_colors, - 'capp' : application, - 'case' : upper_case, - 'ccmt' : cubic_centimeters, - 'cfet' : cubic_feet, - 'cha ' : characters, - 'citl' : writing_code_info, - 'citm' : text_items, - 'cmet' : cubic_meters, - 'cmtr' : centimeters, - 'cobj' : item, - 'cstr' : C_strings, - 'ctxt' : text, - 'cuin' : cubic_inches, - 'cyrd' : cubic_yards, - 'dec ' : December, - 'degc' : degrees_Celsius, - 'degf' : degrees_Fahrenheit, - 'degk' : degrees_Kelvin, - 'doub' : reals, - 'encs' : encoded_strings, - 'enum' : constants, - 'evnt' : events, - 'feb ' : February, - 'feet' : feet, - 'fri ' : Friday, - 'fss ' : file_specification, - 'galn' : gallons, - 'gram' : grams, - 'hand' : handlers, - 'inch' : inches, - 'itxt' : international_text, - 'jan ' : January, - 'jul ' : July, - 'jun ' : June, - 'kfrm' : reference_forms, - 'kgrm' : kilograms, - 'kmtr' : kilometers, - 'kprs' : keystroke, - 'lbs ' : pounds, - 'ldt ' : date, - 'list' : list, - 'litr' : liters, - 'llst' : linked_list, - 'long' : integers, - 'lr ' : list_or_record, - 'lrs ' : list_2c__record_or_text, - 'ls ' : list_or_string, - 'mach' : machines, - 'mar ' : March, - 'may ' : May, - 'metr' : meters, - 'mile' : miles, - 'mnth' : months, - 'mon ' : Monday, - 'msng' : missing_values, - 'nd ' : number_or_date, - 'nds ' : number_2c__date_or_text, - 'nmbr' : numbers, - 'nov ' : November, - 'ns ' : number_or_string, - 'obj ' : references, - 'oct ' : October, - 'ozs ' : ounces, - 'pcls' : class_, - 'prep' : prepositions, - 'prop' : properties, - 'psct' : writing_code, - 'pstr' : Pascal_strings, - 'qrts' : quarts, - 'rdat' : data, - 'reco' : records, - 'sat ' : Saturday, - 'scnd' : seconds, - 'scpt' : script, - 'sep ' : September, - 'sf ' : alias_or_string, - 'snd ' : sounds, - 'sqft' : square_feet, - 'sqkm' : square_kilometers, - 'sqmi' : square_miles, - 'sqrm' : square_meters, - 'sqyd' : square_yards, - 'styl' : styled_Clipboard_text, - 'sun ' : Sunday, - 'sutx' : styled_Unicode_text, - 'thu ' : Thursday, - 'tue ' : Tuesday, - 'type' : type_class, - 'undf' : empty_ae_name_, - 'utxt' : Unicode_text, - 'vect' : vector, - 'vers' : version, - 'wed ' : Wednesday, - 'wkdy' : weekdays, - 'yard' : yards, - 'zone' : zones, -} - -_propdeclarations = { - 'ID ' : _Prop_id, - 'ascr' : _Prop_AppleScript, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'day ' : _Prop_day, - 'days' : _Prop_days, - 'dstr' : _Prop_date_string, - 'hour' : _Prop_hours, - 'kMod' : _Prop_modifiers, - 'kMsg' : _Prop_key, - 'kknd' : _Prop_key_kind, - 'leng' : _Prop_length, - 'min ' : _Prop_minutes, - 'mnth' : _Prop_month, - 'pare' : _Prop_parent, - 'pi ' : _Prop_pi, - 'plcd' : _Prop_language_code, - 'pnam' : _Prop_name, - 'prdp' : _Prop_print_depth, - 'prln' : _Prop_print_length, - 'pscd' : _Prop_script_code, - 'psxp' : _Prop_POSIX_path, - 'rest' : _Prop_rest, - 'ret ' : _Prop_return_, - 'rslt' : _Prop_result, - 'rvse' : _Prop_reverse, - 'spac' : _Prop_space, - 'tab ' : _Prop_tab, - 'time' : _Prop_time, - 'tstr' : _Prop_time_string, - 'txdl' : _Prop_text_item_delimiters, - 'week' : _Prop_weeks, - 'wkdy' : _Prop_weekday, - 'year' : _Prop_year, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'boov' : _Enum_boov, - 'cons' : _Enum_cons, - 'eMds' : _Enum_eMds, - 'ekst' : _Enum_ekst, - 'misc' : _Enum_misc, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py deleted file mode 100644 index 99fe5e348..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py +++ /dev/null @@ -1,373 +0,0 @@ -"""Suite Macintosh Connectivity Classes: Classes relating to Apple Macintosh personal computer connectivity -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'macc' - -class Macintosh_Connectivity_Clas_Events: - - pass - - -class ADB_address(aetools.ComponentItem): - """ADB address - Addresses a device connected via Apple Desktop Bus """ - want = 'cadb' -class _Prop__3c_inheritance_3e_(aetools.NProperty): - """<inheritance> - inherits some of its properties from this class """ - which = 'c@#^' - want = 'cadr' -class _Prop_ID(aetools.NProperty): - """ID - the Apple Desktop Bus device ID """ - which = 'ID ' - want = 'shor' - -ADB_addresses = ADB_address - -class address_specification(aetools.ComponentItem): - """address specification - Unique designation of a device or service connected to this computer """ - want = 'cadr' -class _Prop_conduit(aetools.NProperty): - """conduit - How the addressee is physically connected """ - which = 'pcon' - want = 'econ' -class _Prop_properties(aetools.NProperty): - """properties - property that allows getting and setting of multiple properties """ - which = 'pALL' - want = 'reco' -class _Prop_protocol(aetools.NProperty): - """protocol - How to talk to this addressee """ - which = 'pprt' - want = 'epro' - -address_specifications = address_specification - -class AppleTalk_address(aetools.ComponentItem): - """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ - want = 'cat ' -class _Prop_AppleTalk_machine(aetools.NProperty): - """AppleTalk machine - the machine name part of the address """ - which = 'patm' - want = 'TEXT' -class _Prop_AppleTalk_type(aetools.NProperty): - """AppleTalk type - the type part of the AppleTalk address """ - which = 'patt' - want = 'TEXT' -class _Prop_AppleTalk_zone(aetools.NProperty): - """AppleTalk zone - the zone part of the address """ - which = 'patz' - want = 'TEXT' - -AppleTalk_addresses = AppleTalk_address - -class bus_slot(aetools.ComponentItem): - """bus slot - Addresses a PC, PCI, or NuBus card """ - want = 'cbus' - -bus_slots = bus_slot - -class device_specification(aetools.ComponentItem): - """device specification - A device connected to a computer """ - want = 'cdev' -class _Prop_device_address(aetools.NProperty): - """device address - the address of the device """ - which = 'pdva' - want = 'cadr' -class _Prop_device_type(aetools.NProperty): - """device type - the kind of device """ - which = 'pdvt' - want = 'edvt' - -device_specifications = device_specification - -class Ethernet_address(aetools.ComponentItem): - """Ethernet address - Addresses a device by its Ethernet address """ - want = 'cen ' - -Ethernet_addresses = Ethernet_address - -class FireWire_address(aetools.ComponentItem): - """FireWire address - Addresses a device on the FireWire bus """ - want = 'cfw ' - -FireWire_addresses = FireWire_address - -class IP_address(aetools.ComponentItem): - """IP address - Addresses a device or service via the Internet Protocol (IP) """ - want = 'cip ' -class _Prop_DNS_form(aetools.NProperty): - """DNS form - the address in the form "apple.com" """ - which = 'pdns' - want = 'TEXT' -class _Prop_port(aetools.NProperty): - """port - the port number of the service or client being addressed """ - which = 'ppor' - want = 'TEXT' - -IP_addresses = IP_address - -class LocalTalk_address(aetools.ComponentItem): - """LocalTalk address - Addresses a device by its LocalTalk address """ - want = 'clt ' -class _Prop_network(aetools.NProperty): - """network - the LocalTalk network number """ - which = 'pnet' - want = 'shor' -class _Prop_node(aetools.NProperty): - """node - the LocalTalk node number """ - which = 'pnod' - want = 'shor' -class _Prop_socket(aetools.NProperty): - """socket - the LocalTalk socket number """ - which = 'psoc' - want = 'shor' - -LocalTalk_addresses = LocalTalk_address - -class SCSI_address(aetools.ComponentItem): - """SCSI address - Addresses a SCSI device """ - want = 'cscs' -class _Prop_LUN(aetools.NProperty): - """LUN - the SCSI logical unit number """ - which = 'pslu' - want = 'shor' -class _Prop_SCSI_bus(aetools.NProperty): - """SCSI bus - the SCSI bus number """ - which = 'pscb' - want = 'shor' - -SCSI_addresses = SCSI_address - -class Token_Ring_address(aetools.ComponentItem): - """Token Ring address - Addresses a device or service via the Token Ring protocol """ - want = 'ctok' - -Token_Ring_addresses = Token_Ring_address - -class USB_address(aetools.ComponentItem): - """USB address - Addresses a device on the Universal Serial Bus """ - want = 'cusb' -class _Prop_name(aetools.NProperty): - """name - the USB device name """ - which = 'pnam' - want = 'TEXT' - -USB_Addresses = USB_address -ADB_address._superclassnames = ['address_specification'] -ADB_address._privpropdict = { - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -ADB_address._privelemdict = { -} -address_specification._superclassnames = [] -address_specification._privpropdict = { - 'conduit' : _Prop_conduit, - 'properties' : _Prop_properties, - 'protocol' : _Prop_protocol, -} -address_specification._privelemdict = { -} -AppleTalk_address._superclassnames = ['address_specification'] -AppleTalk_address._privpropdict = { - 'AppleTalk_machine' : _Prop_AppleTalk_machine, - 'AppleTalk_type' : _Prop_AppleTalk_type, - 'AppleTalk_zone' : _Prop_AppleTalk_zone, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -AppleTalk_address._privelemdict = { -} -bus_slot._superclassnames = ['address_specification'] -bus_slot._privpropdict = { - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -bus_slot._privelemdict = { -} -device_specification._superclassnames = [] -device_specification._privpropdict = { - 'device_address' : _Prop_device_address, - 'device_type' : _Prop_device_type, - 'properties' : _Prop_properties, -} -device_specification._privelemdict = { -} -Ethernet_address._superclassnames = ['address_specification'] -Ethernet_address._privpropdict = { - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -Ethernet_address._privelemdict = { -} -FireWire_address._superclassnames = ['address_specification'] -FireWire_address._privpropdict = { - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -FireWire_address._privelemdict = { -} -IP_address._superclassnames = ['address_specification'] -IP_address._privpropdict = { - 'DNS_form' : _Prop_DNS_form, - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, - 'port' : _Prop_port, -} -IP_address._privelemdict = { -} -LocalTalk_address._superclassnames = ['address_specification'] -LocalTalk_address._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, - 'network' : _Prop_network, - 'node' : _Prop_node, - 'socket' : _Prop_socket, -} -LocalTalk_address._privelemdict = { -} -SCSI_address._superclassnames = ['address_specification'] -SCSI_address._privpropdict = { - 'ID' : _Prop_ID, - 'LUN' : _Prop_LUN, - 'SCSI_bus' : _Prop_SCSI_bus, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -SCSI_address._privelemdict = { -} -Token_Ring_address._superclassnames = ['address_specification'] -Token_Ring_address._privpropdict = { - 'ID' : _Prop_ID, - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -Token_Ring_address._privelemdict = { -} -USB_address._superclassnames = ['address_specification'] -USB_address._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, - 'name' : _Prop_name, -} -USB_address._privelemdict = { -} -_Enum_econ = { - 'ADB' : 'eadb', # - 'printer_port' : 'ecpp', # - 'modem_port' : 'ecmp', # - 'modem_printer_port' : 'empp', # - 'LocalTalk' : 'eclt', # - 'Ethernet' : 'ecen', # - 'Token_Ring' : 'etok', # - 'SCSI' : 'ecsc', # - 'USB' : 'ecus', # - 'FireWire' : 'ecfw', # - 'infrared' : 'ecir', # - 'PC_card' : 'ecpc', # - 'PCI_bus' : 'ecpi', # - 'NuBus' : 'enub', # - 'PDS_slot' : 'ecpd', # - 'Comm_slot' : 'eccm', # - 'monitor_out' : 'ecmn', # - 'video_out' : 'ecvo', # - 'video_in' : 'ecvi', # - 'audio_out' : 'ecao', # - 'audio_line_in' : 'ecai', # - 'audio_line_out' : 'ecal', # - 'microphone' : 'ecmi', # -} - -_Enum_edvt = { - 'hard_disk_drive' : 'ehd ', # - 'floppy_disk_drive' : 'efd ', # - 'CD_ROM_drive' : 'ecd ', # - 'DVD_drive' : 'edvd', # - 'storage_device' : 'edst', # - 'keyboard' : 'ekbd', # - 'mouse' : 'emou', # - 'trackball' : 'etrk', # - 'trackpad' : 'edtp', # - 'pointing_device' : 'edpd', # - 'video_monitor' : 'edvm', # - 'LCD_display' : 'edlc', # - 'display' : 'edds', # - 'modem' : 'edmm', # - 'PC_card' : 'ecpc', # - 'PCI_card' : 'edpi', # - 'NuBus_card' : 'ednb', # - 'printer' : 'edpr', # - 'speakers' : 'edsp', # - 'microphone' : 'ecmi', # -} - -_Enum_epro = { - 'serial' : 'epsr', # - 'AppleTalk' : 'epat', # - 'IP' : 'epip', # - 'SCSI' : 'ecsc', # - 'ADB' : 'eadb', # - 'FireWire' : 'ecfw', # - 'IrDA' : 'epir', # - 'IRTalk' : 'epit', # - 'USB' : 'ecus', # - 'PC_card' : 'ecpc', # - 'PCI_bus' : 'ecpi', # - 'NuBus' : 'enub', # - 'bus' : 'ebus', # - 'Macintosh_video' : 'epmv', # - 'SVGA' : 'epsg', # - 'S_video' : 'epsv', # - 'analog_audio' : 'epau', # - 'digital_audio' : 'epda', # - 'PostScript' : 'epps', # -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cadb' : ADB_address, - 'cadr' : address_specification, - 'cat ' : AppleTalk_address, - 'cbus' : bus_slot, - 'cdev' : device_specification, - 'cen ' : Ethernet_address, - 'cfw ' : FireWire_address, - 'cip ' : IP_address, - 'clt ' : LocalTalk_address, - 'cscs' : SCSI_address, - 'ctok' : Token_Ring_address, - 'cusb' : USB_address, -} - -_propdeclarations = { - 'ID ' : _Prop_ID, - 'c@#^' : _Prop__3c_inheritance_3e_, - 'pALL' : _Prop_properties, - 'patm' : _Prop_AppleTalk_machine, - 'patt' : _Prop_AppleTalk_type, - 'patz' : _Prop_AppleTalk_zone, - 'pcon' : _Prop_conduit, - 'pdns' : _Prop_DNS_form, - 'pdva' : _Prop_device_address, - 'pdvt' : _Prop_device_type, - 'pnam' : _Prop_name, - 'pnet' : _Prop_network, - 'pnod' : _Prop_node, - 'ppor' : _Prop_port, - 'pprt' : _Prop_protocol, - 'pscb' : _Prop_SCSI_bus, - 'pslu' : _Prop_LUN, - 'psoc' : _Prop_socket, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'econ' : _Enum_econ, - 'edvt' : _Enum_edvt, - 'epro' : _Enum_epro, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py deleted file mode 100644 index 11747f9c3..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py +++ /dev/null @@ -1,417 +0,0 @@ -"""Suite QuickDraw Graphics Suite: A set of basic classes for graphics -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'qdrw' - -class QuickDraw_Graphics_Suite_Events: - - pass - - -class arc(aetools.ComponentItem): - """arc - An arc """ - want = 'carc' -class _Prop_arc_angle(aetools.NProperty): - """arc angle - the angle of the arc in degrees """ - which = 'parc' - want = 'fixd' -class _Prop_bounds(aetools.NProperty): - """bounds - the smallest rectangle that contains the entire arc """ - which = 'pbnd' - want = 'qdrt' -class _Prop_definition_rect(aetools.NProperty): - """definition rect - the rectangle that contains the circle or oval used to define the arc """ - which = 'pdrt' - want = 'qdrt' -class _Prop_fill_color(aetools.NProperty): - """fill color - the fill color """ - which = 'flcl' - want = 'cRGB' -class _Prop_fill_pattern(aetools.NProperty): - """fill pattern - the fill pattern """ - which = 'flpt' - want = 'cpix' -class _Prop_pen_color(aetools.NProperty): - """pen color - the pen color """ - which = 'ppcl' - want = 'cRGB' -class _Prop_pen_pattern(aetools.NProperty): - """pen pattern - the pen pattern """ - which = 'pppa' - want = 'cpix' -class _Prop_pen_width(aetools.NProperty): - """pen width - the pen width """ - which = 'ppwd' - want = 'shor' -class _Prop_start_angle(aetools.NProperty): - """start angle - the angle that defines the start of the arc, in degrees """ - which = 'pang' - want = 'fixd' -class _Prop_transfer_mode(aetools.NProperty): - """transfer mode - the transfer mode """ - which = 'pptm' - want = 'tran' - -arcs = arc - -class drawing_area(aetools.ComponentItem): - """drawing area - Container for graphics and supporting information """ - want = 'cdrw' -class _Prop_background_color(aetools.NProperty): - """background color - the color used to fill in unoccupied areas """ - which = 'pbcl' - want = 'cRGB' -class _Prop_background_pattern(aetools.NProperty): - """background pattern - the pattern used to fill in unoccupied areas """ - which = 'pbpt' - want = 'cpix' -class _Prop_color_table(aetools.NProperty): - """color table - the color table """ - which = 'cltb' - want = 'clrt' -class _Prop_default_font(aetools.NProperty): - """default font - the name of the default font for text objects """ - which = 'ptxf' - want = 'itxt' -class _Prop_default_location(aetools.NProperty): - """default location - the default location of each new graphic object """ - which = 'pnel' - want = 'QDpt' -class _Prop_default_size(aetools.NProperty): - """default size - the default size for text objects """ - which = 'ptps' - want = 'fixd' -class _Prop_name(aetools.NProperty): - """name - the name """ - which = 'pnam' - want = 'itxt' -class _Prop_ordering(aetools.NProperty): - """ordering - the ordered list of graphic objects in the drawing area """ - which = 'gobs' - want = 'obj ' -class _Prop_pixel_depth(aetools.NProperty): - """pixel depth - the number of bits per pixel """ - which = 'pdpt' - want = 'shor' -class _Prop_style(aetools.NProperty): - """style - the default text style for text objects """ - which = 'txst' - want = 'tsty' -class _Prop_text_color(aetools.NProperty): - """text color - the default color for text objects """ - which = 'ptxc' - want = 'cRGB' -class _Prop_update_on_change(aetools.NProperty): - """update on change - Redraw after each change? """ - which = 'pupd' - want = 'bool' -class _Prop_writing_code(aetools.NProperty): - """writing code - the script system and language of text objects in the drawing area """ - which = 'psct' - want = 'intl' - -drawing_areas = drawing_area - -class graphic_objects(aetools.ComponentItem): - """graphic objects - """ - want = 'cgob' - -graphic_object = graphic_objects - -class graphic_shapes(aetools.ComponentItem): - """graphic shapes - """ - want = 'cgsh' - -graphic_shape = graphic_shapes - -class graphic_text(aetools.ComponentItem): - """graphic text - A series of characters within a drawing area """ - want = 'cgtx' -class _Prop_color(aetools.NProperty): - """color - the color of the first character """ - which = 'colr' - want = 'cRGB' -class _Prop_font(aetools.NProperty): - """font - the name of the font of the first character """ - which = 'font' - want = 'ctxt' -class _Prop_size(aetools.NProperty): - """size - the size in points of the first character """ - which = 'ptsz' - want = 'fixd' -class _Prop_uniform_styles(aetools.NProperty): - """uniform styles - the text styles that are uniform throughout the text """ - which = 'ustl' - want = 'tsty' - -class ovals(aetools.ComponentItem): - """ovals - """ - want = 'covl' - -oval = ovals - -class polygon(aetools.ComponentItem): - """polygon - A polygon """ - want = 'cpgn' -class _Prop_point_list(aetools.NProperty): - """point list - the list of points that define the polygon """ - which = 'ptlt' - want = 'QDpt' - -polygons = polygon - -class graphic_groups(aetools.ComponentItem): - """graphic groups - """ - want = 'cpic' - -graphic_group = graphic_groups - -class pixel_maps(aetools.ComponentItem): - """pixel maps - """ - want = 'cpix' - -pixel_map = pixel_maps - -class pixel(aetools.ComponentItem): - """pixel - A pixel """ - want = 'cpxl' - -pixels = pixel - -class rectangles(aetools.ComponentItem): - """rectangles - """ - want = 'crec' - -rectangle = rectangles - -class rounded_rectangle(aetools.ComponentItem): - """rounded rectangle - A rounded rectangle """ - want = 'crrc' -class _Prop_corner_curve_height(aetools.NProperty): - """corner curve height - the height of the oval used to define the shape of the rounded corners """ - which = 'pchd' - want = 'shor' -class _Prop_corner_curve_width(aetools.NProperty): - """corner curve width - the width of the oval used to define the shape of the rounded corners """ - which = 'pcwd' - want = 'shor' - -rounded_rectangles = rounded_rectangle - -class graphic_line(aetools.ComponentItem): - """graphic line - A graphic line """ - want = 'glin' -class _Prop_arrow_style(aetools.NProperty): - """arrow style - the arrow style """ - which = 'arro' - want = 'arro' -class _Prop_dash_style(aetools.NProperty): - """dash style - the dash style """ - which = 'pdst' - want = 'tdas' -class _Prop_end_point(aetools.NProperty): - """end point - the ending point of the line """ - which = 'pend' - want = 'QDpt' -class _Prop_start_point(aetools.NProperty): - """start point - the starting point of the line """ - which = 'pstp' - want = 'QDpt' - -graphic_lines = graphic_line -arc._superclassnames = [] -arc._privpropdict = { - 'arc_angle' : _Prop_arc_angle, - 'bounds' : _Prop_bounds, - 'definition_rect' : _Prop_definition_rect, - 'fill_color' : _Prop_fill_color, - 'fill_pattern' : _Prop_fill_pattern, - 'pen_color' : _Prop_pen_color, - 'pen_pattern' : _Prop_pen_pattern, - 'pen_width' : _Prop_pen_width, - 'start_angle' : _Prop_start_angle, - 'transfer_mode' : _Prop_transfer_mode, -} -arc._privelemdict = { -} -drawing_area._superclassnames = [] -drawing_area._privpropdict = { - 'background_color' : _Prop_background_color, - 'background_pattern' : _Prop_background_pattern, - 'color_table' : _Prop_color_table, - 'default_font' : _Prop_default_font, - 'default_location' : _Prop_default_location, - 'default_size' : _Prop_default_size, - 'name' : _Prop_name, - 'ordering' : _Prop_ordering, - 'pixel_depth' : _Prop_pixel_depth, - 'style' : _Prop_style, - 'text_color' : _Prop_text_color, - 'update_on_change' : _Prop_update_on_change, - 'writing_code' : _Prop_writing_code, -} -drawing_area._privelemdict = { -} -graphic_objects._superclassnames = [] -graphic_objects._privpropdict = { -} -graphic_objects._privelemdict = { -} -graphic_shapes._superclassnames = [] -graphic_shapes._privpropdict = { -} -graphic_shapes._privelemdict = { -} -graphic_text._superclassnames = [] -graphic_text._privpropdict = { - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, - 'uniform_styles' : _Prop_uniform_styles, -} -graphic_text._privelemdict = { -} -ovals._superclassnames = [] -ovals._privpropdict = { -} -ovals._privelemdict = { -} -polygon._superclassnames = [] -polygon._privpropdict = { - 'point_list' : _Prop_point_list, -} -polygon._privelemdict = { -} -graphic_groups._superclassnames = [] -graphic_groups._privpropdict = { -} -graphic_groups._privelemdict = { -} -pixel_maps._superclassnames = [] -pixel_maps._privpropdict = { -} -pixel_maps._privelemdict = { -} -pixel._superclassnames = [] -pixel._privpropdict = { - 'color' : _Prop_color, -} -pixel._privelemdict = { -} -rectangles._superclassnames = [] -rectangles._privpropdict = { -} -rectangles._privelemdict = { -} -rounded_rectangle._superclassnames = [] -rounded_rectangle._privpropdict = { - 'corner_curve_height' : _Prop_corner_curve_height, - 'corner_curve_width' : _Prop_corner_curve_width, -} -rounded_rectangle._privelemdict = { -} -graphic_line._superclassnames = [] -graphic_line._privpropdict = { - 'arrow_style' : _Prop_arrow_style, - 'dash_style' : _Prop_dash_style, - 'end_point' : _Prop_end_point, - 'start_point' : _Prop_start_point, -} -graphic_line._privelemdict = { -} -_Enum_arro = { - 'no_arrow' : 'arno', # No arrow on line - 'arrow_at_start' : 'arst', # Arrow at start of line - 'arrow_at_end' : 'aren', # Arrow at end of line - 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line -} - -_Enum_tran = { - 'copy_pixels' : 'cpy ', # - 'not_copy_pixels' : 'ncpy', # - 'or_pixels' : 'or ', # - 'not_or_pixels' : 'ntor', # - 'bic_pixels' : 'bic ', # - 'not_bic_pixels' : 'nbic', # - 'xor_pixels' : 'xor ', # - 'not_xor_pixels' : 'nxor', # - 'add_over_pixels' : 'addo', # - 'add_pin_pixels' : 'addp', # - 'sub_over_pixels' : 'subo', # - 'sub_pin_pixels' : 'subp', # - 'ad_max_pixels' : 'admx', # - 'ad_min_pixels' : 'admn', # - 'blend_pixels' : 'blnd', # -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'carc' : arc, - 'cdrw' : drawing_area, - 'cgob' : graphic_objects, - 'cgsh' : graphic_shapes, - 'cgtx' : graphic_text, - 'covl' : ovals, - 'cpgn' : polygon, - 'cpic' : graphic_groups, - 'cpix' : pixel_maps, - 'cpxl' : pixel, - 'crec' : rectangles, - 'crrc' : rounded_rectangle, - 'glin' : graphic_line, -} - -_propdeclarations = { - 'arro' : _Prop_arrow_style, - 'cltb' : _Prop_color_table, - 'colr' : _Prop_color, - 'flcl' : _Prop_fill_color, - 'flpt' : _Prop_fill_pattern, - 'font' : _Prop_font, - 'gobs' : _Prop_ordering, - 'pang' : _Prop_start_angle, - 'parc' : _Prop_arc_angle, - 'pbcl' : _Prop_background_color, - 'pbnd' : _Prop_bounds, - 'pbpt' : _Prop_background_pattern, - 'pchd' : _Prop_corner_curve_height, - 'pcwd' : _Prop_corner_curve_width, - 'pdpt' : _Prop_pixel_depth, - 'pdrt' : _Prop_definition_rect, - 'pdst' : _Prop_dash_style, - 'pend' : _Prop_end_point, - 'pnam' : _Prop_name, - 'pnel' : _Prop_default_location, - 'ppcl' : _Prop_pen_color, - 'pppa' : _Prop_pen_pattern, - 'pptm' : _Prop_transfer_mode, - 'ppwd' : _Prop_pen_width, - 'psct' : _Prop_writing_code, - 'pstp' : _Prop_start_point, - 'ptlt' : _Prop_point_list, - 'ptps' : _Prop_default_size, - 'ptsz' : _Prop_size, - 'ptxc' : _Prop_text_color, - 'ptxf' : _Prop_default_font, - 'pupd' : _Prop_update_on_change, - 'txst' : _Prop_style, - 'ustl' : _Prop_uniform_styles, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'arro' : _Enum_arro, - 'tran' : _Enum_tran, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py deleted file mode 100644 index d78193796..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py +++ /dev/null @@ -1,73 +0,0 @@ -"""Suite QuickDraw Graphics Supplemental Suite: Defines transformations of graphic objects -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'qdsp' - -class QuickDraw_Graphics_Suppleme_Events: - - pass - - -class drawing_area(aetools.ComponentItem): - """drawing area - Container for graphics and supporting information """ - want = 'cdrw' -class _Prop_rotation(aetools.NProperty): - """rotation - the default rotation for objects in the drawing area """ - which = 'prot' - want = 'trot' -class _Prop_scale(aetools.NProperty): - """scale - the default scaling for objects in the drawing area """ - which = 'pscl' - want = 'fixd' -class _Prop_translation(aetools.NProperty): - """translation - the default repositioning for objects in the drawing area """ - which = 'ptrs' - want = 'QDpt' - -drawing_areas = drawing_area - -class graphic_groups(aetools.ComponentItem): - """graphic groups - """ - want = 'cpic' - -graphic_group = graphic_groups -drawing_area._superclassnames = [] -drawing_area._privpropdict = { - 'rotation' : _Prop_rotation, - 'scale' : _Prop_scale, - 'translation' : _Prop_translation, -} -drawing_area._privelemdict = { -} -graphic_groups._superclassnames = [] -graphic_groups._privpropdict = { -} -graphic_groups._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cdrw' : drawing_area, - 'cpic' : graphic_groups, -} - -_propdeclarations = { - 'prot' : _Prop_rotation, - 'pscl' : _Prop_scale, - 'ptrs' : _Prop_translation, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py deleted file mode 100644 index 7e77dbbf5..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py +++ /dev/null @@ -1,32 +0,0 @@ -"""Suite Required Suite: Every application supports open, print, run, and quit -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'reqd' - -from _builtinSuites.builtin_Suite import * -class Required_Suite_Events(builtin_Suite_Events): - - pass - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py deleted file mode 100644 index 86681f57b..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py +++ /dev/null @@ -1,738 +0,0 @@ -"""Suite Standard Suite: Common terms for most applications -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'core' - -from _builtinSuites.builtin_Suite import * -class Standard_Suite_Events(builtin_Suite_Events): - - _argmap_class_info = { - 'in_' : 'wrcd', - } - - def class_info(self, _object=None, _attributes={}, **_arguments): - """class info: (optional) Get information about an object class - Required argument: the object class about which information is requested - Keyword argument in_: the human language and script system in which to return information - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: a record containing the object\xd5s properties and elements - """ - _code = 'core' - _subcode = 'qobj' - - aetools.keysubst(_arguments, self._argmap_class_info) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_close = { - 'saving' : 'savo', - 'saving_in' : 'kfil', - } - - def close(self, _object, _attributes={}, **_arguments): - """close: Close an object - Required argument: the object to close - Keyword argument saving: specifies whether changes should be saved before closing - Keyword argument saving_in: the file or alias in which to save the object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - aetools.keysubst(_arguments, self._argmap_close) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_count = { - 'each' : 'kocl', - } - - def count(self, _object, _attributes={}, **_arguments): - """count: Return the number of elements of an object - Required argument: the object whose elements are to be counted - Keyword argument each: if specified, restricts counting to objects of this class - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of elements - """ - _code = 'core' - _subcode = 'cnte' - - aetools.keysubst(_arguments, self._argmap_count) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_data_size = { - 'as' : 'rtyp', - } - - def data_size(self, _object, _attributes={}, **_arguments): - """data size: (optional) Return the size in bytes of an object - Required argument: the object whose data size is to be returned - Keyword argument as: the data type for which the size is calculated - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the size of the object in bytes - """ - _code = 'core' - _subcode = 'dsiz' - - aetools.keysubst(_arguments, self._argmap_data_size) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def delete(self, _object, _attributes={}, **_arguments): - """delete: Delete an object from its container. Note this does not work on script variables, only on elements of application classes. - Required argument: the element to delete - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'delo' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_duplicate = { - 'to' : 'insh', - 'with_properties' : 'prdt', - } - - def duplicate(self, _object, _attributes={}, **_arguments): - """duplicate: Duplicate one or more objects - Required argument: the object(s) to duplicate - Keyword argument to: the new location for the object(s) - Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the duplicated object(s) - """ - _code = 'core' - _subcode = 'clon' - - aetools.keysubst(_arguments, self._argmap_duplicate) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_event_info = { - 'in_' : 'wrcd', - } - - def event_info(self, _object, _attributes={}, **_arguments): - """event info: (optional) Get information about the Apple events in a suite - Required argument: the event class of the Apple events for which to return information - Keyword argument in_: the human language and script system in which to return information - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: a record containing the events and their parameters - """ - _code = 'core' - _subcode = 'gtei' - - aetools.keysubst(_arguments, self._argmap_event_info) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def exists(self, _object, _attributes={}, **_arguments): - """exists: Verify if an object exists - Required argument: the object in question - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: true if it exists, false if not - """ - _code = 'core' - _subcode = 'doex' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def handleBreakpoint(self, _object, _attributes={}, **_arguments): - """handleBreakpoint: return true to stop at a breakpoint - Required argument: the call frame of the breakpoint - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: true to stop, false if not - """ - _code = 'core' - _subcode = 'brak' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_make = { - 'new' : 'kocl', - 'at' : 'insh', - 'with_data' : 'data', - 'with_properties' : 'prdt', - } - - def make(self, _no_object=None, _attributes={}, **_arguments): - """make: Make a new element - Keyword argument new: the class of the new element - Keyword argument at: the location at which to insert the element - Keyword argument with_data: the initial data for the element - Keyword argument with_properties: the initial values for the properties of the element - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the new object(s) - """ - _code = 'core' - _subcode = 'crel' - - aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_move = { - 'to' : 'insh', - } - - def move(self, _object, _attributes={}, **_arguments): - """move: Move object(s) to a new location - Required argument: the object(s) to move - Keyword argument to: the new location for the object(s) - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: to the object(s) after they have been moved - """ - _code = 'core' - _subcode = 'move' - - aetools.keysubst(_arguments, self._argmap_move) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def print_(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_quit = { - 'saving' : 'savo', - } - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit an application - Keyword argument saving: specifies whether to save currently open documents - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - aetools.keysubst(_arguments, self._argmap_quit) - if _no_object != None: raise TypeError, 'No direct arg expected' - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def reopen(self, _no_object=None, _attributes={}, **_arguments): - """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'rapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run(self, _no_object=None, _attributes={}, **_arguments): - """run: Run an application. Most applications will open an empty, untitled window. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'oapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_save = { - 'in_' : 'kfil', - 'as' : 'fltp', - } - - def save(self, _object, _attributes={}, **_arguments): - """save: Save an object - Required argument: the object to save, usually a document or window - Keyword argument in_: the file or alias in which to save the object - Keyword argument as: the file type of the document in which to save the data - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'save' - - aetools.keysubst(_arguments, self._argmap_save) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def select(self, _object, _attributes={}, **_arguments): - """select: Make a selection - Required argument: the object to select - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'slct' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_suite_info = { - 'in_' : 'wrcd', - } - - def suite_info(self, _object, _attributes={}, **_arguments): - """suite info: (optional) Get information about event suite(s) - Required argument: the suite for which to return information - Keyword argument in_: the human language and script system in which to return information - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: a record containing the suites and their versions - """ - _code = 'core' - _subcode = 'gtsi' - - aetools.keysubst(_arguments, self._argmap_suite_info) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class alias(aetools.ComponentItem): - """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ - want = 'alis' -class _Prop_POSIX_path(aetools.NProperty): - """POSIX path - the POSIX path of the file """ - which = 'psxp' - want = 'TEXT' - -aliases = alias - -class application(aetools.ComponentItem): - """application - An application program """ - want = 'capp' -class _Prop_clipboard(aetools.NProperty): - """clipboard - the contents of the clipboard for this application """ - which = 'pcli' - want = '****' -clipboard = _Prop_clipboard() -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is this the frontmost application? """ - which = 'pisf' - want = 'bool' -frontmost = _Prop_frontmost() -class _Prop_name(aetools.NProperty): - """name - the name of the application """ - which = 'pnam' - want = 'itxt' -name = _Prop_name() -class _Prop_selection(aetools.NProperty): - """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ - which = 'sele' - want = 'csel' -selection = _Prop_selection() -class _Prop_version(aetools.NProperty): - """version - the version of the application """ - which = 'vers' - want = 'vers' -version = _Prop_version() - -applications = application - -class insertion_points(aetools.ComponentItem): - """insertion points - """ - want = 'cins' - -insertion_point = insertion_points - -class selection_2d_object(aetools.ComponentItem): - """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ - want = 'csel' -class _Prop_contents(aetools.NProperty): - """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ - which = 'pcnt' - want = '****' - -class window(aetools.ComponentItem): - """window - A window """ - want = 'cwin' -class _Prop_bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window """ - which = 'pbnd' - want = 'qdrt' -class _Prop_closeable(aetools.NProperty): - """closeable - Does the window have a close box? """ - which = 'hclb' - want = 'bool' -class _Prop_floating(aetools.NProperty): - """floating - Does the window float? """ - which = 'isfl' - want = 'bool' -class _Prop_index(aetools.NProperty): - """index - the number of the window """ - which = 'pidx' - want = 'long' -class _Prop_modal(aetools.NProperty): - """modal - Is the window modal? """ - which = 'pmod' - want = 'bool' -class _Prop_resizable(aetools.NProperty): - """resizable - Is the window resizable? """ - which = 'prsz' - want = 'bool' -class _Prop_titled(aetools.NProperty): - """titled - Does the window have a title bar? """ - which = 'ptit' - want = 'bool' -class _Prop_visible(aetools.NProperty): - """visible - Is the window visible? """ - which = 'pvis' - want = 'bool' -class _Prop_zoomable(aetools.NProperty): - """zoomable - Is the window zoomable? """ - which = 'iszm' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' - -windows = window - -class document(aetools.ComponentItem): - """document - A document of a scriptable application """ - want = 'docu' -class _Prop_modified(aetools.NProperty): - """modified - Has the document been modified since the last save? """ - which = 'imod' - want = 'bool' - -documents = document - -class file(aetools.ComponentItem): - """file - a file on a disk or server """ - want = 'file' - -files = file -alias._superclassnames = [] -alias._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, -} -alias._privelemdict = { -} -application._superclassnames = [] -application._privpropdict = { - 'clipboard' : _Prop_clipboard, - 'frontmost' : _Prop_frontmost, - 'name' : _Prop_name, - 'selection' : _Prop_selection, - 'version' : _Prop_version, -} -application._privelemdict = { -} -insertion_points._superclassnames = [] -insertion_points._privpropdict = { -} -insertion_points._privelemdict = { -} -selection_2d_object._superclassnames = [] -selection_2d_object._privpropdict = { - 'contents' : _Prop_contents, -} -selection_2d_object._privelemdict = { -} -window._superclassnames = [] -window._privpropdict = { - 'bounds' : _Prop_bounds, - 'closeable' : _Prop_closeable, - 'floating' : _Prop_floating, - 'index' : _Prop_index, - 'modal' : _Prop_modal, - 'resizable' : _Prop_resizable, - 'titled' : _Prop_titled, - 'visible' : _Prop_visible, - 'zoomable' : _Prop_zoomable, - 'zoomed' : _Prop_zoomed, -} -window._privelemdict = { -} -document._superclassnames = [] -document._privpropdict = { - 'modified' : _Prop_modified, -} -document._privelemdict = { -} -file._superclassnames = [] -file._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, -} -file._privelemdict = { -} -class _3c_(aetools.NComparison): - """< - Less than """ -class _3d_(aetools.NComparison): - """= - Equal """ -class _3e_(aetools.NComparison): - """> - Greater than """ -class contains(aetools.NComparison): - """contains - Contains """ -class ends_with(aetools.NComparison): - """ends with - Ends with """ -class starts_with(aetools.NComparison): - """starts with - Starts with """ -class _b2_(aetools.NComparison): - """\xb2 - Less than or equal to """ -class _b3_(aetools.NComparison): - """\xb3 - Greater than or equal to """ -_Enum_kfrm = { - 'index' : 'indx', # keyform designating indexed access - 'named' : 'name', # keyform designating named access - 'id' : 'ID ', # keyform designating access by unique identifier -} - -_Enum_savo = { - 'yes' : 'yes ', # Save objects now - 'no' : 'no ', # Do not save objects - 'ask' : 'ask ', # Ask the user whether to save -} - -_Enum_styl = { - 'plain' : 'plan', # Plain - 'bold' : 'bold', # Bold - 'italic' : 'ital', # Italic - 'outline' : 'outl', # Outline - 'shadow' : 'shad', # Shadow - 'underline' : 'undl', # Underline - 'superscript' : 'spsc', # Superscript - 'subscript' : 'sbsc', # Subscript - 'strikethrough' : 'strk', # Strikethrough - 'small_caps' : 'smcp', # Small caps - 'all_caps' : 'alcp', # All capital letters - 'all_lowercase' : 'lowc', # Lowercase - 'condensed' : 'cond', # Condensed - 'expanded' : 'pexp', # Expanded - 'hidden' : 'hidn', # Hidden -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_points, - 'csel' : selection_2d_object, - 'cwin' : window, - 'docu' : document, - 'file' : file, -} - -_propdeclarations = { - 'hclb' : _Prop_closeable, - 'imod' : _Prop_modified, - 'isfl' : _Prop_floating, - 'iszm' : _Prop_zoomable, - 'pbnd' : _Prop_bounds, - 'pcli' : _Prop_clipboard, - 'pcnt' : _Prop_contents, - 'pidx' : _Prop_index, - 'pisf' : _Prop_frontmost, - 'pmod' : _Prop_modal, - 'pnam' : _Prop_name, - 'prsz' : _Prop_resizable, - 'psxp' : _Prop_POSIX_path, - 'ptit' : _Prop_titled, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, - 'sele' : _Prop_selection, - 'vers' : _Prop_version, -} - -_compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, -} - -_enumdeclarations = { - 'kfrm' : _Enum_kfrm, - 'savo' : _Enum_savo, - 'styl' : _Enum_styl, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py deleted file mode 100644 index afa01a0e0..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py +++ /dev/null @@ -1,104 +0,0 @@ -"""Suite Table Suite: Classes for manipulating tables -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'tbls' - -class Table_Suite_Events: - - pass - - -class cell(aetools.ComponentItem): - """cell - A cell """ - want = 'ccel' -class _Prop_formula(aetools.NProperty): - """formula - the formula of the cell """ - which = 'pfor' - want = 'ctxt' -class _Prop_protection(aetools.NProperty): - """protection - Indicates whether value or formula in the cell can be changed """ - which = 'ppro' - want = 'prtn' - -cells = cell - -class column(aetools.ComponentItem): - """column - A column """ - want = 'ccol' -class _Prop_name(aetools.NProperty): - """name - the name of the column """ - which = 'pnam' - want = 'itxt' - -columns = column - -class rows(aetools.ComponentItem): - """rows - """ - want = 'crow' - -row = rows - -class tables(aetools.ComponentItem): - """tables - """ - want = 'ctbl' - -table = tables -cell._superclassnames = [] -cell._privpropdict = { - 'formula' : _Prop_formula, - 'protection' : _Prop_protection, -} -cell._privelemdict = { -} -column._superclassnames = [] -column._privpropdict = { - 'name' : _Prop_name, -} -column._privelemdict = { -} -rows._superclassnames = [] -rows._privpropdict = { -} -rows._privelemdict = { -} -tables._superclassnames = [] -tables._privpropdict = { -} -tables._privelemdict = { -} -_Enum_prtn = { - 'read_only' : 'nmod', # Can\xd5t change values or formulas - 'formulas_protected' : 'fpro', # Can changes values but not formulas - 'read_2f_write' : 'modf', # Can change values and formulas -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'ccel' : cell, - 'ccol' : column, - 'crow' : rows, - 'ctbl' : tables, -} - -_propdeclarations = { - 'pfor' : _Prop_formula, - 'pnam' : _Prop_name, - 'ppro' : _Prop_protection, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'prtn' : _Enum_prtn, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py deleted file mode 100644 index 1845f4d43..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Suite Text Suite: A set of basic classes for text processing -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'TEXT' - -class Text_Suite_Events: - - pass - - -class text_flow(aetools.ComponentItem): - """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ - want = 'cflo' -class _Prop__3c_inheritance_3e_(aetools.NProperty): - """<inheritance> - inherits some of its properties from this class """ - which = 'c@#^' - want = 'ctxt' -class _Prop_name(aetools.NProperty): - """name - the name """ - which = 'pnam' - want = 'itxt' - -text_flows = text_flow - -class character(aetools.ComponentItem): - """character - A character """ - want = 'cha ' - -class line(aetools.ComponentItem): - """line - A line of text """ - want = 'clin' -class _Prop_justification(aetools.NProperty): - """justification - the justification of the text """ - which = 'pjst' - want = 'just' - -lines = line - -class paragraph(aetools.ComponentItem): - """paragraph - A paragraph """ - want = 'cpar' - -paragraphs = paragraph - -class text(aetools.ComponentItem): - """text - Text """ - want = 'ctxt' -class _Prop_color(aetools.NProperty): - """color - the color of the first character """ - which = 'colr' - want = 'cRGB' -class _Prop_font(aetools.NProperty): - """font - the name of the font of the first character """ - which = 'font' - want = 'ctxt' -class _Prop_quoted_form(aetools.NProperty): - """quoted form - the text in quoted form """ - which = 'strq' - want = 'ctxt' -class _Prop_size(aetools.NProperty): - """size - the size in points of the first character """ - which = 'ptsz' - want = 'fixd' -class _Prop_style(aetools.NProperty): - """style - the text style of the first character of the first character """ - which = 'txst' - want = 'tsty' -class _Prop_uniform_styles(aetools.NProperty): - """uniform styles - the text styles that are uniform throughout the text """ - which = 'ustl' - want = 'tsty' -class _Prop_writing_code(aetools.NProperty): - """writing code - the script system and language """ - which = 'psct' - want = 'intl' -# element 'cha ' as ['indx'] -# element 'clin' as ['indx'] -# element 'cpar' as ['indx'] -# element 'ctxt' as ['indx'] -# element 'cwor' as ['indx'] - -class word(aetools.ComponentItem): - """word - A word """ - want = 'cwor' - -words = word - -class text_style_info(aetools.ComponentItem): - """text style info - On and Off styles of text run """ - want = 'tsty' -class _Prop_off_styles(aetools.NProperty): - """off styles - the styles that are off for the text """ - which = 'ofst' - want = 'styl' -class _Prop_on_styles(aetools.NProperty): - """on styles - the styles that are on for the text """ - which = 'onst' - want = 'styl' - -text_style_infos = text_style_info -text_flow._superclassnames = ['text'] -text_flow._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, - 'name' : _Prop_name, -} -text_flow._privelemdict = { -} -character._superclassnames = ['text'] -character._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -character._privelemdict = { -} -line._superclassnames = ['text'] -line._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, - 'justification' : _Prop_justification, -} -line._privelemdict = { -} -paragraph._superclassnames = ['text'] -paragraph._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -paragraph._privelemdict = { -} -text._superclassnames = [] -text._privpropdict = { - 'color' : _Prop_color, - 'font' : _Prop_font, - 'quoted_form' : _Prop_quoted_form, - 'size' : _Prop_size, - 'style' : _Prop_style, - 'uniform_styles' : _Prop_uniform_styles, - 'writing_code' : _Prop_writing_code, -} -text._privelemdict = { - 'character' : character, - 'line' : line, - 'paragraph' : paragraph, - 'text' : text, - 'word' : word, -} -word._superclassnames = ['text'] -word._privpropdict = { - '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, -} -word._privelemdict = { -} -text_style_info._superclassnames = [] -text_style_info._privpropdict = { - 'off_styles' : _Prop_off_styles, - 'on_styles' : _Prop_on_styles, -} -text_style_info._privelemdict = { -} -_Enum_just = { - 'left' : 'left', # Align with left margin - 'right' : 'rght', # Align with right margin - 'center' : 'cent', # Align with center - 'full' : 'full', # Align with both left and right margins -} - -_Enum_styl = { - 'plain' : 'plan', # Plain - 'bold' : 'bold', # Bold - 'italic' : 'ital', # Italic - 'outline' : 'outl', # Outline - 'shadow' : 'shad', # Shadow - 'underline' : 'undl', # Underline - 'superscript' : 'spsc', # Superscript - 'subscript' : 'sbsc', # Subscript - 'strikethrough' : 'strk', # Strikethrough - 'small_caps' : 'smcp', # Small caps - 'all_caps' : 'alcp', # All capital letters - 'all_lowercase' : 'lowc', # Lowercase - 'condensed' : 'cond', # Condensed - 'expanded' : 'pexp', # Expanded - 'hidden' : 'hidn', # Hidden -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cflo' : text_flow, - 'cha ' : character, - 'clin' : line, - 'cpar' : paragraph, - 'ctxt' : text, - 'cwor' : word, - 'tsty' : text_style_info, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_inheritance_3e_, - 'colr' : _Prop_color, - 'font' : _Prop_font, - 'ofst' : _Prop_off_styles, - 'onst' : _Prop_on_styles, - 'pjst' : _Prop_justification, - 'pnam' : _Prop_name, - 'psct' : _Prop_writing_code, - 'ptsz' : _Prop_size, - 'strq' : _Prop_quoted_form, - 'txst' : _Prop_style, - 'ustl' : _Prop_uniform_styles, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'just' : _Enum_just, - 'styl' : _Enum_styl, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py deleted file mode 100644 index cd9fa1987..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py +++ /dev/null @@ -1,435 +0,0 @@ -"""Suite Type Names Suite: Terminology for Registry data types -Level 1, version 1 - -Generated from /Volumes/Sap/System Folder/Extensions/AppleScript -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'tpnm' - -class Type_Names_Suite_Events: - - pass - - -class PostScript_picture(aetools.ComponentItem): - """PostScript picture - """ - want = 'EPS ' - -class point(aetools.ComponentItem): - """point - point coordinates """ - want = 'QDpt' - -class string(aetools.ComponentItem): - """string - a string of characters """ - want = 'TEXT' - -plain_text = string - -plain_text = string - -class TIFF_picture(aetools.ComponentItem): - """TIFF picture - """ - want = 'TIFF' - -class application_dictionary(aetools.ComponentItem): - """application dictionary - """ - want = 'aete' - -class system_dictionary(aetools.ComponentItem): - """system dictionary - """ - want = 'aeut' - -class color_table(aetools.ComponentItem): - """color table - """ - want = 'clrt' - -class menu_item(aetools.ComponentItem): - """menu item - """ - want = 'cmen' - -class menu(aetools.ComponentItem): - """menu - """ - want = 'cmnu' - -class double_integer(aetools.ComponentItem): - """double integer - """ - want = 'comp' - -class type_element_info(aetools.ComponentItem): - """type element info - """ - want = 'elin' - -class type_event_info(aetools.ComponentItem): - """type event info - information about an event """ - want = 'evin' - -class extended_real(aetools.ComponentItem): - """extended real - """ - want = 'exte' - -class fixed(aetools.ComponentItem): - """fixed - a real number """ - want = 'fixd' - -class fixed_point(aetools.ComponentItem): - """fixed point - """ - want = 'fpnt' - -class fixed_rectangle(aetools.ComponentItem): - """fixed rectangle - """ - want = 'frct' - -class type_class_info(aetools.ComponentItem): - """type class info - information about properties and elements of a class """ - want = 'gcli' - -class location_reference(aetools.ComponentItem): - """location reference - """ - want = 'insl' - -class long_fixed_point(aetools.ComponentItem): - """long fixed point - """ - want = 'lfpt' - -class long_fixed_rectangle(aetools.ComponentItem): - """long fixed rectangle - """ - want = 'lfrc' - -class long_fixed(aetools.ComponentItem): - """long fixed - """ - want = 'lfxd' - -class long_point(aetools.ComponentItem): - """long point - """ - want = 'lpnt' - -class long_rectangle(aetools.ComponentItem): - """long rectangle - """ - want = 'lrct' - -class machine_location(aetools.ComponentItem): - """machine location - """ - want = 'mLoc' - -class unsigned_integer(aetools.ComponentItem): - """unsigned integer - """ - want = 'magn' - -class null(aetools.ComponentItem): - """null - """ - want = 'null' - -class type_property_info(aetools.ComponentItem): - """type property info - """ - want = 'pinf' - -class type_parameter_info(aetools.ComponentItem): - """type parameter info - """ - want = 'pmin' - -class bounding_rectangle(aetools.ComponentItem): - """bounding rectangle - bounding rectangle """ - want = 'qdrt' - -class small_integer(aetools.ComponentItem): - """small integer - """ - want = 'shor' - -class small_real(aetools.ComponentItem): - """small real - """ - want = 'sing' - -class scrap_styles(aetools.ComponentItem): - """scrap styles - """ - want = 'styl' - -class type_suite_info(aetools.ComponentItem): - """type suite info - """ - want = 'suin' - -class target_id(aetools.ComponentItem): - """target id - """ - want = 'targ' - -class dash_style(aetools.ComponentItem): - """dash style - """ - want = 'tdas' - -class pixel_map_record(aetools.ComponentItem): - """pixel map record - """ - want = 'tpmm' - -class RGB16_color(aetools.ComponentItem): - """RGB16 color - """ - want = 'tr16' - -class RGB96_color(aetools.ComponentItem): - """RGB96 color - """ - want = 'tr96' - -class rotation(aetools.ComponentItem): - """rotation - """ - want = 'trot' - -class version(aetools.ComponentItem): - """version - """ - want = 'vers' -PostScript_picture._superclassnames = [] -PostScript_picture._privpropdict = { -} -PostScript_picture._privelemdict = { -} -point._superclassnames = [] -point._privpropdict = { -} -point._privelemdict = { -} -string._superclassnames = [] -string._privpropdict = { -} -string._privelemdict = { -} -TIFF_picture._superclassnames = [] -TIFF_picture._privpropdict = { -} -TIFF_picture._privelemdict = { -} -application_dictionary._superclassnames = [] -application_dictionary._privpropdict = { -} -application_dictionary._privelemdict = { -} -system_dictionary._superclassnames = [] -system_dictionary._privpropdict = { -} -system_dictionary._privelemdict = { -} -color_table._superclassnames = [] -color_table._privpropdict = { -} -color_table._privelemdict = { -} -menu_item._superclassnames = [] -menu_item._privpropdict = { -} -menu_item._privelemdict = { -} -menu._superclassnames = [] -menu._privpropdict = { -} -menu._privelemdict = { -} -double_integer._superclassnames = [] -double_integer._privpropdict = { -} -double_integer._privelemdict = { -} -type_element_info._superclassnames = [] -type_element_info._privpropdict = { -} -type_element_info._privelemdict = { -} -type_event_info._superclassnames = [] -type_event_info._privpropdict = { -} -type_event_info._privelemdict = { -} -extended_real._superclassnames = [] -extended_real._privpropdict = { -} -extended_real._privelemdict = { -} -fixed._superclassnames = [] -fixed._privpropdict = { -} -fixed._privelemdict = { -} -fixed_point._superclassnames = [] -fixed_point._privpropdict = { -} -fixed_point._privelemdict = { -} -fixed_rectangle._superclassnames = [] -fixed_rectangle._privpropdict = { -} -fixed_rectangle._privelemdict = { -} -type_class_info._superclassnames = [] -type_class_info._privpropdict = { -} -type_class_info._privelemdict = { -} -location_reference._superclassnames = [] -location_reference._privpropdict = { -} -location_reference._privelemdict = { -} -long_fixed_point._superclassnames = [] -long_fixed_point._privpropdict = { -} -long_fixed_point._privelemdict = { -} -long_fixed_rectangle._superclassnames = [] -long_fixed_rectangle._privpropdict = { -} -long_fixed_rectangle._privelemdict = { -} -long_fixed._superclassnames = [] -long_fixed._privpropdict = { -} -long_fixed._privelemdict = { -} -long_point._superclassnames = [] -long_point._privpropdict = { -} -long_point._privelemdict = { -} -long_rectangle._superclassnames = [] -long_rectangle._privpropdict = { -} -long_rectangle._privelemdict = { -} -machine_location._superclassnames = [] -machine_location._privpropdict = { -} -machine_location._privelemdict = { -} -unsigned_integer._superclassnames = [] -unsigned_integer._privpropdict = { -} -unsigned_integer._privelemdict = { -} -null._superclassnames = [] -null._privpropdict = { -} -null._privelemdict = { -} -type_property_info._superclassnames = [] -type_property_info._privpropdict = { -} -type_property_info._privelemdict = { -} -type_parameter_info._superclassnames = [] -type_parameter_info._privpropdict = { -} -type_parameter_info._privelemdict = { -} -bounding_rectangle._superclassnames = [] -bounding_rectangle._privpropdict = { -} -bounding_rectangle._privelemdict = { -} -small_integer._superclassnames = [] -small_integer._privpropdict = { -} -small_integer._privelemdict = { -} -small_real._superclassnames = [] -small_real._privpropdict = { -} -small_real._privelemdict = { -} -scrap_styles._superclassnames = [] -scrap_styles._privpropdict = { -} -scrap_styles._privelemdict = { -} -type_suite_info._superclassnames = [] -type_suite_info._privpropdict = { -} -type_suite_info._privelemdict = { -} -target_id._superclassnames = [] -target_id._privpropdict = { -} -target_id._privelemdict = { -} -dash_style._superclassnames = [] -dash_style._privpropdict = { -} -dash_style._privelemdict = { -} -pixel_map_record._superclassnames = [] -pixel_map_record._privpropdict = { -} -pixel_map_record._privelemdict = { -} -RGB16_color._superclassnames = [] -RGB16_color._privpropdict = { -} -RGB16_color._privelemdict = { -} -RGB96_color._superclassnames = [] -RGB96_color._privpropdict = { -} -RGB96_color._privelemdict = { -} -rotation._superclassnames = [] -rotation._privpropdict = { -} -rotation._privelemdict = { -} -version._superclassnames = [] -version._privpropdict = { -} -version._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'EPS ' : PostScript_picture, - 'QDpt' : point, - 'TEXT' : string, - 'TIFF' : TIFF_picture, - 'aete' : application_dictionary, - 'aeut' : system_dictionary, - 'clrt' : color_table, - 'cmen' : menu_item, - 'cmnu' : menu, - 'comp' : double_integer, - 'elin' : type_element_info, - 'evin' : type_event_info, - 'exte' : extended_real, - 'fixd' : fixed, - 'fpnt' : fixed_point, - 'frct' : fixed_rectangle, - 'gcli' : type_class_info, - 'insl' : location_reference, - 'lfpt' : long_fixed_point, - 'lfrc' : long_fixed_rectangle, - 'lfxd' : long_fixed, - 'lpnt' : long_point, - 'lrct' : long_rectangle, - 'mLoc' : machine_location, - 'magn' : unsigned_integer, - 'null' : null, - 'pinf' : type_property_info, - 'pmin' : type_parameter_info, - 'qdrt' : bounding_rectangle, - 'shor' : small_integer, - 'sing' : small_real, - 'styl' : scrap_styles, - 'suin' : type_suite_info, - 'targ' : target_id, - 'tdas' : dash_style, - 'tpmm' : pixel_map_record, - 'tr16' : RGB16_color, - 'tr96' : RGB96_color, - 'trot' : rotation, - 'vers' : version, -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/__init__.py deleted file mode 100644 index b80e3bacc..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/StdSuites/__init__.py +++ /dev/null @@ -1,471 +0,0 @@ -""" -Package generated from /Volumes/Sap/System Folder/Extensions/AppleScript -Resource aeut resid 0 Standard Event Suites for English -""" -import aetools -Error = aetools.Error -import Text_Suite -import AppleScript_Suite -import Standard_Suite -import Macintosh_Connectivity_Clas -import QuickDraw_Graphics_Suite -import QuickDraw_Graphics_Suppleme -import Required_Suite -import Table_Suite -import Type_Names_Suite - - -_code_to_module = { - 'TEXT' : Text_Suite, - 'ascr' : AppleScript_Suite, - 'core' : Standard_Suite, - 'macc' : Macintosh_Connectivity_Clas, - 'qdrw' : QuickDraw_Graphics_Suite, - 'qdsp' : QuickDraw_Graphics_Suppleme, - 'reqd' : Required_Suite, - 'tbls' : Table_Suite, - 'tpnm' : Type_Names_Suite, -} - - - -_code_to_fullname = { - 'TEXT' : ('StdSuites.Text_Suite', 'Text_Suite'), - 'ascr' : ('StdSuites.AppleScript_Suite', 'AppleScript_Suite'), - 'core' : ('StdSuites.Standard_Suite', 'Standard_Suite'), - 'macc' : ('StdSuites.Macintosh_Connectivity_Clas', 'Macintosh_Connectivity_Clas'), - 'qdrw' : ('StdSuites.QuickDraw_Graphics_Suite', 'QuickDraw_Graphics_Suite'), - 'qdsp' : ('StdSuites.QuickDraw_Graphics_Suppleme', 'QuickDraw_Graphics_Suppleme'), - 'reqd' : ('StdSuites.Required_Suite', 'Required_Suite'), - 'tbls' : ('StdSuites.Table_Suite', 'Table_Suite'), - 'tpnm' : ('StdSuites.Type_Names_Suite', 'Type_Names_Suite'), -} - -from Text_Suite import * -from AppleScript_Suite import * -from Standard_Suite import * -from Macintosh_Connectivity_Clas import * -from QuickDraw_Graphics_Suite import * -from QuickDraw_Graphics_Suppleme import * -from Required_Suite import * -from Table_Suite import * -from Type_Names_Suite import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(graphic_group) -getbaseclasses(oval) -getbaseclasses(graphic_text) -getbaseclasses(graphic_shape) -getbaseclasses(drawing_area) -getbaseclasses(graphic_line) -getbaseclasses(polygon) -getbaseclasses(pixel) -getbaseclasses(rounded_rectangle) -getbaseclasses(graphic_object) -getbaseclasses(arc) -getbaseclasses(pixel_map) -getbaseclasses(rectangle) -getbaseclasses(selection_2d_object) -getbaseclasses(application) -getbaseclasses(document) -getbaseclasses(window) -getbaseclasses(file) -getbaseclasses(alias) -getbaseclasses(insertion_point) -getbaseclasses(character) -getbaseclasses(paragraph) -getbaseclasses(word) -getbaseclasses(text_flow) -getbaseclasses(text_style_info) -getbaseclasses(line) -getbaseclasses(text) -getbaseclasses(AppleTalk_address) -getbaseclasses(address_specification) -getbaseclasses(Token_Ring_address) -getbaseclasses(FireWire_address) -getbaseclasses(bus_slot) -getbaseclasses(SCSI_address) -getbaseclasses(ADB_address) -getbaseclasses(USB_address) -getbaseclasses(device_specification) -getbaseclasses(LocalTalk_address) -getbaseclasses(IP_address) -getbaseclasses(Ethernet_address) -getbaseclasses(graphic_group) -getbaseclasses(drawing_area) -getbaseclasses(cell) -getbaseclasses(column) -getbaseclasses(table) -getbaseclasses(row) -getbaseclasses(small_integer) -getbaseclasses(system_dictionary) -getbaseclasses(color_table) -getbaseclasses(fixed_point) -getbaseclasses(plain_text) -getbaseclasses(type_element_info) -getbaseclasses(machine_location) -getbaseclasses(PostScript_picture) -getbaseclasses(type_suite_info) -getbaseclasses(menu_item) -getbaseclasses(pixel_map_record) -getbaseclasses(small_real) -getbaseclasses(null) -getbaseclasses(rotation) -getbaseclasses(fixed) -getbaseclasses(long_point) -getbaseclasses(target_id) -getbaseclasses(type_property_info) -getbaseclasses(type_parameter_info) -getbaseclasses(long_fixed_point) -getbaseclasses(bounding_rectangle) -getbaseclasses(TIFF_picture) -getbaseclasses(long_fixed) -getbaseclasses(location_reference) -getbaseclasses(version) -getbaseclasses(RGB16_color) -getbaseclasses(double_integer) -getbaseclasses(type_event_info) -getbaseclasses(point) -getbaseclasses(application_dictionary) -getbaseclasses(unsigned_integer) -getbaseclasses(menu) -getbaseclasses(fixed_rectangle) -getbaseclasses(long_fixed_rectangle) -getbaseclasses(type_class_info) -getbaseclasses(RGB96_color) -getbaseclasses(dash_style) -getbaseclasses(scrap_styles) -getbaseclasses(extended_real) -getbaseclasses(long_rectangle) -getbaseclasses(May) -getbaseclasses(string) -getbaseclasses(miles) -getbaseclasses(number_or_date) -getbaseclasses(October) -getbaseclasses(event) -getbaseclasses(Pascal_string) -getbaseclasses(zone) -getbaseclasses(picture) -getbaseclasses(list_or_string) -getbaseclasses(number) -getbaseclasses(Tuesday) -getbaseclasses(version) -getbaseclasses(December) -getbaseclasses(square_kilometres) -getbaseclasses(reference) -getbaseclasses(vector) -getbaseclasses(weekday) -getbaseclasses(Sunday) -getbaseclasses(international_text) -getbaseclasses(seconds) -getbaseclasses(RGB_color) -getbaseclasses(kilometres) -getbaseclasses(styled_Unicode_text) -getbaseclasses(missing_value) -getbaseclasses(metres) -getbaseclasses(number_or_string) -getbaseclasses(list) -getbaseclasses(linked_list) -getbaseclasses(real) -getbaseclasses(encoded_string) -getbaseclasses(list_or_record) -getbaseclasses(Monday) -getbaseclasses(September) -getbaseclasses(anything) -getbaseclasses(property) -getbaseclasses(reference_form) -getbaseclasses(item) -getbaseclasses(grams) -getbaseclasses(record) -getbaseclasses(empty_ae_name_) -getbaseclasses(constant) -getbaseclasses(square_miles) -getbaseclasses(data) -getbaseclasses(Unicode_text) -getbaseclasses(yards) -getbaseclasses(cubic_yards) -getbaseclasses(pounds) -getbaseclasses(cubic_centimetres) -getbaseclasses(text) -getbaseclasses(July) -getbaseclasses(cubic_metres) -getbaseclasses(styled_text) -getbaseclasses(number_2c__date_or_text) -getbaseclasses(feet) -getbaseclasses(February) -getbaseclasses(degrees_Celsius) -getbaseclasses(keystroke) -getbaseclasses(integer) -getbaseclasses(degrees_Fahrenheit) -getbaseclasses(list_2c__record_or_text) -getbaseclasses(date) -getbaseclasses(degrees_Kelvin) -getbaseclasses(centimetres) -getbaseclasses(writing_code) -getbaseclasses(alias_or_string) -getbaseclasses(writing_code_info) -getbaseclasses(text_item) -getbaseclasses(machine) -getbaseclasses(type_class) -getbaseclasses(preposition) -getbaseclasses(Wednesday) -getbaseclasses(upper_case) -getbaseclasses(March) -getbaseclasses(square_feet) -getbaseclasses(November) -getbaseclasses(quarts) -getbaseclasses(alias) -getbaseclasses(January) -getbaseclasses(month) -getbaseclasses(June) -getbaseclasses(August) -getbaseclasses(styled_Clipboard_text) -getbaseclasses(gallons) -getbaseclasses(cubic_inches) -getbaseclasses(Friday) -getbaseclasses(sound) -getbaseclasses(class_) -getbaseclasses(kilograms) -getbaseclasses(script) -getbaseclasses(litres) -getbaseclasses(boolean) -getbaseclasses(square_metres) -getbaseclasses(inches) -getbaseclasses(character) -getbaseclasses(April) -getbaseclasses(ounces) -getbaseclasses(app) -getbaseclasses(handler) -getbaseclasses(C_string) -getbaseclasses(Thursday) -getbaseclasses(square_yards) -getbaseclasses(cubic_feet) -getbaseclasses(Saturday) -getbaseclasses(file_specification) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'cpic' : graphic_group, - 'covl' : oval, - 'cgtx' : graphic_text, - 'cgsh' : graphic_shape, - 'cdrw' : drawing_area, - 'glin' : graphic_line, - 'cpgn' : polygon, - 'cpxl' : pixel, - 'crrc' : rounded_rectangle, - 'cgob' : graphic_object, - 'carc' : arc, - 'cpix' : pixel_map, - 'crec' : rectangle, - 'csel' : selection_2d_object, - 'capp' : application, - 'docu' : document, - 'cwin' : window, - 'file' : file, - 'alis' : alias, - 'cins' : insertion_point, - 'cha ' : character, - 'cpar' : paragraph, - 'cwor' : word, - 'cflo' : text_flow, - 'tsty' : text_style_info, - 'clin' : line, - 'ctxt' : text, - 'cat ' : AppleTalk_address, - 'cadr' : address_specification, - 'ctok' : Token_Ring_address, - 'cfw ' : FireWire_address, - 'cbus' : bus_slot, - 'cscs' : SCSI_address, - 'cadb' : ADB_address, - 'cusb' : USB_address, - 'cdev' : device_specification, - 'clt ' : LocalTalk_address, - 'cip ' : IP_address, - 'cen ' : Ethernet_address, - 'cpic' : graphic_group, - 'cdrw' : drawing_area, - 'ccel' : cell, - 'ccol' : column, - 'ctbl' : table, - 'crow' : row, - 'shor' : small_integer, - 'aeut' : system_dictionary, - 'clrt' : color_table, - 'fpnt' : fixed_point, - 'TEXT' : plain_text, - 'elin' : type_element_info, - 'mLoc' : machine_location, - 'EPS ' : PostScript_picture, - 'suin' : type_suite_info, - 'cmen' : menu_item, - 'tpmm' : pixel_map_record, - 'sing' : small_real, - 'null' : null, - 'trot' : rotation, - 'fixd' : fixed, - 'lpnt' : long_point, - 'targ' : target_id, - 'pinf' : type_property_info, - 'pmin' : type_parameter_info, - 'lfpt' : long_fixed_point, - 'qdrt' : bounding_rectangle, - 'TIFF' : TIFF_picture, - 'lfxd' : long_fixed, - 'insl' : location_reference, - 'vers' : version, - 'tr16' : RGB16_color, - 'comp' : double_integer, - 'evin' : type_event_info, - 'QDpt' : point, - 'aete' : application_dictionary, - 'magn' : unsigned_integer, - 'cmnu' : menu, - 'frct' : fixed_rectangle, - 'lfrc' : long_fixed_rectangle, - 'gcli' : type_class_info, - 'tr96' : RGB96_color, - 'tdas' : dash_style, - 'styl' : scrap_styles, - 'exte' : extended_real, - 'lrct' : long_rectangle, - 'may ' : May, - 'TEXT' : string, - 'mile' : miles, - 'nd ' : number_or_date, - 'oct ' : October, - 'evnt' : event, - 'pstr' : Pascal_string, - 'zone' : zone, - 'PICT' : picture, - 'ls ' : list_or_string, - 'nmbr' : number, - 'tue ' : Tuesday, - 'vers' : version, - 'dec ' : December, - 'sqkm' : square_kilometres, - 'obj ' : reference, - 'vect' : vector, - 'wkdy' : weekday, - 'sun ' : Sunday, - 'itxt' : international_text, - 'scnd' : seconds, - 'cRGB' : RGB_color, - 'kmtr' : kilometres, - 'sutx' : styled_Unicode_text, - 'msng' : missing_value, - 'metr' : metres, - 'ns ' : number_or_string, - 'list' : list, - 'llst' : linked_list, - 'doub' : real, - 'encs' : encoded_string, - 'lr ' : list_or_record, - 'mon ' : Monday, - 'sep ' : September, - '****' : anything, - 'prop' : property, - 'kfrm' : reference_form, - 'cobj' : item, - 'gram' : grams, - 'reco' : record, - 'undf' : empty_ae_name_, - 'enum' : constant, - 'sqmi' : square_miles, - 'rdat' : data, - 'utxt' : Unicode_text, - 'yard' : yards, - 'cyrd' : cubic_yards, - 'lbs ' : pounds, - 'ccmt' : cubic_centimetres, - 'ctxt' : text, - 'jul ' : July, - 'cmet' : cubic_metres, - 'STXT' : styled_text, - 'nds ' : number_2c__date_or_text, - 'feet' : feet, - 'feb ' : February, - 'degc' : degrees_Celsius, - 'kprs' : keystroke, - 'long' : integer, - 'degf' : degrees_Fahrenheit, - 'lrs ' : list_2c__record_or_text, - 'ldt ' : date, - 'degk' : degrees_Kelvin, - 'cmtr' : centimetres, - 'psct' : writing_code, - 'sf ' : alias_or_string, - 'citl' : writing_code_info, - 'citm' : text_item, - 'mach' : machine, - 'type' : type_class, - 'prep' : preposition, - 'wed ' : Wednesday, - 'case' : upper_case, - 'mar ' : March, - 'sqft' : square_feet, - 'nov ' : November, - 'qrts' : quarts, - 'alis' : alias, - 'jan ' : January, - 'mnth' : month, - 'jun ' : June, - 'aug ' : August, - 'styl' : styled_Clipboard_text, - 'galn' : gallons, - 'cuin' : cubic_inches, - 'fri ' : Friday, - 'snd ' : sound, - 'pcls' : class_, - 'kgrm' : kilograms, - 'scpt' : script, - 'litr' : litres, - 'bool' : boolean, - 'sqrm' : square_metres, - 'inch' : inches, - 'cha ' : character, - 'apr ' : April, - 'ozs ' : ounces, - 'capp' : app, - 'hand' : handler, - 'cstr' : C_string, - 'thu ' : Thursday, - 'sqyd' : square_yards, - 'cfet' : cubic_feet, - 'sat ' : Saturday, - 'fss ' : file_specification, -} - - -class StdSuites(Text_Suite_Events, - AppleScript_Suite_Events, - Standard_Suite_Events, - Macintosh_Connectivity_Clas_Events, - QuickDraw_Graphics_Suite_Events, - QuickDraw_Graphics_Suppleme_Events, - Required_Suite_Events, - Table_Suite_Events, - Type_Names_Suite_Events, - aetools.TalkTo): - _signature = 'ascr' - - _moduleName = 'StdSuites' diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py deleted file mode 100644 index a9ac3dd27..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py +++ /dev/null @@ -1,381 +0,0 @@ -"""Suite Disk-Folder-File Suite: Terms and Events for controlling Disks, Folders, and Files -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'cdis' - -class Disk_Folder_File_Suite_Events: - - _argmap_move = { - 'to' : 'insh', - } - - def move(self, _object, _attributes={}, **_arguments): - """move: Move disk item(s) to a new location. - Required argument: the object for the command - Keyword argument to: The new location for the disk item(s). - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'move' - - aetools.keysubst(_arguments, self._argmap_move) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The Disk-Folder-File Suite host program """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_folder_actions_enabled(aetools.NProperty): - """folder actions enabled - Are Folder Actions currently being processed? """ - which = 'faen' - want = 'bool' -folder_actions_enabled = _Prop_folder_actions_enabled() -class _Prop_properties(aetools.NProperty): - """properties - every property of the Disk-Folder-File Suite host program """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class disk(aetools.ComponentItem): - """disk - A disk in the file system """ - want = 'cdis' -class _Prop_POSIX_path(aetools.NProperty): - """POSIX path - the POSIX file system path of the disk """ - which = 'posx' - want = 'utxt' -class _Prop_capacity(aetools.NProperty): - """capacity - the total number of bytes (free or used) on the disk """ - which = 'capa' - want = 'magn' -class _Prop_ejectable(aetools.NProperty): - """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ - which = 'isej' - want = 'bool' -class _Prop_format(aetools.NProperty): - """format - the file system format of this disk """ - which = 'dfmt' - want = 'edfm' -class _Prop_free_space(aetools.NProperty): - """free space - the number of free bytes left on the disk """ - which = 'frsp' - want = 'magn' -class _Prop_ignore_privileges(aetools.NProperty): - """ignore privileges - Ignore permissions on this disk? """ - which = 'igpr' - want = 'bool' -class _Prop_local_volume(aetools.NProperty): - """local volume - Is the media a local volume (as opposed to a file server? """ - which = 'isrv' - want = 'bool' -class _Prop_name(aetools.NProperty): - """name - the name of the disk """ - which = 'pnam' - want = 'utxt' -class _Prop_path(aetools.NProperty): - """path - the file system path of the disk """ - which = 'ppth' - want = 'utxt' -class _Prop_startup(aetools.NProperty): - """startup - Is this disk the boot disk? """ - which = 'istd' - want = 'bool' -class _Prop_volume(aetools.NProperty): - """volume - the volume on which the folder resides """ - which = 'volu' - want = 'utxt' -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] - -disks = disk - -class folder(aetools.ComponentItem): - """folder - A folder in the file system """ - want = 'cfol' -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] - -folders = folder - -class item(aetools.ComponentItem): - """item - An item in the file system """ - want = 'cobj' -class _Prop_busy_status(aetools.NProperty): - """busy status - Is the item busy? """ - which = 'busy' - want = 'bool' -class _Prop_creation_date(aetools.NProperty): - """creation date - the date on which the item was created """ - which = 'ascd' - want = '****' -class _Prop_modification_date(aetools.NProperty): - """modification date - the date on which the item was last modified """ - which = 'asmo' - want = '****' -class _Prop_name_extension(aetools.NProperty): - """name extension - the extension portion of the name """ - which = 'extn' - want = 'utxt' -class _Prop_package_folder(aetools.NProperty): - """package folder - Is the item a package? """ - which = 'pkgf' - want = 'bool' -class _Prop_url(aetools.NProperty): - """url - the url of the item """ - which = 'url ' - want = 'utxt' -class _Prop_visible(aetools.NProperty): - """visible - Is the item visible? """ - which = 'visi' - want = 'bool' -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] - -items = item - -class file(aetools.ComponentItem): - """file - A file in the file system """ - want = 'file' -class _Prop_creator_type(aetools.NProperty): - """creator type - the OSType identifying the application that created the item """ - which = 'fcrt' - want = 'utxt' -class _Prop_file_type(aetools.NProperty): - """file type - the OSType identifying the type of data contained in the item """ - which = 'asty' - want = 'utxt' -class _Prop_physical_size(aetools.NProperty): - """physical size - the actual space used by the file on disk """ - which = 'phys' - want = 'magn' -class _Prop_product_version(aetools.NProperty): - """product version - the version of the product (visible at the top of the ?et Info?window) """ - which = 'ver2' - want = 'utxt' -class _Prop_size(aetools.NProperty): - """size - the logical size of the file """ - which = 'ptsz' - want = 'magn' -class _Prop_stationery(aetools.NProperty): - """stationery - Is the file a stationery pad? """ - which = 'pspd' - want = 'bool' -class _Prop_version(aetools.NProperty): - """version - the version of the file (visible at the bottom of the ?et Info?window) """ - which = 'vers' - want = 'utxt' -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] - -files = file -application._superclassnames = [] -import Standard_Suite -import Folder_Actions_Suite -import Login_Items_Suite -import Processes_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'folder_actions_enabled' : _Prop_folder_actions_enabled, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'application_process' : Processes_Suite.application_process, - 'desk_accessory_process' : Processes_Suite.desk_accessory_process, - 'disk' : disk, - 'document' : Standard_Suite.document, - 'file' : file, - 'folder' : folder, - 'folder_action' : Folder_Actions_Suite.folder_action, - 'item' : item, - 'login_item' : Login_Items_Suite.login_item, - 'process' : Processes_Suite.process, - 'window' : Standard_Suite.window, -} -disk._superclassnames = ['item'] -disk._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'capacity' : _Prop_capacity, - 'ejectable' : _Prop_ejectable, - 'format' : _Prop_format, - 'free_space' : _Prop_free_space, - 'ignore_privileges' : _Prop_ignore_privileges, - 'local_volume' : _Prop_local_volume, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'properties' : _Prop_properties, - 'startup' : _Prop_startup, - 'volume' : _Prop_volume, -} -disk._privelemdict = { - 'file' : file, - 'folder' : folder, - 'item' : item, -} -folder._superclassnames = ['item'] -folder._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'properties' : _Prop_properties, - 'volume' : _Prop_volume, -} -folder._privelemdict = { - 'file' : file, - 'file' : file, - 'folder' : folder, - 'folder' : folder, - 'item' : item, - 'item' : item, -} -item._superclassnames = [] -item._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'busy_status' : _Prop_busy_status, - 'creation_date' : _Prop_creation_date, - 'modification_date' : _Prop_modification_date, - 'name' : _Prop_name, - 'name_extension' : _Prop_name_extension, - 'package_folder' : _Prop_package_folder, - 'path' : _Prop_path, - 'properties' : _Prop_properties, - 'url' : _Prop_url, - 'visible' : _Prop_visible, - 'volume' : _Prop_volume, -} -item._privelemdict = { - 'file' : file, - 'folder' : folder, - 'item' : item, -} -file._superclassnames = ['item'] -file._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'creator_type' : _Prop_creator_type, - 'file_type' : _Prop_file_type, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'physical_size' : _Prop_physical_size, - 'product_version' : _Prop_product_version, - 'properties' : _Prop_properties, - 'size' : _Prop_size, - 'stationery' : _Prop_stationery, - 'version' : _Prop_version, - 'volume' : _Prop_volume, -} -file._privelemdict = { - 'file' : file, - 'folder' : folder, - 'item' : item, -} -_Enum_edfm = { - 'MS_2d_DOS_format' : 'dfms', # MS-DOS format - 'Apple_Photo_format' : 'dfph', # Apple Photo format - 'ISO_9660_format' : 'df96', # ISO 9660 format - 'QuickTake_format' : 'dfqt', # QuickTake format - 'AppleShare_format' : 'dfas', # AppleShare format - 'High_Sierra_format' : 'dfhs', # High Sierra format - 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format - 'UDF_format' : 'dfud', # UDF format - 'unknown_format' : 'df??', # unknown format - 'audio_format' : 'dfau', # audio format - 'Mac_OS_format' : 'dfhf', # Mac OS format - 'UFS_format' : 'dfuf', # UFS format - 'NFS_format' : 'dfnf', # NFS format - 'ProDOS_format' : 'dfpr', # ProDOS format - 'WebDAV_format' : 'dfwd', # WebDAV format -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cdis' : disk, - 'cfol' : folder, - 'cobj' : item, - 'file' : file, -} - -_propdeclarations = { - 'ascd' : _Prop_creation_date, - 'asmo' : _Prop_modification_date, - 'asty' : _Prop_file_type, - 'busy' : _Prop_busy_status, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'capa' : _Prop_capacity, - 'dfmt' : _Prop_format, - 'extn' : _Prop_name_extension, - 'faen' : _Prop_folder_actions_enabled, - 'fcrt' : _Prop_creator_type, - 'frsp' : _Prop_free_space, - 'igpr' : _Prop_ignore_privileges, - 'isej' : _Prop_ejectable, - 'isrv' : _Prop_local_volume, - 'istd' : _Prop_startup, - 'pALL' : _Prop_properties, - 'phys' : _Prop_physical_size, - 'pkgf' : _Prop_package_folder, - 'pnam' : _Prop_name, - 'posx' : _Prop_POSIX_path, - 'ppth' : _Prop_path, - 'pspd' : _Prop_stationery, - 'ptsz' : _Prop_size, - 'url ' : _Prop_url, - 'ver2' : _Prop_product_version, - 'vers' : _Prop_version, - 'visi' : _Prop_visible, - 'volu' : _Prop_volume, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'edfm' : _Enum_edfm, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py deleted file mode 100644 index c2c7e5e03..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py +++ /dev/null @@ -1,287 +0,0 @@ -"""Suite Folder Actions Suite: Terms and Events for controlling Folder Actions -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'faco' - -class Folder_Actions_Suite_Events: - - _argmap_attach_action_to = { - 'using' : 'faal', - } - - def attach_action_to(self, _object, _attributes={}, **_arguments): - """attach action to: Attach an action to a folder - Required argument: the object for the command - Keyword argument using: a file containing the script to attach - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'faco' - _subcode = 'atfa' - - aetools.keysubst(_arguments, self._argmap_attach_action_to) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def attached_scripts(self, _object, _attributes={}, **_arguments): - """attached scripts: List the actions attached to a folder - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'faco' - _subcode = 'lact' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_do_folder_action = { - 'with_window_size' : 'fnsz', - 'with_item_list' : 'flst', - 'folder_action_code' : 'actn', - } - - def do_folder_action(self, _object, _attributes={}, **_arguments): - """do folder action: Event the Finder sends to the Folder Actions FBA - Required argument: the object for the command - Keyword argument with_window_size: the new window size for the folder action message to process - Keyword argument with_item_list: a list of items for the folder action message to process - Keyword argument folder_action_code: the folder action message to process - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'faco' - _subcode = 'fola' - - aetools.keysubst(_arguments, self._argmap_do_folder_action) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'actn', _Enum_actn) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_edit_action_of = { - 'using_action_name' : 'snam', - 'using_action_number' : 'indx', - } - - def edit_action_of(self, _object, _attributes={}, **_arguments): - """edit action of: Edit as action of a folder - Required argument: the object for the command - Keyword argument using_action_name: ...or the name of the action to edit - Keyword argument using_action_number: the index number of the action to edit... - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'faco' - _subcode = 'edfa' - - aetools.keysubst(_arguments, self._argmap_edit_action_of) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_remove_action_from = { - 'using_action_name' : 'snam', - 'using_action_number' : 'indx', - } - - def remove_action_from(self, _object, _attributes={}, **_arguments): - """remove action from: Remove a folder action from a folder - Required argument: the object for the command - Keyword argument using_action_name: ...or the name of the action to remove - Keyword argument using_action_number: the index number of the action to remove... - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'faco' - _subcode = 'rmfa' - - aetools.keysubst(_arguments, self._argmap_remove_action_from) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The Folder Actions Suite host program """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_folder_actions_enabled(aetools.NProperty): - """folder actions enabled - Are Folder Actions currently being processed? """ - which = 'faen' - want = 'bool' -folder_actions_enabled = _Prop_folder_actions_enabled() -class _Prop_properties(aetools.NProperty): - """properties - every property of the Folder Actions Suite host program """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class folder_action(aetools.ComponentItem): - """folder action - An action attached to a folder in the file system """ - want = 'foac' -class _Prop_name(aetools.NProperty): - """name - the name of the folder action, which is also the name of the folder """ - which = 'pnam' - want = 'utxt' -class _Prop_path(aetools.NProperty): - """path - the path to the folder to which the folder action applies """ - which = 'ppth' - want = '****' -class _Prop_volume(aetools.NProperty): - """volume - the volume on which the folder action resides """ - which = 'volu' - want = 'utxt' -# element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test'] - -folder_actions = folder_action - -class script(aetools.ComponentItem): - """script - A script invoked by a folder action """ - want = 'scpt' -class _Prop_POSIX_path(aetools.NProperty): - """POSIX path - the POSIX file system path of the disk """ - which = 'posx' - want = 'utxt' - -scripts = script -application._superclassnames = [] -import Disk_Folder_File_Suite -import Standard_Suite -import Login_Items_Suite -import Processes_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'folder_actions_enabled' : _Prop_folder_actions_enabled, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'application_process' : Processes_Suite.application_process, - 'desk_accessory_process' : Processes_Suite.desk_accessory_process, - 'disk' : Disk_Folder_File_Suite.disk, - 'document' : Standard_Suite.document, - 'file' : Disk_Folder_File_Suite.file, - 'folder' : Disk_Folder_File_Suite.folder, - 'folder_action' : folder_action, - 'item' : Disk_Folder_File_Suite.item, - 'login_item' : Login_Items_Suite.login_item, - 'process' : Processes_Suite.process, - 'window' : Standard_Suite.window, -} -folder_action._superclassnames = ['item'] -folder_action._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'properties' : _Prop_properties, - 'volume' : _Prop_volume, -} -folder_action._privelemdict = { - 'script' : script, -} -script._superclassnames = ['item'] -script._privpropdict = { - 'POSIX_path' : _Prop_POSIX_path, - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'name' : _Prop_name, - 'path' : _Prop_path, - 'properties' : _Prop_properties, -} -script._privelemdict = { -} -_Enum_actn = { - 'items_added' : 'fget', # items added - 'items_removed' : 'flos', # items removed - 'window_closed' : 'fclo', # window closed - 'window_moved' : 'fsiz', # window moved - 'window_opened' : 'fopn', # window opened -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'foac' : folder_action, - 'scpt' : script, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'faen' : _Prop_folder_actions_enabled, - 'pALL' : _Prop_properties, - 'pnam' : _Prop_name, - 'posx' : _Prop_POSIX_path, - 'ppth' : _Prop_path, - 'volu' : _Prop_volume, -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'actn' : _Enum_actn, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py deleted file mode 100644 index e80ace1e5..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Suite Hidden Suite: Hidden Terms and Events for controlling the System Events application -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'tpnm' - -from StdSuites.Type_Names_Suite import * -class Hidden_Suite_Events(Type_Names_Suite_Events): - - def do_script(self, _object, _attributes={}, **_arguments): - """do script: Execute an OSA script. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'dosc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py deleted file mode 100644 index ed0924515..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py +++ /dev/null @@ -1,74 +0,0 @@ -"""Suite Login Items Suite: Terms and Events for controlling the Login Items application -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'logi' - -class Login_Items_Suite_Events: - - pass - - -class login_item(aetools.ComponentItem): - """login item - an item to be launched or opened at login """ - want = 'logi' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'cobj' -class _Prop_hidden(aetools.NProperty): - """hidden - Is the Login Item hidden when launched? """ - which = 'hidn' - want = 'bool' -class _Prop_kind(aetools.NProperty): - """kind - the file type of the Login Item """ - which = 'kind' - want = 'utxt' -class _Prop_name(aetools.NProperty): - """name - the name of the Login Item """ - which = 'pnam' - want = 'utxt' -class _Prop_path(aetools.NProperty): - """path - the file system path to the Login Item """ - which = 'ppth' - want = 'utxt' - -login_items = login_item -import Standard_Suite -login_item._superclassnames = ['item'] -login_item._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'hidden' : _Prop_hidden, - 'kind' : _Prop_kind, - 'name' : _Prop_name, - 'path' : _Prop_path, -} -login_item._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'logi' : login_item, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'hidn' : _Prop_hidden, - 'kind' : _Prop_kind, - 'pnam' : _Prop_name, - 'ppth' : _Prop_path, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py deleted file mode 100644 index ef539b1e0..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py +++ /dev/null @@ -1,149 +0,0 @@ -"""Suite Power Suite: Terms and Events for controlling System power -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'powr' - -class Power_Suite_Events: - - def restart(self, _object, _attributes={}, **_arguments): - """restart: Restart the computer - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'rest' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def shut_down(self, _object, _attributes={}, **_arguments): - """shut down: Shut Down the computer - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'shut' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def sleep(self, _object, _attributes={}, **_arguments): - """sleep: Put the computer to sleep - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'slep' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The System Events application """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_folder_actions_enabled(aetools.NProperty): - """folder actions enabled - Are Folder Actions currently being processed? """ - which = 'faen' - want = 'bool' -folder_actions_enabled = _Prop_folder_actions_enabled() -class _Prop_properties(aetools.NProperty): - """properties - every property of the System Events application """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application -application._superclassnames = [] -import Disk_Folder_File_Suite -import Standard_Suite -import Folder_Actions_Suite -import Login_Items_Suite -import Processes_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'folder_actions_enabled' : _Prop_folder_actions_enabled, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'application_process' : Processes_Suite.application_process, - 'desk_accessory_process' : Processes_Suite.desk_accessory_process, - 'disk' : Disk_Folder_File_Suite.disk, - 'document' : Standard_Suite.document, - 'file' : Disk_Folder_File_Suite.file, - 'folder' : Disk_Folder_File_Suite.folder, - 'folder_action' : Folder_Actions_Suite.folder_action, - 'item' : Disk_Folder_File_Suite.item, - 'login_item' : Login_Items_Suite.login_item, - 'process' : Processes_Suite.process, - 'window' : Standard_Suite.window, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'faen' : _Prop_folder_actions_enabled, - 'pALL' : _Prop_properties, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py deleted file mode 100644 index 9dcb85fb2..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py +++ /dev/null @@ -1,214 +0,0 @@ -"""Suite Processes Suite: Terms and Events for controlling Processes -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'prcs' - -class Processes_Suite_Events: - - pass - - -class application(aetools.ComponentItem): - """application - The Processes Suite host program """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_folder_actions_enabled(aetools.NProperty): - """folder actions enabled - Are Folder Actions currently being processed? """ - which = 'faen' - want = 'bool' -folder_actions_enabled = _Prop_folder_actions_enabled() -class _Prop_properties(aetools.NProperty): - """properties - every property of the Processes Suite host program """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class application_process(aetools.ComponentItem): - """application process - A process launched from an application file """ - want = 'pcap' -class _Prop_application_file(aetools.NProperty): - """application file - a reference to the application file from which this process was launched """ - which = 'appf' - want = '****' - -application_processes = application_process - -class desk_accessory_process(aetools.ComponentItem): - """desk accessory process - A process launched from an desk accessory file """ - want = 'pcda' -class _Prop_desk_accessory_file(aetools.NProperty): - """desk accessory file - a reference to the desk accessory file from which this process was launched """ - which = 'dafi' - want = '****' - -desk_accessory_processes = desk_accessory_process - -class process(aetools.ComponentItem): - """process - A process running on this computer """ - want = 'prcs' -class _Prop_accepts_high_level_events(aetools.NProperty): - """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ - which = 'isab' - want = 'bool' -class _Prop_accepts_remote_events(aetools.NProperty): - """accepts remote events - Does the process accept remote events? """ - which = 'revt' - want = 'bool' -class _Prop_classic(aetools.NProperty): - """classic - Is the process running in the Classic environment? """ - which = 'clsc' - want = 'bool' -class _Prop_creator_type(aetools.NProperty): - """creator type - the OSType of the creator of the process (the signature) """ - which = 'fcrt' - want = 'utxt' -class _Prop_file(aetools.NProperty): - """file - the file from which the process was launched """ - which = 'file' - want = '****' -class _Prop_file_type(aetools.NProperty): - """file type - the OSType of the file type of the process """ - which = 'asty' - want = 'utxt' -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is the process the frontmost process """ - which = 'pisf' - want = 'bool' -class _Prop_has_scripting_terminology(aetools.NProperty): - """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ - which = 'hscr' - want = 'bool' -class _Prop_name(aetools.NProperty): - """name - the name of the process """ - which = 'pnam' - want = 'utxt' -class _Prop_partition_space_used(aetools.NProperty): - """partition space used - the number of bytes currently used in the process' partition """ - which = 'pusd' - want = 'magn' -class _Prop_total_partition_size(aetools.NProperty): - """total partition size - the size of the partition with which the process was launched """ - which = 'appt' - want = 'magn' -class _Prop_visible(aetools.NProperty): - """visible - Is the process' layer visible? """ - which = 'pvis' - want = 'bool' - -processes = process -application._superclassnames = [] -import Disk_Folder_File_Suite -import Standard_Suite -import Folder_Actions_Suite -import Login_Items_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'folder_actions_enabled' : _Prop_folder_actions_enabled, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'application_process' : application_process, - 'desk_accessory_process' : desk_accessory_process, - 'disk' : Disk_Folder_File_Suite.disk, - 'document' : Standard_Suite.document, - 'file' : Disk_Folder_File_Suite.file, - 'folder' : Disk_Folder_File_Suite.folder, - 'folder_action' : Folder_Actions_Suite.folder_action, - 'item' : Disk_Folder_File_Suite.item, - 'login_item' : Login_Items_Suite.login_item, - 'process' : process, - 'window' : Standard_Suite.window, -} -application_process._superclassnames = ['process'] -application_process._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'application_file' : _Prop_application_file, -} -application_process._privelemdict = { -} -desk_accessory_process._superclassnames = ['process'] -desk_accessory_process._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'desk_accessory_file' : _Prop_desk_accessory_file, -} -desk_accessory_process._privelemdict = { -} -process._superclassnames = ['item'] -process._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'accepts_high_level_events' : _Prop_accepts_high_level_events, - 'accepts_remote_events' : _Prop_accepts_remote_events, - 'classic' : _Prop_classic, - 'creator_type' : _Prop_creator_type, - 'file' : _Prop_file, - 'file_type' : _Prop_file_type, - 'frontmost' : _Prop_frontmost, - 'has_scripting_terminology' : _Prop_has_scripting_terminology, - 'name' : _Prop_name, - 'partition_space_used' : _Prop_partition_space_used, - 'properties' : _Prop_properties, - 'total_partition_size' : _Prop_total_partition_size, - 'visible' : _Prop_visible, -} -process._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'prcs' : process, -} - -_propdeclarations = { - 'appf' : _Prop_application_file, - 'appt' : _Prop_total_partition_size, - 'asty' : _Prop_file_type, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'clsc' : _Prop_classic, - 'dafi' : _Prop_desk_accessory_file, - 'faen' : _Prop_folder_actions_enabled, - 'fcrt' : _Prop_creator_type, - 'file' : _Prop_file, - 'hscr' : _Prop_has_scripting_terminology, - 'isab' : _Prop_accepts_high_level_events, - 'pALL' : _Prop_properties, - 'pisf' : _Prop_frontmost, - 'pnam' : _Prop_name, - 'pusd' : _Prop_partition_space_used, - 'pvis' : _Prop_visible, - 'revt' : _Prop_accepts_remote_events, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py deleted file mode 100644 index f20ef8434..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py +++ /dev/null @@ -1,582 +0,0 @@ -"""Suite Standard Suite: Common classes and commands for most applications. -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = '????' - -class Standard_Suite_Events: - - _argmap_close = { - 'saving_in' : 'kfil', - 'saving' : 'savo', - } - - def close(self, _object, _attributes={}, **_arguments): - """close: Close an object. - Required argument: the object for the command - Keyword argument saving_in: The file in which to save the object. - Keyword argument saving: Specifies whether changes should be saved before closing. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - aetools.keysubst(_arguments, self._argmap_close) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_count = { - 'each' : 'kocl', - } - - def count(self, _object, _attributes={}, **_arguments): - """count: Return the number of elements of a particular class within an object. - Required argument: the object for the command - Keyword argument each: The class of objects to be counted. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'cnte' - - aetools.keysubst(_arguments, self._argmap_count) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def delete(self, _object, _attributes={}, **_arguments): - """delete: Delete an object. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'delo' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_duplicate = { - 'to' : 'insh', - 'with_properties' : 'prdt', - } - - def duplicate(self, _object, _attributes={}, **_arguments): - """duplicate: Copy object(s) and put the copies at a new location. - Required argument: the object for the command - Keyword argument to: The location for the new object(s). - Keyword argument with_properties: Properties to be set in the new duplicated object(s). - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clon' - - aetools.keysubst(_arguments, self._argmap_duplicate) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def exists(self, _object, _attributes={}, **_arguments): - """exists: Verify if an object exists. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'doex' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def get(self, _object, _attributes={}, **_arguments): - """get: Get the data for an object. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'getd' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_make = { - 'at' : 'insh', - 'new' : 'kocl', - 'with_data' : 'data', - 'with_properties' : 'prdt', - } - - def make(self, _no_object=None, _attributes={}, **_arguments): - """make: Make a new object. - Keyword argument at: The location at which to insert the object. - Keyword argument new: The class of the new object. - Keyword argument with_data: The initial data for the object. - Keyword argument with_properties: The initial values for properties of the object. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'crel' - - aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_move = { - 'to' : 'insh', - } - - def move(self, _object, _attributes={}, **_arguments): - """move: Move object(s) to a new location. - Required argument: the object for the command - Keyword argument to: The new location for the object(s). - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'move' - - aetools.keysubst(_arguments, self._argmap_move) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def open(self, _object=None, _attributes={}, **_arguments): - """open: Open an object. - Required argument: list of objects - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def print_(self, _object=None, _attributes={}, **_arguments): - """print: Print an object. - Required argument: list of objects - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_quit = { - 'saving' : 'savo', - } - - def quit(self, _object, _attributes={}, **_arguments): - """quit: Quit an application. - Required argument: the object for the command - Keyword argument saving: Specifies whether changes should be saved before quitting. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - aetools.keysubst(_arguments, self._argmap_quit) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_save = { - 'in_' : 'kfil', - 'as' : 'fltp', - } - - def save(self, _object, _attributes={}, **_arguments): - """save: Save an object. - Required argument: the object for the command - Keyword argument in_: The file in which to save the object. - Keyword argument as: The file type in which to save the data. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'save' - - aetools.keysubst(_arguments, self._argmap_save) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_set = { - 'to' : 'data', - } - - def set(self, _object, _attributes={}, **_arguments): - """set: Set an object's data. - Required argument: the object for the command - Keyword argument to: The new value. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'setd' - - aetools.keysubst(_arguments, self._argmap_set) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - An application's top level scripting object. """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'cobj' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is this the frontmost (active) application? """ - which = 'pisf' - want = 'bool' -frontmost = _Prop_frontmost() -class _Prop_name(aetools.NProperty): - """name - The name of the application. """ - which = 'pnam' - want = 'utxt' -name = _Prop_name() -class _Prop_version(aetools.NProperty): - """version - The version of the application. """ - which = 'vers' - want = 'utxt' -version = _Prop_version() -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class item(aetools.ComponentItem): - """item - A scriptable object. """ - want = 'cobj' -class _Prop_class_(aetools.NProperty): - """class - The class of the object. """ - which = 'pcls' - want = 'type' -class _Prop_properties(aetools.NProperty): - """properties - All of the object's properties. """ - which = 'pALL' - want = 'reco' - -items = item - -class color(aetools.ComponentItem): - """color - A color. """ - want = 'colr' - -colors = color - -class window(aetools.ComponentItem): - """window - A window. """ - want = 'cwin' -class _Prop_bounds(aetools.NProperty): - """bounds - The bounding rectangle of the window. """ - which = 'pbnd' - want = 'qdrt' -class _Prop_closeable(aetools.NProperty): - """closeable - Whether the window has a close box. """ - which = 'hclb' - want = 'bool' -class _Prop_document(aetools.NProperty): - """document - The document whose contents are being displayed in the window. """ - which = 'docu' - want = 'docu' -class _Prop_floating(aetools.NProperty): - """floating - Whether the window floats. """ - which = 'isfl' - want = 'bool' -class _Prop_id(aetools.NProperty): - """id - The unique identifier of the window. """ - which = 'ID ' - want = 'long' -class _Prop_index(aetools.NProperty): - """index - The index of the window in the back-to-front window ordering. """ - which = 'pidx' - want = 'long' -class _Prop_miniaturizable(aetools.NProperty): - """miniaturizable - Whether the window can be miniaturized. """ - which = 'ismn' - want = 'bool' -class _Prop_miniaturized(aetools.NProperty): - """miniaturized - Whether the window is currently miniaturized. """ - which = 'pmnd' - want = 'bool' -class _Prop_modal(aetools.NProperty): - """modal - Whether the window is the application's current modal window. """ - which = 'pmod' - want = 'bool' -class _Prop_resizable(aetools.NProperty): - """resizable - Whether the window can be resized. """ - which = 'prsz' - want = 'bool' -class _Prop_titled(aetools.NProperty): - """titled - Whether the window has a title bar. """ - which = 'ptit' - want = 'bool' -class _Prop_visible(aetools.NProperty): - """visible - Whether the window is currently visible. """ - which = 'pvis' - want = 'bool' -class _Prop_zoomable(aetools.NProperty): - """zoomable - Whether the window can be zoomed. """ - which = 'iszm' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Whether the window is currently zoomed. """ - which = 'pzum' - want = 'bool' - -windows = window - -class document(aetools.ComponentItem): - """document - A document. """ - want = 'docu' -class _Prop_modified(aetools.NProperty): - """modified - Has the document been modified since the last save? """ - which = 'imod' - want = 'bool' -class _Prop_path(aetools.NProperty): - """path - The document's path. """ - which = 'ppth' - want = 'utxt' - -documents = document -application._superclassnames = ['item'] -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'frontmost' : _Prop_frontmost, - 'name' : _Prop_name, - 'version' : _Prop_version, -} -application._privelemdict = { - 'document' : document, - 'window' : window, -} -item._superclassnames = [] -item._privpropdict = { - 'class_' : _Prop_class_, - 'properties' : _Prop_properties, -} -item._privelemdict = { -} -color._superclassnames = ['item'] -color._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -color._privelemdict = { -} -window._superclassnames = ['item'] -window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'bounds' : _Prop_bounds, - 'closeable' : _Prop_closeable, - 'document' : _Prop_document, - 'floating' : _Prop_floating, - 'id' : _Prop_id, - 'index' : _Prop_index, - 'miniaturizable' : _Prop_miniaturizable, - 'miniaturized' : _Prop_miniaturized, - 'modal' : _Prop_modal, - 'name' : _Prop_name, - 'resizable' : _Prop_resizable, - 'titled' : _Prop_titled, - 'visible' : _Prop_visible, - 'zoomable' : _Prop_zoomable, - 'zoomed' : _Prop_zoomed, -} -window._privelemdict = { -} -document._superclassnames = ['item'] -document._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'modified' : _Prop_modified, - 'name' : _Prop_name, - 'path' : _Prop_path, -} -document._privelemdict = { -} -class _3c_(aetools.NComparison): - """< - Less than """ -class _3d_(aetools.NComparison): - """= - Equal """ -class _3e_(aetools.NComparison): - """> - Greater than """ -class contains(aetools.NComparison): - """contains - Contains """ -class ends_with(aetools.NComparison): - """ends with - Ends with """ -class starts_with(aetools.NComparison): - """starts with - Starts with """ -class _b2_(aetools.NComparison): - """\xb2 - Less than or equal to """ -class _b3_(aetools.NComparison): - """\xb3 - Greater than or equal to """ -_Enum_savo = { - 'ask' : 'ask ', # Ask the user whether or not to save the file. - 'yes' : 'yes ', # Save the file. - 'no' : 'no ', # Do not save the file. -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cobj' : item, - 'colr' : color, - 'cwin' : window, - 'docu' : document, -} - -_propdeclarations = { - 'ID ' : _Prop_id, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'docu' : _Prop_document, - 'hclb' : _Prop_closeable, - 'imod' : _Prop_modified, - 'isfl' : _Prop_floating, - 'ismn' : _Prop_miniaturizable, - 'iszm' : _Prop_zoomable, - 'pALL' : _Prop_properties, - 'pbnd' : _Prop_bounds, - 'pcls' : _Prop_class_, - 'pidx' : _Prop_index, - 'pisf' : _Prop_frontmost, - 'pmnd' : _Prop_miniaturized, - 'pmod' : _Prop_modal, - 'pnam' : _Prop_name, - 'ppth' : _Prop_path, - 'prsz' : _Prop_resizable, - 'ptit' : _Prop_titled, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, - 'vers' : _Prop_version, -} - -_compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, -} - -_enumdeclarations = { - 'savo' : _Enum_savo, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py deleted file mode 100644 index d5b4bfc6e..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py +++ /dev/null @@ -1,109 +0,0 @@ -"""Suite System Events Suite: Terms and Events for controlling the System Events application -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'sevs' - -class System_Events_Suite_Events: - - def do_script(self, _object, _attributes={}, **_arguments): - """do script: Execute an OSA script. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'misc' - _subcode = 'dosc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The System Events application """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_folder_actions_enabled(aetools.NProperty): - """folder actions enabled - Are Folder Actions currently being processed? """ - which = 'faen' - want = 'bool' -folder_actions_enabled = _Prop_folder_actions_enabled() -class _Prop_properties(aetools.NProperty): - """properties - every property of the System Events application """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] -# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application -application._superclassnames = [] -import Disk_Folder_File_Suite -import Standard_Suite -import Folder_Actions_Suite -import Login_Items_Suite -import Processes_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'folder_actions_enabled' : _Prop_folder_actions_enabled, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'application_process' : Processes_Suite.application_process, - 'desk_accessory_process' : Processes_Suite.desk_accessory_process, - 'disk' : Disk_Folder_File_Suite.disk, - 'document' : Standard_Suite.document, - 'file' : Disk_Folder_File_Suite.file, - 'folder' : Disk_Folder_File_Suite.folder, - 'folder_action' : Folder_Actions_Suite.folder_action, - 'item' : Disk_Folder_File_Suite.item, - 'login_item' : Login_Items_Suite.login_item, - 'process' : Processes_Suite.process, - 'window' : Standard_Suite.window, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, -} - -_propdeclarations = { - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'faen' : _Prop_folder_actions_enabled, - 'pALL' : _Prop_properties, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py deleted file mode 100644 index 9f109e111..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py +++ /dev/null @@ -1,195 +0,0 @@ -"""Suite Text Suite: A set of basic classes for text processing. -Level 1, version 1 - -Generated from /System/Library/CoreServices/System Events.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = '????' - -class Text_Suite_Events: - - pass - - -class attachment(aetools.ComponentItem): - """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ - want = 'atts' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'ctxt' -class _Prop_file_name(aetools.NProperty): - """file name - The path to the file for the attachment """ - which = 'atfn' - want = 'utxt' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -class attribute_run(aetools.ComponentItem): - """attribute run - This subdivides the text into chunks that all have the same attributes. """ - want = 'catr' -class _Prop_color(aetools.NProperty): - """color - The color of the first character. """ - which = 'colr' - want = 'colr' -class _Prop_font(aetools.NProperty): - """font - The name of the font of the first character. """ - which = 'font' - want = 'utxt' -class _Prop_size(aetools.NProperty): - """size - The size in points of the first character. """ - which = 'ptsz' - want = 'long' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -attribute_runs = attribute_run - -class character(aetools.ComponentItem): - """character - This subdivides the text into characters. """ - want = 'cha ' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -characters = character - -class paragraph(aetools.ComponentItem): - """paragraph - This subdivides the text into paragraphs. """ - want = 'cpar' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -paragraphs = paragraph - -class text(aetools.ComponentItem): - """text - Rich (styled) text """ - want = 'ctxt' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -class word(aetools.ComponentItem): - """word - This subdivides the text into words. """ - want = 'cwor' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -words = word -attachment._superclassnames = ['text'] -attachment._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'file_name' : _Prop_file_name, -} -attachment._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -import Standard_Suite -attribute_run._superclassnames = ['item'] -attribute_run._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -attribute_run._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -character._superclassnames = ['item'] -character._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -character._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -paragraph._superclassnames = ['item'] -paragraph._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -paragraph._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -text._superclassnames = ['item'] -text._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -text._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -word._superclassnames = ['item'] -word._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -word._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'atts' : attachment, - 'catr' : attribute_run, - 'cha ' : character, - 'cpar' : paragraph, - 'ctxt' : text, - 'cwor' : word, -} - -_propdeclarations = { - 'atfn' : _Prop_file_name, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'colr' : _Prop_color, - 'font' : _Prop_font, - 'ptsz' : _Prop_size, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/__init__.py deleted file mode 100644 index 95f985ccc..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/SystemEvents/__init__.py +++ /dev/null @@ -1,140 +0,0 @@ -""" -Package generated from /System/Library/CoreServices/System Events.app -""" -import aetools -Error = aetools.Error -import Standard_Suite -import Text_Suite -import Disk_Folder_File_Suite -import Folder_Actions_Suite -import Login_Items_Suite -import Power_Suite -import Processes_Suite -import System_Events_Suite - - -_code_to_module = { - '????' : Standard_Suite, - '????' : Text_Suite, - 'cdis' : Disk_Folder_File_Suite, - 'faco' : Folder_Actions_Suite, - 'logi' : Login_Items_Suite, - 'powr' : Power_Suite, - 'prcs' : Processes_Suite, - 'sevs' : System_Events_Suite, -} - - - -_code_to_fullname = { - '????' : ('SystemEvents.Standard_Suite', 'Standard_Suite'), - '????' : ('SystemEvents.Text_Suite', 'Text_Suite'), - 'cdis' : ('SystemEvents.Disk_Folder_File_Suite', 'Disk_Folder_File_Suite'), - 'faco' : ('SystemEvents.Folder_Actions_Suite', 'Folder_Actions_Suite'), - 'logi' : ('SystemEvents.Login_Items_Suite', 'Login_Items_Suite'), - 'powr' : ('SystemEvents.Power_Suite', 'Power_Suite'), - 'prcs' : ('SystemEvents.Processes_Suite', 'Processes_Suite'), - 'sevs' : ('SystemEvents.System_Events_Suite', 'System_Events_Suite'), -} - -from Standard_Suite import * -from Text_Suite import * -from Disk_Folder_File_Suite import * -from Folder_Actions_Suite import * -from Login_Items_Suite import * -from Power_Suite import * -from Processes_Suite import * -from System_Events_Suite import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(login_item) -getbaseclasses(color) -getbaseclasses(window) -getbaseclasses(application) -getbaseclasses(item) -getbaseclasses(document) -getbaseclasses(character) -getbaseclasses(attachment) -getbaseclasses(paragraph) -getbaseclasses(word) -getbaseclasses(attribute_run) -getbaseclasses(text) -getbaseclasses(file) -getbaseclasses(application) -getbaseclasses(item) -getbaseclasses(folder) -getbaseclasses(disk) -getbaseclasses(script) -getbaseclasses(application) -getbaseclasses(folder_action) -getbaseclasses(application) -getbaseclasses(application) -getbaseclasses(process) -getbaseclasses(application_process) -getbaseclasses(desk_accessory_process) -getbaseclasses(application) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'logi' : login_item, - 'colr' : color, - 'cwin' : window, - 'capp' : application, - 'cobj' : item, - 'docu' : document, - 'cha ' : character, - 'atts' : attachment, - 'cpar' : paragraph, - 'cwor' : word, - 'catr' : attribute_run, - 'ctxt' : text, - 'file' : file, - 'capp' : application, - 'cobj' : item, - 'cfol' : folder, - 'cdis' : disk, - 'scpt' : script, - 'capp' : application, - 'foac' : folder_action, - 'capp' : application, - 'capp' : application, - 'prcs' : process, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'capp' : application, -} - - -class SystemEvents(Standard_Suite_Events, - Text_Suite_Events, - Disk_Folder_File_Suite_Events, - Folder_Actions_Suite_Events, - Login_Items_Suite_Events, - Power_Suite_Events, - Processes_Suite_Events, - System_Events_Suite_Events, - aetools.TalkTo): - _signature = 'sevs' - - _moduleName = 'SystemEvents' - - _elemdict = application._elemdict - _propdict = application._propdict diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py deleted file mode 100644 index 035290f32..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py +++ /dev/null @@ -1,582 +0,0 @@ -"""Suite Standard Suite: Common classes and commands for most applications. -Level 1, version 1 - -Generated from /Applications/Utilities/Terminal.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = '????' - -class Standard_Suite_Events: - - _argmap_close = { - 'saving_in' : 'kfil', - 'saving' : 'savo', - } - - def close(self, _object, _attributes={}, **_arguments): - """close: Close an object. - Required argument: the object for the command - Keyword argument saving_in: The file in which to save the object. - Keyword argument saving: Specifies whether changes should be saved before closing. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clos' - - aetools.keysubst(_arguments, self._argmap_close) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_count = { - 'each' : 'kocl', - } - - def count(self, _object, _attributes={}, **_arguments): - """count: Return the number of elements of a particular class within an object. - Required argument: the object for the command - Keyword argument each: The class of objects to be counted. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'cnte' - - aetools.keysubst(_arguments, self._argmap_count) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def delete(self, _object, _attributes={}, **_arguments): - """delete: Delete an object. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'delo' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_duplicate = { - 'to' : 'insh', - 'with_properties' : 'prdt', - } - - def duplicate(self, _object, _attributes={}, **_arguments): - """duplicate: Copy object(s) and put the copies at a new location. - Required argument: the object for the command - Keyword argument to: The location for the new object(s). - Keyword argument with_properties: Properties to be set in the new duplicated object(s). - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'clon' - - aetools.keysubst(_arguments, self._argmap_duplicate) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def exists(self, _object, _attributes={}, **_arguments): - """exists: Verify if an object exists. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'doex' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def get(self, _object, _attributes={}, **_arguments): - """get: Get the data for an object. - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'getd' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_make = { - 'at' : 'insh', - 'new' : 'kocl', - 'with_data' : 'data', - 'with_properties' : 'prdt', - } - - def make(self, _no_object=None, _attributes={}, **_arguments): - """make: Make a new object. - Keyword argument at: The location at which to insert the object. - Keyword argument new: The class of the new object. - Keyword argument with_data: The initial data for the object. - Keyword argument with_properties: The initial values for properties of the object. - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'crel' - - aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_move = { - 'to' : 'insh', - } - - def move(self, _object, _attributes={}, **_arguments): - """move: Move object(s) to a new location. - Required argument: the object for the command - Keyword argument to: The new location for the object(s). - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'move' - - aetools.keysubst(_arguments, self._argmap_move) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def open(self, _object=None, _attributes={}, **_arguments): - """open: Open an object. - Required argument: list of objects - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def print_(self, _object=None, _attributes={}, **_arguments): - """print: Print an object. - Required argument: list of objects - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_quit = { - 'saving' : 'savo', - } - - def quit(self, _object, _attributes={}, **_arguments): - """quit: Quit an application. - Required argument: the object for the command - Keyword argument saving: Specifies whether changes should be saved before quitting. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - aetools.keysubst(_arguments, self._argmap_quit) - _arguments['----'] = _object - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_save = { - 'in_' : 'kfil', - 'as' : 'fltp', - } - - def save(self, _object, _attributes={}, **_arguments): - """save: Save an object. - Required argument: the object for the command - Keyword argument in_: The file in which to save the object. - Keyword argument as: The file type in which to save the data. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'save' - - aetools.keysubst(_arguments, self._argmap_save) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_set = { - 'to' : 'data', - } - - def set(self, _object, _attributes={}, **_arguments): - """set: Set an object's data. - Required argument: the object for the command - Keyword argument to: The new value. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'core' - _subcode = 'setd' - - aetools.keysubst(_arguments, self._argmap_set) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - An application's top level scripting object. """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'cobj' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is this the frontmost (active) application? """ - which = 'pisf' - want = 'bool' -frontmost = _Prop_frontmost() -class _Prop_name(aetools.NProperty): - """name - The name of the application. """ - which = 'pnam' - want = 'utxt' -name = _Prop_name() -class _Prop_version(aetools.NProperty): - """version - The version of the application. """ - which = 'vers' - want = 'utxt' -version = _Prop_version() -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class item(aetools.ComponentItem): - """item - A scriptable object. """ - want = 'cobj' -class _Prop_class_(aetools.NProperty): - """class - The class of the object. """ - which = 'pcls' - want = 'type' -class _Prop_properties(aetools.NProperty): - """properties - All of the object's properties. """ - which = 'pALL' - want = 'reco' - -items = item - -class color(aetools.ComponentItem): - """color - A color. """ - want = 'colr' - -colors = color - -class window(aetools.ComponentItem): - """window - A window. """ - want = 'cwin' -class _Prop_bounds(aetools.NProperty): - """bounds - The bounding rectangle of the window. """ - which = 'pbnd' - want = 'qdrt' -class _Prop_closeable(aetools.NProperty): - """closeable - Whether the window has a close box. """ - which = 'hclb' - want = 'bool' -class _Prop_document(aetools.NProperty): - """document - The document whose contents are being displayed in the window. """ - which = 'docu' - want = 'docu' -class _Prop_floating(aetools.NProperty): - """floating - Whether the window floats. """ - which = 'isfl' - want = 'bool' -class _Prop_id(aetools.NProperty): - """id - The unique identifier of the window. """ - which = 'ID ' - want = 'long' -class _Prop_index(aetools.NProperty): - """index - The index of the window in the back-to-front window ordering. """ - which = 'pidx' - want = 'long' -class _Prop_miniaturizable(aetools.NProperty): - """miniaturizable - Whether the window can be miniaturized. """ - which = 'ismn' - want = 'bool' -class _Prop_miniaturized(aetools.NProperty): - """miniaturized - Whether the window is currently miniaturized. """ - which = 'pmnd' - want = 'bool' -class _Prop_modal(aetools.NProperty): - """modal - Whether the window is the application's current modal window. """ - which = 'pmod' - want = 'bool' -class _Prop_resizable(aetools.NProperty): - """resizable - Whether the window can be resized. """ - which = 'prsz' - want = 'bool' -class _Prop_titled(aetools.NProperty): - """titled - Whether the window has a title bar. """ - which = 'ptit' - want = 'bool' -class _Prop_visible(aetools.NProperty): - """visible - Whether the window is currently visible. """ - which = 'pvis' - want = 'bool' -class _Prop_zoomable(aetools.NProperty): - """zoomable - Whether the window can be zoomed. """ - which = 'iszm' - want = 'bool' -class _Prop_zoomed(aetools.NProperty): - """zoomed - Whether the window is currently zoomed. """ - which = 'pzum' - want = 'bool' - -windows = window - -class document(aetools.ComponentItem): - """document - A document. """ - want = 'docu' -class _Prop_modified(aetools.NProperty): - """modified - Has the document been modified since the last save? """ - which = 'imod' - want = 'bool' -class _Prop_path(aetools.NProperty): - """path - The document's path. """ - which = 'ppth' - want = 'utxt' - -documents = document -application._superclassnames = ['item'] -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'frontmost' : _Prop_frontmost, - 'name' : _Prop_name, - 'version' : _Prop_version, -} -application._privelemdict = { - 'document' : document, - 'window' : window, -} -item._superclassnames = [] -item._privpropdict = { - 'class_' : _Prop_class_, - 'properties' : _Prop_properties, -} -item._privelemdict = { -} -color._superclassnames = ['item'] -color._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, -} -color._privelemdict = { -} -window._superclassnames = ['item'] -window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'bounds' : _Prop_bounds, - 'closeable' : _Prop_closeable, - 'document' : _Prop_document, - 'floating' : _Prop_floating, - 'id' : _Prop_id, - 'index' : _Prop_index, - 'miniaturizable' : _Prop_miniaturizable, - 'miniaturized' : _Prop_miniaturized, - 'modal' : _Prop_modal, - 'name' : _Prop_name, - 'resizable' : _Prop_resizable, - 'titled' : _Prop_titled, - 'visible' : _Prop_visible, - 'zoomable' : _Prop_zoomable, - 'zoomed' : _Prop_zoomed, -} -window._privelemdict = { -} -document._superclassnames = ['item'] -document._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'modified' : _Prop_modified, - 'name' : _Prop_name, - 'path' : _Prop_path, -} -document._privelemdict = { -} -class _3c_(aetools.NComparison): - """< - Less than """ -class _3d_(aetools.NComparison): - """= - Equal """ -class _3e_(aetools.NComparison): - """> - Greater than """ -class contains(aetools.NComparison): - """contains - Contains """ -class ends_with(aetools.NComparison): - """ends with - Ends with """ -class starts_with(aetools.NComparison): - """starts with - Starts with """ -class _b2_(aetools.NComparison): - """\xb2 - Less than or equal to """ -class _b3_(aetools.NComparison): - """\xb3 - Greater than or equal to """ -_Enum_savo = { - 'ask' : 'ask ', # Ask the user whether or not to save the file. - 'yes' : 'yes ', # Save the file. - 'no' : 'no ', # Do not save the file. -} - - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cobj' : item, - 'colr' : color, - 'cwin' : window, - 'docu' : document, -} - -_propdeclarations = { - 'ID ' : _Prop_id, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'docu' : _Prop_document, - 'hclb' : _Prop_closeable, - 'imod' : _Prop_modified, - 'isfl' : _Prop_floating, - 'ismn' : _Prop_miniaturizable, - 'iszm' : _Prop_zoomable, - 'pALL' : _Prop_properties, - 'pbnd' : _Prop_bounds, - 'pcls' : _Prop_class_, - 'pidx' : _Prop_index, - 'pisf' : _Prop_frontmost, - 'pmnd' : _Prop_miniaturized, - 'pmod' : _Prop_modal, - 'pnam' : _Prop_name, - 'ppth' : _Prop_path, - 'prsz' : _Prop_resizable, - 'ptit' : _Prop_titled, - 'pvis' : _Prop_visible, - 'pzum' : _Prop_zoomed, - 'vers' : _Prop_version, -} - -_compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, -} - -_enumdeclarations = { - 'savo' : _Enum_savo, -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py deleted file mode 100644 index afa02b39f..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py +++ /dev/null @@ -1,254 +0,0 @@ -"""Suite Terminal Suite: Terms and Events for controlling the Terminal application -Level 1, version 1 - -Generated from /Applications/Utilities/Terminal.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = 'trmx' - -class Terminal_Suite_Events: - - def GetURL(self, _object, _attributes={}, **_arguments): - """GetURL: Opens a telnet: URL - Required argument: the object for the command - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'GURL' - _subcode = 'GURL' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_do_script = { - 'in_' : 'kfil', - 'with_command' : 'cmnd', - } - - def do_script(self, _object, _attributes={}, **_arguments): - """do script: Run a UNIX shell script or command - Required argument: the object for the command - Keyword argument in_: the window in which to execute the command - Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the reply for the command - """ - _code = 'core' - _subcode = 'dosc' - - aetools.keysubst(_arguments, self._argmap_do_script) - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - -class application(aetools.ComponentItem): - """application - The Terminal program """ - want = 'capp' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'capp' -_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() -class _Prop_properties(aetools.NProperty): - """properties - every property of the Terminal program """ - which = 'pALL' - want = '****' -properties = _Prop_properties() -# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] -# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] - -applications = application - -class window(aetools.ComponentItem): - """window - A Terminal window """ - want = 'cwin' -class _Prop_background_color(aetools.NProperty): - """background color - the background color for the window """ - which = 'pbcl' - want = '****' -class _Prop_bold_text_color(aetools.NProperty): - """bold text color - the bold text color for the window """ - which = 'pbtc' - want = '****' -class _Prop_bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ - which = 'pbnd' - want = '****' -class _Prop_busy(aetools.NProperty): - """busy - Is the window busy running a process? """ - which = 'busy' - want = 'bool' -class _Prop_contents(aetools.NProperty): - """contents - the currently visible contents of the window """ - which = 'pcnt' - want = 'utxt' -class _Prop_cursor_color(aetools.NProperty): - """cursor color - the cursor color for the window """ - which = 'pcuc' - want = '****' -class _Prop_custom_title(aetools.NProperty): - """custom title - the custom title for the window """ - which = 'titl' - want = 'utxt' -class _Prop_frame(aetools.NProperty): - """frame - the origin and size of the window """ - which = 'pfra' - want = '****' -class _Prop_frontmost(aetools.NProperty): - """frontmost - Is the window in front of the other Terminal windows? """ - which = 'pisf' - want = 'bool' -class _Prop_history(aetools.NProperty): - """history - the contents of the entire scrolling buffer of the window """ - which = 'hist' - want = 'utxt' -class _Prop_normal_text_color(aetools.NProperty): - """normal text color - the normal text color for the window """ - which = 'ptxc' - want = '****' -class _Prop_number_of_columns(aetools.NProperty): - """number of columns - the number of columns in the window """ - which = 'ccol' - want = 'long' -class _Prop_number_of_rows(aetools.NProperty): - """number of rows - the number of rows in the window """ - which = 'crow' - want = 'long' -class _Prop_origin(aetools.NProperty): - """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ - which = 'pori' - want = '****' -class _Prop_position(aetools.NProperty): - """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ - which = 'ppos' - want = '****' -class _Prop_processes(aetools.NProperty): - """processes - a list of the currently running processes """ - which = 'prcs' - want = 'utxt' -class _Prop_size(aetools.NProperty): - """size - the width and height of the window """ - which = 'psiz' - want = '****' -class _Prop_title_displays_custom_title(aetools.NProperty): - """title displays custom title - Does the title for the window contain a custom title? """ - which = 'tdct' - want = 'bool' -class _Prop_title_displays_device_name(aetools.NProperty): - """title displays device name - Does the title for the window contain the device name? """ - which = 'tddn' - want = 'bool' -class _Prop_title_displays_file_name(aetools.NProperty): - """title displays file name - Does the title for the window contain the file name? """ - which = 'tdfn' - want = 'bool' -class _Prop_title_displays_shell_path(aetools.NProperty): - """title displays shell path - Does the title for the window contain the shell path? """ - which = 'tdsp' - want = 'bool' -class _Prop_title_displays_window_size(aetools.NProperty): - """title displays window size - Does the title for the window contain the window size? """ - which = 'tdws' - want = 'bool' - -windows = window -application._superclassnames = [] -import Standard_Suite -application._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'properties' : _Prop_properties, -} -application._privelemdict = { - 'document' : Standard_Suite.document, - 'window' : window, -} -window._superclassnames = [] -window._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'background_color' : _Prop_background_color, - 'bold_text_color' : _Prop_bold_text_color, - 'bounds' : _Prop_bounds, - 'busy' : _Prop_busy, - 'contents' : _Prop_contents, - 'cursor_color' : _Prop_cursor_color, - 'custom_title' : _Prop_custom_title, - 'frame' : _Prop_frame, - 'frontmost' : _Prop_frontmost, - 'history' : _Prop_history, - 'normal_text_color' : _Prop_normal_text_color, - 'number_of_columns' : _Prop_number_of_columns, - 'number_of_rows' : _Prop_number_of_rows, - 'origin' : _Prop_origin, - 'position' : _Prop_position, - 'processes' : _Prop_processes, - 'properties' : _Prop_properties, - 'size' : _Prop_size, - 'title_displays_custom_title' : _Prop_title_displays_custom_title, - 'title_displays_device_name' : _Prop_title_displays_device_name, - 'title_displays_file_name' : _Prop_title_displays_file_name, - 'title_displays_shell_path' : _Prop_title_displays_shell_path, - 'title_displays_window_size' : _Prop_title_displays_window_size, -} -window._privelemdict = { -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'capp' : application, - 'cwin' : window, -} - -_propdeclarations = { - 'busy' : _Prop_busy, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'ccol' : _Prop_number_of_columns, - 'crow' : _Prop_number_of_rows, - 'hist' : _Prop_history, - 'pALL' : _Prop_properties, - 'pbcl' : _Prop_background_color, - 'pbnd' : _Prop_bounds, - 'pbtc' : _Prop_bold_text_color, - 'pcnt' : _Prop_contents, - 'pcuc' : _Prop_cursor_color, - 'pfra' : _Prop_frame, - 'pisf' : _Prop_frontmost, - 'pori' : _Prop_origin, - 'ppos' : _Prop_position, - 'prcs' : _Prop_processes, - 'psiz' : _Prop_size, - 'ptxc' : _Prop_normal_text_color, - 'tdct' : _Prop_title_displays_custom_title, - 'tddn' : _Prop_title_displays_device_name, - 'tdfn' : _Prop_title_displays_file_name, - 'tdsp' : _Prop_title_displays_shell_path, - 'tdws' : _Prop_title_displays_window_size, - 'titl' : _Prop_custom_title, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py deleted file mode 100644 index 62f4744b2..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py +++ /dev/null @@ -1,195 +0,0 @@ -"""Suite Text Suite: A set of basic classes for text processing. -Level 1, version 1 - -Generated from /Applications/Utilities/Terminal.app -AETE/AEUT resource version 1/0, language 0, script 0 -""" - -import aetools -import MacOS - -_code = '????' - -class Text_Suite_Events: - - pass - - -class attachment(aetools.ComponentItem): - """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ - want = 'atts' -class _Prop__3c_Inheritance_3e_(aetools.NProperty): - """<Inheritance> - All of the properties of the superclass. """ - which = 'c@#^' - want = 'ctxt' -class _Prop_file_name(aetools.NProperty): - """file name - The path to the file for the attachment """ - which = 'atfn' - want = 'utxt' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -class attribute_run(aetools.ComponentItem): - """attribute run - This subdivides the text into chunks that all have the same attributes. """ - want = 'catr' -class _Prop_color(aetools.NProperty): - """color - The color of the first character. """ - which = 'colr' - want = 'colr' -class _Prop_font(aetools.NProperty): - """font - The name of the font of the first character. """ - which = 'font' - want = 'utxt' -class _Prop_size(aetools.NProperty): - """size - The size in points of the first character. """ - which = 'ptsz' - want = 'long' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -attribute_runs = attribute_run - -class character(aetools.ComponentItem): - """character - This subdivides the text into characters. """ - want = 'cha ' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -characters = character - -class paragraph(aetools.ComponentItem): - """paragraph - This subdivides the text into paragraphs. """ - want = 'cpar' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -paragraphs = paragraph - -class text(aetools.ComponentItem): - """text - Rich (styled) text """ - want = 'ctxt' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -class word(aetools.ComponentItem): - """word - This subdivides the text into words. """ - want = 'cwor' -# element 'catr' as ['indx', 'rele', 'rang', 'test'] -# element 'cha ' as ['indx', 'rele', 'rang', 'test'] -# element 'cpar' as ['indx', 'rele', 'rang', 'test'] -# element 'cwor' as ['indx', 'rele', 'rang', 'test'] - -words = word -attachment._superclassnames = ['text'] -attachment._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'file_name' : _Prop_file_name, -} -attachment._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -import Standard_Suite -attribute_run._superclassnames = ['item'] -attribute_run._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -attribute_run._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -character._superclassnames = ['item'] -character._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -character._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -paragraph._superclassnames = ['item'] -paragraph._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -paragraph._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -text._superclassnames = ['item'] -text._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -text._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} -word._superclassnames = ['item'] -word._privpropdict = { - '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'color' : _Prop_color, - 'font' : _Prop_font, - 'size' : _Prop_size, -} -word._privelemdict = { - 'attribute_run' : attribute_run, - 'character' : character, - 'paragraph' : paragraph, - 'word' : word, -} - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'atts' : attachment, - 'catr' : attribute_run, - 'cha ' : character, - 'cpar' : paragraph, - 'ctxt' : text, - 'cwor' : word, -} - -_propdeclarations = { - 'atfn' : _Prop_file_name, - 'c@#^' : _Prop__3c_Inheritance_3e_, - 'colr' : _Prop_color, - 'font' : _Prop_font, - 'ptsz' : _Prop_size, -} - -_compdeclarations = { -} - -_enumdeclarations = { -} diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/__init__.py deleted file mode 100644 index 47b75f2ae..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/Terminal/__init__.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Package generated from /Applications/Utilities/Terminal.app -""" -import aetools -Error = aetools.Error -import Standard_Suite -import Text_Suite -import Terminal_Suite - - -_code_to_module = { - '????' : Standard_Suite, - '????' : Text_Suite, - 'trmx' : Terminal_Suite, -} - - - -_code_to_fullname = { - '????' : ('Terminal.Standard_Suite', 'Standard_Suite'), - '????' : ('Terminal.Text_Suite', 'Text_Suite'), - 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), -} - -from Standard_Suite import * -from Text_Suite import * -from Terminal_Suite import * - -def getbaseclasses(v): - if not getattr(v, '_propdict', None): - v._propdict = {} - v._elemdict = {} - for superclassname in getattr(v, '_superclassnames', []): - superclass = eval(superclassname) - getbaseclasses(superclass) - v._propdict.update(getattr(superclass, '_propdict', {})) - v._elemdict.update(getattr(superclass, '_elemdict', {})) - v._propdict.update(getattr(v, '_privpropdict', {})) - v._elemdict.update(getattr(v, '_privelemdict', {})) - -import StdSuites - -# -# Set property and element dictionaries now that all classes have been defined -# -getbaseclasses(color) -getbaseclasses(window) -getbaseclasses(application) -getbaseclasses(item) -getbaseclasses(document) -getbaseclasses(window) -getbaseclasses(application) -getbaseclasses(character) -getbaseclasses(attachment) -getbaseclasses(paragraph) -getbaseclasses(word) -getbaseclasses(attribute_run) -getbaseclasses(text) - -# -# Indices of types declared in this module -# -_classdeclarations = { - 'colr' : color, - 'cwin' : window, - 'capp' : application, - 'cobj' : item, - 'docu' : document, - 'cwin' : window, - 'capp' : application, - 'cha ' : character, - 'atts' : attachment, - 'cpar' : paragraph, - 'cwor' : word, - 'catr' : attribute_run, - 'ctxt' : text, -} - - -class Terminal(Standard_Suite_Events, - Text_Suite_Events, - Terminal_Suite_Events, - aetools.TalkTo): - _signature = 'trmx' - - _moduleName = 'Terminal' - - _elemdict = application._elemdict - _propdict = application._propdict diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py b/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py deleted file mode 100644 index 2c722d9f5..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Manually generated suite used as base class for StdSuites Required and Standard -suites. This is needed because the events and enums in this suite belong -in the Required suite according to the Apple docs, but they often seem to be -in the Standard suite. -""" -import aetools -import builtin_Suite - - -_code_to_module = { - 'reqd' : builtin_Suite, - 'core' : builtin_Suite, -} - - - -_code_to_fullname = { - 'reqd' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), - 'core' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), -} - -from builtin_Suite import * - -class _builtinSuites(builtin_Suite_Events, - aetools.TalkTo): - _signature = 'ascr' diff --git a/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py b/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py deleted file mode 100644 index 318250fa2..000000000 --- a/sys/lib/python/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py +++ /dev/null @@ -1,140 +0,0 @@ -"""Suite builtin_Suite: Every application supports open, reopen, print, run, and quit -Level 1, version 1 -""" - -import aetools -import MacOS - -_code = 'aevt' - -class builtin_Suite_Events: - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run(self, _no_object=None, _attributes={}, **_arguments): - """run: Run an application. Most applications will open an empty, untitled window. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'oapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def reopen(self, _no_object=None, _attributes={}, **_arguments): - """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'rapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _print(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_quit = { - 'saving' : 'savo', - } - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit an application - Keyword argument saving: specifies whether to save currently open documents - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - aetools.keysubst(_arguments, self._argmap_quit) - if _no_object != None: raise TypeError, 'No direct arg expected' - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_close = { - 'saving' : 'savo', - 'saving_in' : 'kfil', - } - -_Enum_savo = { - 'yes' : 'yes ', # Save objects now - 'no' : 'no ', # Do not save objects - 'ask' : 'ask ', # Ask the user whether to save -} - -# -# Indices of types declared in this module -# -_classdeclarations = { -} - -_propdeclarations = { -} - -_compdeclarations = { -} - -_enumdeclarations = { - 'savo' : _Enum_savo, -} diff --git a/sys/lib/python/plat-mac/macerrors.py b/sys/lib/python/plat-mac/macerrors.py deleted file mode 100644 index ce2a11828..000000000 --- a/sys/lib/python/plat-mac/macerrors.py +++ /dev/null @@ -1,1852 +0,0 @@ -svTempDisable = -32768 #svTempDisable -svDisabled = -32640 #Reserve range -32640 to -32768 for Apple temp disables. -fontNotOutlineErr = -32615 #bitmap font passed to routine that does outlines only -kURL68kNotSupportedError = -30788 #kURL68kNotSupportedError -kURLAccessNotAvailableError = -30787 #kURLAccessNotAvailableError -kURLInvalidConfigurationError = -30786 #kURLInvalidConfigurationError -kURLExtensionFailureError = -30785 #kURLExtensionFailureError -kURLFileEmptyError = -30783 #kURLFileEmptyError -kURLInvalidCallError = -30781 #kURLInvalidCallError -kURLUnsettablePropertyError = -30780 #kURLUnsettablePropertyError -kURLPropertyBufferTooSmallError = -30779 #kURLPropertyBufferTooSmallError -kURLUnknownPropertyError = -30778 #kURLUnknownPropertyError -kURLPropertyNotYetKnownError = -30777 #kURLPropertyNotYetKnownError -kURLAuthenticationError = -30776 #kURLAuthenticationError -kURLServerBusyError = -30775 #kURLServerBusyError -kURLUnsupportedSchemeError = -30774 #kURLUnsupportedSchemeError -kURLInvalidURLError = -30773 #kURLInvalidURLError -kURLDestinationExistsError = -30772 #kURLDestinationExistsError -kURLProgressAlreadyDisplayedError = -30771 #kURLProgressAlreadyDisplayedError -kURLInvalidURLReferenceError = -30770 #kURLInvalidURLReferenceError -controlHandleInvalidErr = -30599 #controlHandleInvalidErr -controlInvalidDataVersionErr = -30597 #controlInvalidDataVersionErr -errItemNotControl = -30596 #errItemNotControl -errCantEmbedRoot = -30595 #errCantEmbedRoot -errCantEmbedIntoSelf = -30594 #errCantEmbedIntoSelf -errWindowRegionCodeInvalid = -30593 #errWindowRegionCodeInvalid -errControlHiddenOrDisabled = -30592 #errControlHiddenOrDisabled -errDataSizeMismatch = -30591 #errDataSizeMismatch -errControlIsNotEmbedder = -30590 #errControlIsNotEmbedder -errControlsAlreadyExist = -30589 #errControlsAlreadyExist -errInvalidPartCode = -30588 #errInvalidPartCode -errRootAlreadyExists = -30587 #errRootAlreadyExists -errNoRootControl = -30586 #errNoRootControl -errCouldntSetFocus = -30585 #errCouldntSetFocus -errUnknownControl = -30584 #errUnknownControl -errWindowDoesntSupportFocus = -30583 #errWindowDoesntSupportFocus -errControlDoesntSupportFocus = -30582 #errControlDoesntSupportFocus -errDataNotSupported = -30581 #errDataNotSupported -errMessageNotSupported = -30580 #errMessageNotSupported -themeMonitorDepthNotSupportedErr = -30567 #theme not supported at monitor depth -themeScriptFontNotFoundErr = -30566 #theme font requested for uninstalled script system -themeBadCursorIndexErr = -30565 #themeBadCursorIndexErr -themeHasNoAccentsErr = -30564 #themeHasNoAccentsErr -themeBadTextColorErr = -30563 #themeBadTextColorErr -themeProcessNotRegisteredErr = -30562 #themeProcessNotRegisteredErr -themeProcessRegisteredErr = -30561 #themeProcessRegisteredErr -themeInvalidBrushErr = -30560 #pattern index invalid -qtvrUninitialized = -30555 #qtvrUninitialized -qtvrLibraryLoadErr = -30554 #qtvrLibraryLoadErr -streamingNodeNotReadyErr = -30553 #streamingNodeNotReadyErr -noMemoryNodeFailedInitialize = -30552 #noMemoryNodeFailedInitialize -invalidHotSpotIDErr = -30551 #invalidHotSpotIDErr -invalidNodeFormatErr = -30550 #invalidNodeFormatErr -limitReachedErr = -30549 #limitReachedErr -settingNotSupportedByNodeErr = -30548 #settingNotSupportedByNodeErr -propertyNotSupportedByNodeErr = -30547 #propertyNotSupportedByNodeErr -timeNotInViewErr = -30546 #timeNotInViewErr -invalidViewStateErr = -30545 #invalidViewStateErr -invalidNodeIDErr = -30544 #invalidNodeIDErr -selectorNotSupportedByNodeErr = -30543 #selectorNotSupportedByNodeErr -callNotSupportedByNodeErr = -30542 #callNotSupportedByNodeErr -constraintReachedErr = -30541 #constraintReachedErr -notAQTVRMovieErr = -30540 #notAQTVRMovieErr -kFBCnoSuchHit = -30532 #kFBCnoSuchHit -kFBCbadSearchSession = -30531 #kFBCbadSearchSession -kFBCindexDiskIOFailed = -30530 #kFBCindexDiskIOFailed -kFBCsummarizationCanceled = -30529 #kFBCsummarizationCanceled -kFBCbadIndexFileVersion = -30528 #kFBCbadIndexFileVersion -kFBCanalysisNotAvailable = -30527 #kFBCanalysisNotAvailable -kFBCillegalSessionChange = -30526 #tried to add/remove vols to a session -kFBCsomeFilesNotIndexed = -30525 #kFBCsomeFilesNotIndexed -kFBCsearchFailed = -30524 #kFBCsearchFailed -kFBCindexNotAvailable = -30523 #kFBCindexNotAvailable -kFBCindexFileDestroyed = -30522 #kFBCindexFileDestroyed -kFBCaccessCanceled = -30521 #kFBCaccessCanceled -kFBCindexingCanceled = -30520 #kFBCindexingCanceled -kFBCnoSearchSession = -30519 #kFBCnoSearchSession -kFBCindexNotFound = -30518 #kFBCindexNotFound -kFBCflushFailed = -30517 #kFBCflushFailed -kFBCaddDocFailed = -30516 #kFBCaddDocFailed -kFBCaccessorStoreFailed = -30515 #kFBCaccessorStoreFailed -kFBCindexCreationFailed = -30514 #couldn't create index -kFBCmergingFailed = -30513 #couldn't merge index files -kFBCtokenizationFailed = -30512 #couldn't read from document or query -kFBCmoveFailed = -30511 #V-Twin exception caught -kFBCdeletionFailed = -30510 #V-Twin exception caught -kFBCcommitFailed = -30509 #V-Twin exception caught -kFBCindexingFailed = -30508 #V-Twin exception caught -kFBCvalidationFailed = -30507 #V-Twin exception caught -kFBCcompactionFailed = -30506 #V-Twin exception caught -kFBCbadIndexFile = -30505 #bad FSSpec, or bad data in file -kFBCfileNotIndexed = -30504 #kFBCfileNotIndexed -kFBCbadParam = -30503 #kFBCbadParam -kFBCallocFailed = -30502 #probably low memory -kFBCnoIndexesFound = -30501 #kFBCnoIndexesFound -kFBCvTwinExceptionErr = -30500 #no telling what it was -kDSpStereoContextErr = -30450 #kDSpStereoContextErr -kDSpInternalErr = -30449 #kDSpInternalErr -kDSpConfirmSwitchWarning = -30448 #kDSpConfirmSwitchWarning -kDSpFrameRateNotReadyErr = -30447 #kDSpFrameRateNotReadyErr -kDSpContextNotFoundErr = -30446 #kDSpContextNotFoundErr -kDSpContextNotReservedErr = -30445 #kDSpContextNotReservedErr -kDSpContextAlreadyReservedErr = -30444 #kDSpContextAlreadyReservedErr -kDSpInvalidAttributesErr = -30443 #kDSpInvalidAttributesErr -kDSpInvalidContextErr = -30442 #kDSpInvalidContextErr -kDSpSystemSWTooOldErr = -30441 #kDSpSystemSWTooOldErr -kDSpNotInitializedErr = -30440 #kDSpNotInitializedErr -kISpListBusyErr = -30429 #kISpListBusyErr -kISpDeviceActiveErr = -30428 #kISpDeviceActiveErr -kISpSystemActiveErr = -30427 #kISpSystemActiveErr -kISpDeviceInactiveErr = -30426 #kISpDeviceInactiveErr -kISpSystemInactiveErr = -30425 #kISpSystemInactiveErr -kISpElementNotInListErr = -30424 #kISpElementNotInListErr -kISpElementInListErr = -30423 #kISpElementInListErr -kISpBufferToSmallErr = -30422 #kISpBufferToSmallErr -kISpSystemListErr = -30421 #kISpSystemListErr -kISpInternalErr = -30420 #kISpInternalErr -kNSpJoinFailedErr = -30399 #kNSpJoinFailedErr -kNSpCantBlockErr = -30398 #kNSpCantBlockErr -kNSpMessageTooBigErr = -30397 #kNSpMessageTooBigErr -kNSpSendFailedErr = -30396 #kNSpSendFailedErr -kNSpConnectFailedErr = -30395 #kNSpConnectFailedErr -kNSpGameTerminatedErr = -30394 #kNSpGameTerminatedErr -kNSpTimeoutErr = -30393 #kNSpTimeoutErr -kNSpInvalidProtocolListErr = -30392 #kNSpInvalidProtocolListErr -kNSpInvalidProtocolRefErr = -30391 #kNSpInvalidProtocolRefErr -kNSpInvalidDefinitionErr = -30390 #kNSpInvalidDefinitionErr -kNSpAddPlayerFailedErr = -30389 #kNSpAddPlayerFailedErr -kNSpCreateGroupFailedErr = -30388 #kNSpCreateGroupFailedErr -kNSpNoHostVolunteersErr = -30387 #kNSpNoHostVolunteersErr -kNSpNoGroupsErr = -30386 #kNSpNoGroupsErr -kNSpNoPlayersErr = -30385 #kNSpNoPlayersErr -kNSpInvalidGroupIDErr = -30384 #kNSpInvalidGroupIDErr -kNSpInvalidPlayerIDErr = -30383 #kNSpInvalidPlayerIDErr -kNSpNameRequiredErr = -30382 #kNSpNameRequiredErr -kNSpFeatureNotImplementedErr = -30381 #kNSpFeatureNotImplementedErr -kNSpAddressInUseErr = -30380 #kNSpAddressInUseErr -kNSpRemovePlayerFailedErr = -30379 #kNSpRemovePlayerFailedErr -kNSpFreeQExhaustedErr = -30378 #kNSpFreeQExhaustedErr -kNSpInvalidAddressErr = -30377 #kNSpInvalidAddressErr -kNSpNotAdvertisingErr = -30376 #kNSpNotAdvertisingErr -kNSpAlreadyAdvertisingErr = -30374 #kNSpAlreadyAdvertisingErr -kNSpMemAllocationErr = -30373 #kNSpMemAllocationErr -kNSpOTVersionTooOldErr = -30371 #kNSpOTVersionTooOldErr -kNSpOTNotPresentErr = -30370 #kNSpOTNotPresentErr -kNSpInvalidParameterErr = -30369 #kNSpInvalidParameterErr -kNSpInvalidGameRefErr = -30367 #kNSpInvalidGameRefErr -kNSpProtocolNotAvailableErr = -30366 #kNSpProtocolNotAvailableErr -kNSpHostFailedErr = -30365 #kNSpHostFailedErr -kNSpPipeFullErr = -30364 #kNSpPipeFullErr -kNSpTopologyNotSupportedErr = -30362 #kNSpTopologyNotSupportedErr -kNSpAlreadyInitializedErr = -30361 #kNSpAlreadyInitializedErr -kNSpInitializationFailedErr = -30360 #kNSpInitializationFailedErr -kSSpScaleToZeroErr = -30344 #kSSpScaleToZeroErr -kSSpParallelUpVectorErr = -30343 #kSSpParallelUpVectorErr -kSSpCantInstallErr = -30342 #kSSpCantInstallErr -kSSpVersionErr = -30341 #kSSpVersionErr -kSSpInternalErr = -30340 #kSSpInternalErr -kALMInternalErr = -30049 #kALMInternalErr -kALMGroupNotFoundErr = -30048 #kALMGroupNotFoundErr -kALMNoSuchModuleErr = -30047 #kALMNoSuchModuleErr -kALMModuleCommunicationErr = -30046 #kALMModuleCommunicationErr -kALMDuplicateModuleErr = -30045 #kALMDuplicateModuleErr -kALMInstallationErr = -30044 #kALMInstallationErr -kALMDeferSwitchErr = -30043 #kALMDeferSwitchErr -kALMRebootFlagsLevelErr = -30042 #kALMRebootFlagsLevelErr -kLocalesDefaultDisplayStatus = -30029 #Requested display locale unavailable, used default -kLocalesTableFormatErr = -30002 #kLocalesTableFormatErr -kLocalesBufferTooSmallErr = -30001 #kLocalesBufferTooSmallErr -kFNSNameNotFoundErr = -29589 #The name with the requested paramters was not found -kFNSBadFlattenedSizeErr = -29587 #flattened size didn't match input or was too small -kFNSInsufficientDataErr = -29586 #insufficient data for the operation -kFNSMismatchErr = -29585 #reference didn't match or wasn't found in profile -kFNSDuplicateReferenceErr = -29584 #the ref. being added is already in the profile -kFNSBadProfileVersionErr = -29583 #profile version is out of known range -kFNSInvalidProfileErr = -29582 #profile is NULL or otherwise bad -kFNSBadReferenceVersionErr = -29581 #ref. version is out of known range -kFNSInvalidReferenceErr = -29580 #ref. was NULL or otherwise bad -kCollateInvalidCollationRef = -29507 #kCollateInvalidCollationRef -kCollateBufferTooSmall = -29506 #kCollateBufferTooSmall -kCollateInvalidChar = -29505 #kCollateInvalidChar -kCollatePatternNotFoundErr = -29504 #kCollatePatternNotFoundErr -kCollateUnicodeConvertFailedErr = -29503 #kCollateUnicodeConvertFailedErr -kCollateMissingUnicodeTableErr = -29502 #kCollateMissingUnicodeTableErr -kCollateInvalidOptions = -29501 #kCollateInvalidOptions -kCollateAttributesNotFoundErr = -29500 #kCollateAttributesNotFoundErr -kMPInvalidIDErr = -29299 #kMPInvalidIDErr -kMPInsufficientResourcesErr = -29298 #kMPInsufficientResourcesErr -kMPTaskAbortedErr = -29297 #kMPTaskAbortedErr -kMPTimeoutErr = -29296 #kMPTimeoutErr -kMPDeletedErr = -29295 #kMPDeletedErr -kMPBlueBlockingErr = -29293 #kMPBlueBlockingErr -kMPTaskStoppedErr = -29292 #A convention used with MPThrowException. -kMPTaskBlockedErr = -29291 #kMPTaskBlockedErr -kMPTaskCreatedErr = -29290 #kMPTaskCreatedErr -kMPProcessTerminatedErr = -29289 #kMPProcessTerminatedErr -kMPProcessCreatedErr = -29288 #kMPProcessCreatedErr -kMPPrivilegedErr = -29276 #kMPPrivilegedErr -kMPIterationEndErr = -29275 #kMPIterationEndErr -kUCTextBreakLocatorMissingType = -25341 #Unicode text break error -kUCOutputBufferTooSmall = -25340 #Output buffer too small for Unicode string result -errKCCreateChainFailed = -25318 #errKCCreateChainFailed -errKCDataNotModifiable = -25317 #errKCDataNotModifiable -errKCDataNotAvailable = -25316 #errKCDataNotAvailable -errKCInteractionRequired = -25315 #errKCInteractionRequired -errKCNoPolicyModule = -25314 #errKCNoPolicyModule -errKCNoCertificateModule = -25313 #errKCNoCertificateModule -errKCNoStorageModule = -25312 #errKCNoStorageModule -errKCKeySizeNotAllowed = -25311 #errKCKeySizeNotAllowed -errKCWrongKCVersion = -25310 #errKCWrongKCVersion -errKCReadOnlyAttr = -25309 #errKCReadOnlyAttr -errKCInteractionNotAllowed = -25308 #errKCInteractionNotAllowed -errKCNoDefaultKeychain = -25307 #errKCNoDefaultKeychain -errKCNoSuchClass = -25306 #errKCNoSuchClass -errKCInvalidSearchRef = -25305 #errKCInvalidSearchRef -errKCInvalidItemRef = -25304 #errKCInvalidItemRef -errKCNoSuchAttr = -25303 #errKCNoSuchAttr -errKCDataTooLarge = -25302 #errKCDataTooLarge -errKCBufferTooSmall = -25301 #errKCBufferTooSmall -errKCItemNotFound = -25300 #errKCItemNotFound -errKCDuplicateItem = -25299 #errKCDuplicateItem -errKCInvalidCallback = -25298 #errKCInvalidCallback -errKCDuplicateCallback = -25297 #errKCDuplicateCallback -errKCDuplicateKeychain = -25296 #errKCDuplicateKeychain -errKCInvalidKeychain = -25295 #errKCInvalidKeychain -errKCNoSuchKeychain = -25294 #errKCNoSuchKeychain -errKCAuthFailed = -25293 #errKCAuthFailed -errKCReadOnly = -25292 #errKCReadOnly -errKCNotAvailable = -25291 #errKCNotAvailable -printerStatusOpCodeNotSupportedErr = -25280 #printerStatusOpCodeNotSupportedErr -kTXNOutsideOfFrameErr = -22018 #kTXNOutsideOfFrameErr -kTXNOutsideOfLineErr = -22017 #kTXNOutsideOfLineErr -kTXNATSUIIsNotInstalledErr = -22016 #kTXNATSUIIsNotInstalledErr -kTXNDataTypeNotAllowedErr = -22015 #kTXNDataTypeNotAllowedErr -kTXNCopyNotAllowedInEchoModeErr = -22014 #kTXNCopyNotAllowedInEchoModeErr -kTXNCannotTurnTSMOffWhenUsingUnicodeErr = -22013 #kTXNCannotTurnTSMOffWhenUsingUnicodeErr -kTXNAlreadyInitializedErr = -22012 #kTXNAlreadyInitializedErr -kTXNInvalidRunIndex = -22011 #kTXNInvalidRunIndex -kTXNSomeOrAllTagsInvalidForRunErr = -22010 #kTXNSomeOrAllTagsInvalidForRunErr -kTXNAttributeTagInvalidForRunErr = -22009 #dataValue is set to this per invalid tag -kTXNNoMatchErr = -22008 #kTXNNoMatchErr -kTXNRunIndexOutofBoundsErr = -22007 #kTXNRunIndexOutofBoundsErr -kTXNCannotSetAutoIndentErr = -22006 #kTXNCannotSetAutoIndentErr -kTXNBadDefaultFileTypeWarning = -22005 #kTXNBadDefaultFileTypeWarning -kTXNUserCanceledOperationErr = -22004 #kTXNUserCanceledOperationErr -kTXNIllegalToCrossDataBoundariesErr = -22003 #kTXNIllegalToCrossDataBoundariesErr -kTXNInvalidFrameIDErr = -22002 #kTXNInvalidFrameIDErr -kTXNCannotAddFrameErr = -22001 #kTXNCannotAddFrameErr -kTXNEndIterationErr = -22000 #kTXNEndIterationErr -invalidIndexErr = -20002 #The recordIndex parameter is not valid. -recordDataTooBigErr = -20001 #The record data is bigger than buffer size (1024 bytes). -unknownInsertModeErr = -20000 #There is no such an insert mode. -kModemScriptMissing = -14002 #kModemScriptMissing -kModemPreferencesMissing = -14001 #kModemPreferencesMissing -kModemOutOfMemory = -14000 #kModemOutOfMemory -kHIDBaseError = -13950 #kHIDBaseError -kHIDNullStateErr = -13949 #kHIDNullStateErr -kHIDBufferTooSmallErr = -13948 #kHIDBufferTooSmallErr -kHIDValueOutOfRangeErr = -13947 #kHIDValueOutOfRangeErr -kHIDUsageNotFoundErr = -13946 #kHIDUsageNotFoundErr -kHIDNotValueArrayErr = -13945 #kHIDNotValueArrayErr -kHIDInvalidPreparsedDataErr = -13944 #kHIDInvalidPreparsedDataErr -kHIDIncompatibleReportErr = -13943 #kHIDIncompatibleReportErr -kHIDBadLogPhysValuesErr = -13942 #kHIDBadLogPhysValuesErr -kHIDInvalidReportTypeErr = -13941 #kHIDInvalidReportTypeErr -kHIDInvalidReportLengthErr = -13940 #kHIDInvalidReportLengthErr -kHIDNullPointerErr = -13939 #kHIDNullPointerErr -kHIDBadParameterErr = -13938 #kHIDBadParameterErr -kHIDNotEnoughMemoryErr = -13937 #kHIDNotEnoughMemoryErr -kHIDEndOfDescriptorErr = -13936 #kHIDEndOfDescriptorErr -kHIDUsagePageZeroErr = -13935 #kHIDUsagePageZeroErr -kHIDBadLogicalMinimumErr = -13934 #kHIDBadLogicalMinimumErr -kHIDBadLogicalMaximumErr = -13933 #kHIDBadLogicalMaximumErr -kHIDInvertedLogicalRangeErr = -13932 #kHIDInvertedLogicalRangeErr -kHIDInvertedPhysicalRangeErr = -13931 #kHIDInvertedPhysicalRangeErr -kHIDUnmatchedUsageRangeErr = -13930 #kHIDUnmatchedUsageRangeErr -kHIDInvertedUsageRangeErr = -13929 #kHIDInvertedUsageRangeErr -kHIDUnmatchedStringRangeErr = -13928 #kHIDUnmatchedStringRangeErr -kHIDUnmatchedDesignatorRangeErr = -13927 #kHIDUnmatchedDesignatorRangeErr -kHIDReportSizeZeroErr = -13926 #kHIDReportSizeZeroErr -kHIDReportCountZeroErr = -13925 #kHIDReportCountZeroErr -kHIDReportIDZeroErr = -13924 #kHIDReportIDZeroErr -kHIDInvalidRangePageErr = -13923 #kHIDInvalidRangePageErr -kHIDDeviceNotReady = -13910 #The device is still initializing, try again later -kHIDVersionIncompatibleErr = -13909 #kHIDVersionIncompatibleErr -debuggingNoMatchErr = -13887 #debugging component or option not found at this index -debuggingNoCallbackErr = -13886 #debugging component has no callback -debuggingInvalidNameErr = -13885 #componentName or optionName is invalid (NULL) -debuggingInvalidOptionErr = -13884 #optionSelectorNum is not registered -debuggingInvalidSignatureErr = -13883 #componentSignature not registered -debuggingDuplicateOptionErr = -13882 #optionSelectorNum already registered -debuggingDuplicateSignatureErr = -13881 #componentSignature already registered -debuggingExecutionContextErr = -13880 #routine cannot be called at this time -kBridgeSoftwareRunningCantSleep = -13038 #kBridgeSoftwareRunningCantSleep -kNoSuchPowerSource = -13020 #kNoSuchPowerSource -kProcessorTempRoutineRequiresMPLib2 = -13014 #kProcessorTempRoutineRequiresMPLib2 -kCantReportProcessorTemperatureErr = -13013 #kCantReportProcessorTemperatureErr -kPowerMgtRequestDenied = -13010 #kPowerMgtRequestDenied -kPowerMgtMessageNotHandled = -13009 #kPowerMgtMessageNotHandled -kPowerHandlerNotFoundForProcErr = -13008 #kPowerHandlerNotFoundForProcErr -kPowerHandlerNotFoundForDeviceErr = -13007 #kPowerHandlerNotFoundForDeviceErr -kPowerHandlerExistsForDeviceErr = -13006 #kPowerHandlerExistsForDeviceErr -pmRecvEndErr = -13005 #during receive, pmgr did not finish hs configured for this connection -pmRecvStartErr = -13004 #during receive, pmgr did not start hs -pmSendEndErr = -13003 #during send, pmgr did not finish hs -pmSendStartErr = -13002 #during send, pmgr did not start hs -pmReplyTOErr = -13001 #Timed out waiting for reply -pmBusyErr = -13000 #Power Mgr never ready to start handshake -pictureDataErr = -11005 #the picture data was invalid -colorsRequestedErr = -11004 #the number of colors requested was illegal -cantLoadPickMethodErr = -11003 #unable to load the custom pick proc -pictInfoVerbErr = -11002 #the passed verb was invalid -pictInfoIDErr = -11001 #the internal consistancy check for the PictInfoID is wrong -pictInfoVersionErr = -11000 #wrong version of the PictInfo structure -errTaskNotFound = -10780 #no task with that task id exists -telNotEnoughdspBW = -10116 #not enough real-time for allocation -telBadSampleRate = -10115 #incompatible sample rate -telBadSWErr = -10114 #Software not installed properly -telDetAlreadyOn = -10113 #detection is already turned on -telAutoAnsNotOn = -10112 #autoAnswer in not turned on -telValidateFailed = -10111 #telValidate failed -telBadProcID = -10110 #invalid procID -telDeviceNotFound = -10109 #device not found -telBadCodeResource = -10108 #code resource not found -telInitFailed = -10107 #initialization failed -telNoCommFolder = -10106 #Communications/Extensions € not found -telUnknownErr = -10103 #unable to set config -telNoSuchTool = -10102 #unable to find tool with name specified -telBadFunction = -10091 #bad msgCode specified -telPBErr = -10090 #parameter block error, bad format -telCANotDeflectable = -10082 #CA not "deflectable" -telCANotRejectable = -10081 #CA not "rejectable" -telCANotAcceptable = -10080 #CA not "acceptable" -telTermNotOpen = -10072 #terminal not opened via TELOpenTerm -telStillNeeded = -10071 #terminal driver still needed by someone else -telAlreadyOpen = -10070 #terminal already open -telNoCallbackRef = -10064 #no call back reference was specified, but is required -telDisplayModeNotSupp = -10063 #display mode not supported by tool -telBadDisplayMode = -10062 #bad display mode specified -telFwdTypeNotSupp = -10061 #forward type not supported by tool -telDNTypeNotSupp = -10060 #DN type not supported by tool -telBadRate = -10059 #bad rate specified -telBadBearerType = -10058 #bad bearerType specified -telBadSelect = -10057 #unable to select or deselect DN -telBadParkID = -10056 #bad park id specified -telBadPickupGroupID = -10055 #bad pickup group ID specified -telBadFwdType = -10054 #bad fwdType specified -telBadFeatureID = -10053 #bad feature ID specified -telBadIntercomID = -10052 #bad intercom ID specified -telBadPageID = -10051 #bad page ID specified -telBadDNType = -10050 #DN type invalid -telConfLimitExceeded = -10047 #attempt to exceed switch conference limits -telCBErr = -10046 #call back feature not set previously -telTransferRej = -10045 #transfer request rejected -telTransferErr = -10044 #transfer not prepared -telConfRej = -10043 #conference request was rejected -telConfErr = -10042 #conference was not prepared -telConfNoLimit = -10041 #no limit was specified but required -telConfLimitErr = -10040 #limit specified is too high for this configuration -telFeatNotSupp = -10033 #feature program call not supported by this tool -telFeatActive = -10032 #feature already active -telFeatNotAvail = -10031 #feature subscribed but not available -telFeatNotSub = -10030 #feature not subscribed -errAEPropertiesClash = -10025 #illegal combination of properties settings for Set Data, make new, or duplicate -errAECantPutThatThere = -10024 #in make new, duplicate, etc. class can't be an element of container -errAENotAnEnumMember = -10023 #enumerated value in SetData is not allowed for this property -telIntExtNotSupp = -10022 #internal external type not supported by this tool -telBadIntExt = -10021 #bad internal external error -telStateNotSupp = -10020 #device state not supported by tool -telBadStateErr = -10019 #bad device state specified -telIndexNotSupp = -10018 #index not supported by this tool -telBadIndex = -10017 #bad index specified -telAPattNotSupp = -10016 #alerting pattern not supported by tool -telBadAPattErr = -10015 #bad alerting pattern specified -telVTypeNotSupp = -10014 #volume type not supported by this tool -telBadVTypeErr = -10013 #bad volume type error -telBadLevelErr = -10012 #bad volume level setting -telHTypeNotSupp = -10011 #hook type not supported by this tool -telBadHTypeErr = -10010 #bad hook type specified -errAECantSupplyType = -10009 #errAECantSupplyType -telNoOpenErr = -10008 #unable to open terminal -telNoMemErr = -10007 #no memory to allocate handle -errOSACantAssign = -10006 #Signaled when an object cannot be set in a container. -telBadProcErr = -10005 #bad msgProc specified -telBadHandErr = -10004 #bad handle specified -OSAIllegalAssign = -10003 #Signaled when an object can never be set in a container -telBadDNErr = -10002 #TELDNHandle not found or invalid -telBadTermErr = -10001 #invalid TELHandle or handle not found -errAEEventFailed = -10000 #errAEEventFailed -cannotMoveAttachedController = -9999 #cannotMoveAttachedController -controllerHasFixedHeight = -9998 #controllerHasFixedHeight -cannotSetWidthOfAttachedController = -9997 #cannotSetWidthOfAttachedController -controllerBoundsNotExact = -9996 #controllerBoundsNotExact -editingNotAllowed = -9995 #editingNotAllowed -badControllerHeight = -9994 #badControllerHeight -deviceCantMeetRequest = -9408 #deviceCantMeetRequest -seqGrabInfoNotAvailable = -9407 #seqGrabInfoNotAvailable -badSGChannel = -9406 #badSGChannel -couldntGetRequiredComponent = -9405 #couldntGetRequiredComponent -notEnoughDiskSpaceToGrab = -9404 #notEnoughDiskSpaceToGrab -notEnoughMemoryToGrab = -9403 #notEnoughMemoryToGrab -cantDoThatInCurrentMode = -9402 #cantDoThatInCurrentMode -grabTimeComplete = -9401 #grabTimeComplete -noDeviceForChannel = -9400 #noDeviceForChannel -kNoCardBusCISErr = -9109 #No valid CIS exists for this CardBus card -kNotZVCapableErr = -9108 #This socket does not support Zoomed Video -kCardPowerOffErr = -9107 #Power to the card has been turned off -kAttemptDupCardEntryErr = -9106 #The Enabler was asked to create a duplicate card entry -kAlreadySavedStateErr = -9105 #The state has been saved on previous call -kTooManyIOWindowsErr = -9104 #device requested more than one I/O window -kNotReadyErr = -9103 #PC Card failed to go ready -kClientRequestDenied = -9102 #CS Clients should return this code inorder to -kNoCompatibleNameErr = -9101 #There is no compatible driver name for this device -kNoEnablerForCardErr = -9100 #No Enablers were found that can support the card -kNoCardEnablersFoundErr = -9099 #No Enablers were found -kUnsupportedCardErr = -9098 #Card not supported by generic enabler -kNoClientTableErr = -9097 #The client table has not be initialized yet -kNoMoreInterruptSlotsErr = -9096 #All internal Interrupt slots are in use -kNoMoreTimerClientsErr = -9095 #All timer callbacks are in use -kNoIOWindowRequestedErr = -9094 #Request I/O window before calling configuration -kBadCustomIFIDErr = -9093 #Custom interface ID is invalid -kBadTupleDataErr = -9092 #Data in tuple is invalid -kInvalidCSClientErr = -9091 #Card Services ClientID is not registered -kUnsupportedVsErr = -9090 #Unsupported Voltage Sense -kInvalidDeviceNumber = -9089 #kInvalidDeviceNumber -kPostCardEventErr = -9088 #_PCCSLPostCardEvent failed and dropped an event -kCantConfigureCardErr = -9087 #kCantConfigureCardErr -kPassCallToChainErr = -9086 #kPassCallToChainErr -kCardBusCardErr = -9085 #kCardBusCardErr -k16BitCardErr = -9084 #k16BitCardErr -kBadDeviceErr = -9083 #kBadDeviceErr -kBadLinkErr = -9082 #kBadLinkErr -kInvalidRegEntryErr = -9081 #kInvalidRegEntryErr -kNoCardSevicesSocketsErr = -9080 #kNoCardSevicesSocketsErr -kOutOfResourceErr = -9079 #Card Services has exhausted the resource -kNoMoreItemsErr = -9078 #there are no more of the requested item -kInUseErr = -9077 #requested resource is being used by a client -kConfigurationLockedErr = -9076 #a configuration has already been locked -kWriteProtectedErr = -9075 #media is write-protected -kBusyErr = -9074 #unable to process request at this time - try later -kUnsupportedModeErr = -9073 #mode is not supported -kUnsupportedFunctionErr = -9072 #function is not supported by this implementation -kNoCardErr = -9071 #no PC card in the socket -kGeneralFailureErr = -9070 #an undefined error has occurred -kWriteFailureErr = -9069 #unable to complete write request -kReadFailureErr = -9068 #unable to complete read request -kBadSpeedErr = -9067 #specified speed is unavailable -kBadCISErr = -9066 #CIS on card is invalid -kBadHandleErr = -9065 #clientHandle is invalid -kBadArgsErr = -9064 #values in argument packet are invalid -kBadArgLengthErr = -9063 #ArgLength argument is invalid -kBadWindowErr = -9062 #specified window is invalid -kBadVppErr = -9061 #specified Vpp1 or Vpp2 power level index is invalid -kBadVccErr = -9060 #specified Vcc power level index is invalid -kBadTypeErr = -9059 #specified window or interface type is invalid -kBadSocketErr = -9058 #specified logical or physical socket number is invalid -kBadSizeErr = -9057 #specified size is invalid -kBadPageErr = -9056 #specified page is invalid -kBadOffsetErr = -9055 #specified PC card memory array offset is invalid -kBadIRQErr = -9054 #specified IRQ level is invalid -kBadEDCErr = -9053 #specified EDC generator specified is invalid -kBadBaseErr = -9052 #specified base system memory address is invalid -kBadAttributeErr = -9051 #specified attributes field value is invalid -kBadAdapterErr = -9050 #invalid adapter number -codecOffscreenFailedPleaseRetryErr = -8992 #codecOffscreenFailedPleaseRetryErr -lockPortBitsWrongGDeviceErr = -8991 #lockPortBitsWrongGDeviceErr -directXObjectAlreadyExists = -8990 #directXObjectAlreadyExists -codecDroppedFrameErr = -8989 #returned from ImageCodecDrawBand -codecOffscreenFailedErr = -8988 #codecOffscreenFailedErr -codecNeedAccessKeyErr = -8987 #codec needs password in order to decompress -codecParameterDialogConfirm = -8986 #codecParameterDialogConfirm -lockPortBitsSurfaceLostErr = -8985 #lockPortBitsSurfaceLostErr -lockPortBitsBadPortErr = -8984 #lockPortBitsBadPortErr -lockPortBitsWindowClippedErr = -8983 #lockPortBitsWindowClippedErr -lockPortBitsWindowResizedErr = -8982 #lockPortBitsWindowResizedErr -lockPortBitsWindowMovedErr = -8981 #lockPortBitsWindowMovedErr -lockPortBitsBadSurfaceErr = -8980 #lockPortBitsBadSurfaceErr -codecNeedToFlushChainErr = -8979 #codecNeedToFlushChainErr -codecDisabledErr = -8978 #codec disabled itself -- pass codecFlagReenable to reset -codecNoMemoryPleaseWaitErr = -8977 #codecNoMemoryPleaseWaitErr -codecNothingToBlitErr = -8976 #codecNothingToBlitErr -codecCantQueueErr = -8975 #codecCantQueueErr -codecCantWhenErr = -8974 #codecCantWhenErr -codecOpenErr = -8973 #codecOpenErr -codecConditionErr = -8972 #codecConditionErr -codecExtensionNotFoundErr = -8971 #codecExtensionNotFoundErr -codecDataVersErr = -8970 #codecDataVersErr -codecBadDataErr = -8969 #codecBadDataErr -codecWouldOffscreenErr = -8968 #codecWouldOffscreenErr -codecAbortErr = -8967 #codecAbortErr -codecSpoolErr = -8966 #codecSpoolErr -codecImageBufErr = -8965 #codecImageBufErr -codecScreenBufErr = -8964 #codecScreenBufErr -codecSizeErr = -8963 #codecSizeErr -codecUnimpErr = -8962 #codecUnimpErr -noCodecErr = -8961 #noCodecErr -codecErr = -8960 #codecErr -kIllegalClockValueErr = -8852 #kIllegalClockValueErr -kUTCOverflowErr = -8851 #kUTCOverflowErr -kUTCUnderflowErr = -8850 #kUTCUnderflowErr -kATSULastErr = -8809 #The last ATSUI error code. -kATSULineBreakInWord = -8808 #This is not an error code but is returned by ATSUBreakLine to -kATSUCoordinateOverflowErr = -8807 #Used to indicate the coordinates provided to an ATSUI routine caused -kATSUNoFontScalerAvailableErr = -8806 #Used when no font scaler is available for the font passed -kATSUNoFontCmapAvailableErr = -8805 #Used when no CMAP table can be accessed or synthesized for the -kATSULowLevelErr = -8804 #Used when an error was encountered within the low level ATS -kATSUQuickDrawTextErr = -8803 #Used when QuickDraw Text encounters an error rendering or measuring -kATSUNoStyleRunsAssignedErr = -8802 #Used when an attempt was made to measure, highlight or draw -kATSUNotSetErr = -8801 #Used when the client attempts to retrieve an attribute, -kATSUInvalidCacheErr = -8800 #Used when an attempt was made to read in style data -kATSUInvalidAttributeTagErr = -8799 #Used when an attempt was made to use a tag value that -kATSUInvalidAttributeSizeErr = -8798 #Used when an attempt was made to use an attribute with a -kATSUInvalidAttributeValueErr = -8797 #Used when an attempt was made to use an attribute with -kATSUInvalidFontErr = -8796 #Used when an attempt was made to use an invalid font ID. -kATSUNoCorrespondingFontErr = -8795 #This value is retrned by font ID conversion -kATSUFontsNotMatched = -8794 #This value is returned by ATSUMatchFontsToText() -kATSUFontsMatched = -8793 #This is not an error code but is returned by -kATSUInvalidTextRangeErr = -8792 #An attempt was made to extract information -kATSUInvalidStyleErr = -8791 #An attempt was made to use a ATSUStyle which -kATSUInvalidTextLayoutErr = -8790 #An attempt was made to use a ATSUTextLayout -kTECOutputBufferFullStatus = -8785 #output buffer has no room for conversion of next input text element (partial conversion) -kTECNeedFlushStatus = -8784 #kTECNeedFlushStatus -kTECUsedFallbacksStatus = -8783 #kTECUsedFallbacksStatus -kTECItemUnavailableErr = -8771 #item (e.g. name) not available for specified region (& encoding if relevant) -kTECGlobalsUnavailableErr = -8770 #globals have already been deallocated (premature TERM) -unicodeChecksumErr = -8769 #unicodeChecksumErr -unicodeNoTableErr = -8768 #unicodeNoTableErr -unicodeVariantErr = -8767 #unicodeVariantErr -unicodeFallbacksErr = -8766 #unicodeFallbacksErr -unicodePartConvertErr = -8765 #unicodePartConvertErr -unicodeBufErr = -8764 #unicodeBufErr -unicodeCharErr = -8763 #unicodeCharErr -unicodeElementErr = -8762 #unicodeElementErr -unicodeNotFoundErr = -8761 #unicodeNotFoundErr -unicodeTableFormatErr = -8760 #unicodeTableFormatErr -unicodeDirectionErr = -8759 #unicodeDirectionErr -unicodeContextualErr = -8758 #unicodeContextualErr -unicodeTextEncodingDataErr = -8757 #unicodeTextEncodingDataErr -kTECDirectionErr = -8756 #direction stack overflow, etc. -kTECIncompleteElementErr = -8755 #text element may be incomplete or is too long for internal buffers -kTECUnmappableElementErr = -8754 #kTECUnmappableElementErr -kTECPartialCharErr = -8753 #input buffer ends in the middle of a multibyte character, conversion stopped -kTECBadTextRunErr = -8752 #kTECBadTextRunErr -kTECArrayFullErr = -8751 #supplied name buffer or TextRun, TextEncoding, or UnicodeMapping array is too small -kTECBufferBelowMinimumSizeErr = -8750 #output buffer too small to allow processing of first input text element -kTECNoConversionPathErr = -8749 #kTECNoConversionPathErr -kTECCorruptConverterErr = -8748 #invalid converter object reference -kTECTableFormatErr = -8747 #kTECTableFormatErr -kTECTableChecksumErr = -8746 #kTECTableChecksumErr -kTECMissingTableErr = -8745 #kTECMissingTableErr -kTextUndefinedElementErr = -8740 #text conversion errors -kTextMalformedInputErr = -8739 #in DBCS, for example, high byte followed by invalid low byte -kTextUnsupportedEncodingErr = -8738 #specified encoding not supported for this operation -kRANotEnabled = -7139 #kRANotEnabled -kRACallBackFailed = -7138 #kRACallBackFailed -kRADuplicateIPAddr = -7137 #kRADuplicateIPAddr -kRANCPRejectedbyPeer = -7136 #kRANCPRejectedbyPeer -kRAExtAuthenticationFailed = -7135 #kRAExtAuthenticationFailed -kRAATalkInactive = -7134 #kRAATalkInactive -kRAPeerNotResponding = -7133 #kRAPeerNotResponding -kRAPPPPeerDisconnected = -7132 #kRAPPPPeerDisconnected -kRAPPPUserDisconnected = -7131 #kRAPPPUserDisconnected -kRAPPPNegotiationFailed = -7130 #kRAPPPNegotiationFailed -kRAPPPAuthenticationFailed = -7129 #kRAPPPAuthenticationFailed -kRAPPPProtocolRejected = -7128 #kRAPPPProtocolRejected -dcmBufferOverflowErr = -7127 #data is larger than buffer size -kRANotPrimaryInterface = -7126 #when IPCP is not primary TCP/IP intf. -kRATCPIPNotConfigured = -7125 #TCP/IP not configured, could be loaded -kRATCPIPInactive = -7124 #TCP/IP inactive, cannot be loaded -kRARemoteAccessNotReady = -7123 #kRARemoteAccessNotReady -kRAInitOpenTransportFailed = -7122 #kRAInitOpenTransportFailed -dcmProtectedErr = -7121 #need keyword to use dictionary -kRAUserPwdEntryRequired = -7120 #kRAUserPwdEntryRequired -kRAUserPwdChangeRequired = -7119 #kRAUserPwdChangeRequired -dcmBadFindMethodErr = -7118 #no such find method supported -kRAInvalidSerialProtocol = -7117 #kRAInvalidSerialProtocol -kRAInvalidPortState = -7116 #kRAInvalidPortState -dcmBadKeyErr = -7115 #bad key information -kRAPortBusy = -7114 #kRAPortBusy -kRAInstallationDamaged = -7113 #kRAInstallationDamaged -dcmBadFieldTypeErr = -7112 #no such field type supported -dcmBadFieldInfoErr = -7111 #incomplete information -dcmNecessaryFieldErr = -7110 #lack required/identify field -dcmDupRecordErr = -7109 #same record already exist -kRANotConnected = -7108 #kRANotConnected -dcmBlockFullErr = -7107 #dictionary block full -kRAMissingResources = -7106 #kRAMissingResources -dcmDictionaryBusyErr = -7105 #dictionary is busy -dcmDictionaryNotOpenErr = -7104 #dictionary not opened -dcmPermissionErr = -7103 #invalid permission -dcmBadDictionaryErr = -7102 #invalid dictionary -dcmNotDictionaryErr = -7101 #not dictionary -kRAInvalidParameter = -7100 #kRAInvalidParameter -laEngineNotFoundErr = -7000 #can't find the engine -laPropertyErr = -6999 #Error in properties -kUSBUnknownDeviceErr = -6998 #device ref not recognised -laPropertyIsReadOnlyErr = -6997 #the property is read only -laPropertyUnknownErr = -6996 #the property is unknown to this environment -laPropertyValueErr = -6995 #Invalid property value -laDictionaryTooManyErr = -6994 #too many dictionaries -laDictionaryUnknownErr = -6993 #can't use this dictionary with this environment -laDictionaryNotOpenedErr = -6992 #the dictionary is not opened -laTextOverFlowErr = -6991 #text is too long -laFailAnalysisErr = -6990 #analysis failed -laNoMoreMorphemeErr = -6989 #nothing to read -laInvalidPathErr = -6988 #path is not correct -kUSBNotHandled = -6987 #Notification was not handled (same as NotFound) -laEnvironmentNotFoundErr = -6986 #can't fint the specified environment -laEnvironmentBusyErr = -6985 #specified environment is used -laTooSmallBufferErr = -6984 #output buffer is too small to store any result -kUSBFlagsError = -6983 #Unused flags not zeroed -kUSBAbortedError = -6982 #Pipe aborted -kUSBNoBandwidthError = -6981 #Not enough bandwidth available -kUSBPipeIdleError = -6980 #Pipe is Idle, it will not accept transactions -kUSBPipeStalledError = -6979 #Pipe has stalled, error needs to be cleared -kUSBUnknownInterfaceErr = -6978 #Interface ref not recognised -kUSBDeviceBusy = -6977 #Device is already being configured -kUSBDevicePowerProblem = -6976 #Device has a power problem -kUSBInvalidBuffer = -6975 #bad buffer, usually nil -kUSBDeviceSuspended = -6974 #Device is suspended -kUSBDeviceNotSuspended = -6973 #device is not suspended for resume -kUSBDeviceDisconnected = -6972 #Disconnected during suspend or reset -kUSBTimedOut = -6971 #Transaction timed out. -kUSBQueueAborted = -6970 #Pipe zero stall cleared. -kUSBPortDisabled = -6969 #The port you are attached to is disabled, use USBDeviceReset. -kUSBBadDispatchTable = -6950 #Improper driver dispatch table -kUSBUnknownNotification = -6949 #Notification type not defined -kUSBQueueFull = -6948 #Internal queue maxxed -kUSBLinkErr = -6916 #kUSBLinkErr -kUSBCRCErr = -6915 #Pipe stall, bad CRC -kUSBBitstufErr = -6914 #Pipe stall, bitstuffing -kUSBDataToggleErr = -6913 #Pipe stall, Bad data toggle -kUSBEndpointStallErr = -6912 #Device didn't understand -kUSBNotRespondingErr = -6911 #Pipe stall, No device, device hung -kUSBPIDCheckErr = -6910 #Pipe stall, PID CRC error -kUSBWrongPIDErr = -6909 #Pipe stall, Bad or wrong PID -kUSBOverRunErr = -6908 #Packet too large or more data than buffer -kUSBUnderRunErr = -6907 #Less data than buffer -kUSBRes1Err = -6906 #kUSBRes1Err -kUSBRes2Err = -6905 #kUSBRes2Err -kUSBBufOvrRunErr = -6904 #Host hardware failure on data in, PCI busy? -kUSBBufUnderRunErr = -6903 #Host hardware failure on data out, PCI busy? -kUSBNotSent1Err = -6902 #Transaction not sent -kUSBNotSent2Err = -6901 #Transaction not sent -kDMFoundErr = -6232 #Did not proceed because we found an item -kDMMainDisplayCannotMoveErr = -6231 #Trying to move main display (or a display mirrored to it) -kDMDisplayAlreadyInstalledErr = -6230 #Attempt to add an already installed display. -kDMDisplayNotFoundErr = -6229 #Could not find item (will someday remove). -kDMDriverNotDisplayMgrAwareErr = -6228 #Video Driver does not support display manager. -kDMSWNotInitializedErr = -6227 #Required software not initialized (eg windowmanager or display mgr). -kSysSWTooOld = -6226 #Missing critical pieces of System Software. -kDMMirroringNotOn = -6225 #Returned by all calls that need mirroring to be on to do their thing. -kDMCantBlock = -6224 #Mirroring is already on, canÕt Block now (call DMUnMirror() first). -kDMMirroringBlocked = -6223 #DMBlockMirroring() has been called. -kDMWrongNumberOfDisplays = -6222 #Can only handle 2 displays for now. -kDMMirroringOnAlready = -6221 #Returned by all calls that need mirroring to be off to do their thing. -kDMGenErr = -6220 #Unexpected Error -kQTSSUnknownErr = -6150 #kQTSSUnknownErr -collectionVersionErr = -5753 #collectionVersionErr -collectionIndexRangeErr = -5752 #collectionIndexRangeErr -collectionItemNotFoundErr = -5751 #collectionItemNotFoundErr -collectionItemLockedErr = -5750 #collectionItemLockedErr -kNavMissingKindStringErr = -5699 #kNavMissingKindStringErr -kNavInvalidCustomControlMessageErr = -5698 #kNavInvalidCustomControlMessageErr -kNavCustomControlMessageFailedErr = -5697 #kNavCustomControlMessageFailedErr -kNavInvalidSystemConfigErr = -5696 #kNavInvalidSystemConfigErr -kNavWrongDialogClassErr = -5695 #kNavWrongDialogClassErr -kNavWrongDialogStateErr = -5694 #kNavWrongDialogStateErr -dialogNoTimeoutErr = -5640 #dialogNoTimeoutErr -menuInvalidErr = -5623 #menu is invalid -menuItemNotFoundErr = -5622 #specified menu item wasn't found -menuUsesSystemDefErr = -5621 #GetMenuDefinition failed because the menu uses the system MDEF -menuNotFoundErr = -5620 #specified menu or menu ID wasn't found -windowWrongStateErr = -5615 #window is not in a state that is valid for the current action -windowManagerInternalErr = -5614 #something really weird happened inside the window manager -windowAttributesConflictErr = -5613 #passed some attributes that are mutually exclusive -windowAttributeImmutableErr = -5612 #tried to change attributes which can't be changed -errWindowDoesNotFitOnscreen = -5611 #ConstrainWindowToScreen could not make the window fit onscreen -errWindowNotFound = -5610 #returned from FindWindowOfClass -errFloatingWindowsNotInitialized = -5609 #called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows -errWindowsAlreadyInitialized = -5608 #tried to call InitFloatingWindows twice, or called InitWindows and then floating windows -errUserWantsToDragWindow = -5607 #if returned from TrackWindowProxyDrag, you should call DragWindow on the window -errCorruptWindowDescription = -5606 #tried to load a corrupt window description (size or version fields incorrect) -errUnrecognizedWindowClass = -5605 #tried to create a window with a bad WindowClass -errWindowPropertyNotFound = -5604 #tried to get a nonexistent property -errInvalidWindowProperty = -5603 #tried to access a property tag with private creator -errWindowDoesNotHaveProxy = -5602 #tried to do something requiring a proxy to a window which doesnÕt have a proxy -errUnsupportedWindowAttributesForClass = -5601 #tried to create a window with WindowAttributes not supported by the WindowClass -errInvalidWindowPtr = -5600 #tried to pass a bad WindowRef argument -gestaltLocationErr = -5553 #gestalt function ptr wasn't in sysheap -gestaltDupSelectorErr = -5552 #tried to add an entry that already existed -gestaltUndefSelectorErr = -5551 #undefined selector was passed to Gestalt -gestaltUnknownErr = -5550 #value returned if Gestalt doesn't know the answer -envVersTooBig = -5502 #Version bigger than call can handle -envBadVers = -5501 #Version non-positive -envNotPresent = -5500 #returned by glue. -qtsAddressBusyErr = -5421 #qtsAddressBusyErr -qtsConnectionFailedErr = -5420 #qtsConnectionFailedErr -qtsTimeoutErr = -5408 #qtsTimeoutErr -qtsUnknownValueErr = -5407 #qtsUnknownValueErr -qtsTooMuchDataErr = -5406 #qtsTooMuchDataErr -qtsUnsupportedFeatureErr = -5405 #qtsUnsupportedFeatureErr -qtsUnsupportedRateErr = -5404 #qtsUnsupportedRateErr -qtsUnsupportedDataTypeErr = -5403 #qtsUnsupportedDataTypeErr -qtsBadDataErr = -5402 #something is wrong with the data -qtsBadStateErr = -5401 #qtsBadStateErr -qtsBadSelectorErr = -5400 #qtsBadSelectorErr -errIAEndOfTextRun = -5388 #errIAEndOfTextRun -errIATextExtractionErr = -5387 #errIATextExtractionErr -errIAInvalidDocument = -5386 #errIAInvalidDocument -errIACanceled = -5385 #errIACanceled -errIABufferTooSmall = -5384 #errIABufferTooSmall -errIANoMoreItems = -5383 #errIANoMoreItems -errIAParamErr = -5382 #errIAParamErr -errIAAllocationErr = -5381 #errIAAllocationErr -errIAUnknownErr = -5380 #errIAUnknownErr -hrURLNotHandledErr = -5363 #hrURLNotHandledErr -hrUnableToResizeHandleErr = -5362 #hrUnableToResizeHandleErr -hrMiscellaneousExceptionErr = -5361 #hrMiscellaneousExceptionErr -hrHTMLRenderingLibNotInstalledErr = -5360 #hrHTMLRenderingLibNotInstalledErr -errCannotUndo = -5253 #errCannotUndo -errNonContiuousAttribute = -5252 #errNonContiuousAttribute -errUnknownElement = -5251 #errUnknownElement -errReadOnlyText = -5250 #errReadOnlyText -errEmptyScrap = -5249 #errEmptyScrap -errNoHiliteText = -5248 #errNoHiliteText -errOffsetNotOnElementBounday = -5247 #errOffsetNotOnElementBounday -errInvalidRange = -5246 #errInvalidRange -errIteratorReachedEnd = -5245 #errIteratorReachedEnd -errEngineNotFound = -5244 #errEngineNotFound -errAlreadyInImagingMode = -5243 #errAlreadyInImagingMode -errNotInImagingMode = -5242 #errNotInImagingMode -errMarginWilllNotFit = -5241 #errMarginWilllNotFit -errUnknownAttributeTag = -5240 #errUnknownAttributeTag -afpSameNodeErr = -5063 #An Attempt was made to connect to a file server running on the same machine -afpAlreadyMounted = -5062 #The volume is already mounted -afpCantMountMoreSrvre = -5061 #The Maximum number of server connections has been reached -afpBadDirIDType = -5060 #afpBadDirIDType -afpCallNotAllowed = -5048 #The server knows what you wanted to do, but won't let you do it just now -afpAlreadyLoggedInErr = -5047 #User has been authenticated but is already logged in from another machine (and that's not allowed on this server) -afpPwdPolicyErr = -5046 #Password does not conform to servers password policy -afpPwdNeedsChangeErr = -5045 #The password needs to be changed -afpInsideTrashErr = -5044 #The folder being shared is inside the trash folder OR the shared folder is being moved into the trash folder -afpInsideSharedErr = -5043 #The folder being shared is inside a shared folder OR the folder contains a shared folder and is being moved into a shared folder -afpPwdExpiredErr = -5042 #The password being used is too old: this requires the user to change the password before log-in can continue -afpPwdTooShortErr = -5041 #The password being set is too short: there is a minimum length that must be met or exceeded -afpPwdSameErr = -5040 #Someone tried to change their password to the same password on a mantadory password change -afpBadIDErr = -5039 #afpBadIDErr -afpSameObjectErr = -5038 #afpSameObjectErr -afpCatalogChanged = -5037 #afpCatalogChanged -afpDiffVolErr = -5036 #afpDiffVolErr -afpIDExists = -5035 #afpIDExists -afpIDNotFound = -5034 #afpIDNotFound -afpContainsSharedErr = -5033 #the folder being shared contains a shared folder -afpObjectLocked = -5032 #Object is M/R/D/W inhibited -afpVolLocked = -5031 #Volume is Read-Only -afpIconTypeError = -5030 #Icon size specified different from existing icon size -afpDirNotFound = -5029 #Unknown directory specified -afpCantRename = -5028 #AFPRename cannot rename volume -afpServerGoingDown = -5027 #Server is shutting down -afpTooManyFilesOpen = -5026 #Maximum open file count reached -afpObjectTypeErr = -5025 #File/Directory specified where Directory/File expected -afpCallNotSupported = -5024 #Unsupported AFP call was made -afpUserNotAuth = -5023 #No AFPLogin call has successfully been made for this session -afpSessClosed = -5022 #Session closed -afpRangeOverlap = -5021 #Some or all of range already locked by same user -afpRangeNotLocked = -5020 #Tried to unlock range that was not locked by user -afpParmErr = -5019 #A specified parameter was out of allowable range -afpObjectNotFound = -5018 #Specified file or directory does not exist -afpObjectExists = -5017 #Specified destination file or directory already exists -afpNoServer = -5016 #Server not responding -afpNoMoreLocks = -5015 #Maximum lock limit reached -afpMiscErr = -5014 #Unexpected error encountered during execution -afpLockErr = -5013 #Some or all of requested range is locked by another user -afpItemNotFound = -5012 #Unknown UserName/UserID or missing comment/APPL entry -afpFlatVol = -5011 #Cannot create directory on specified volume -afpFileBusy = -5010 #Cannot delete an open file -afpEofError = -5009 #Read beyond logical end-of-file -afpDiskFull = -5008 #Insufficient free space on volume for operation -afpDirNotEmpty = -5007 #Cannot delete non-empty directory -afpDenyConflict = -5006 #Specified open/deny modes conflict with current open modes -afpCantMove = -5005 #Move destination is offspring of source, or root was specified -afpBitmapErr = -5004 #Bitmap contained bits undefined for call -afpBadVersNum = -5003 #Unknown AFP protocol version number specified -afpBadUAM = -5002 #Unknown user authentication method specified -afpAuthContinue = -5001 #Further information required to complete AFPLogin call -afpAccessDenied = -5000 #Insufficient access privileges for operation -illegalScrapFlavorSizeErr = -4999 #illegalScrapFlavorSizeErr -illegalScrapFlavorTypeErr = -4998 #illegalScrapFlavorTypeErr -illegalScrapFlavorFlagsErr = -4997 #illegalScrapFlavorFlagsErr -scrapFlavorSizeMismatchErr = -4996 #scrapFlavorSizeMismatchErr -scrapFlavorFlagsMismatchErr = -4995 #scrapFlavorFlagsMismatchErr -nilScrapFlavorDataErr = -4994 #nilScrapFlavorDataErr -noScrapPromiseKeeperErr = -4993 #noScrapPromiseKeeperErr -scrapPromiseNotKeptErr = -4992 #scrapPromiseNotKeptErr -processStateIncorrectErr = -4991 #processStateIncorrectErr -badScrapRefErr = -4990 #badScrapRefErr -duplicateScrapFlavorErr = -4989 #duplicateScrapFlavorErr -internalScrapErr = -4988 #internalScrapErr -coreFoundationUnknownErr = -4960 #coreFoundationUnknownErr -badRoutingSizeErr = -4276 #badRoutingSizeErr -routingNotFoundErr = -4275 #routingNotFoundErr -duplicateRoutingErr = -4274 #duplicateRoutingErr -invalidFolderTypeErr = -4273 #invalidFolderTypeErr -noMoreFolderDescErr = -4272 #noMoreFolderDescErr -duplicateFolderDescErr = -4271 #duplicateFolderDescErr -badFolderDescErr = -4270 #badFolderDescErr -cmCantGamutCheckError = -4217 #Gammut checking not supported by this ColorWorld -cmNamedColorNotFound = -4216 #NamedColor not found -cmCantCopyModifiedV1Profile = -4215 #Illegal to copy version 1 profiles that have been modified -cmRangeOverFlow = -4214 #Color conversion warning that some output color values over/underflowed and were clipped -cmInvalidProfileComment = -4213 #Bad Profile comment during drawpicture -cmNoGDevicesError = -4212 #Begin/End Matching -- no gdevices available -cmInvalidDstMap = -4211 #Destination pix/bit map was invalid -cmInvalidSrcMap = -4210 #Source pix/bit map was invalid -cmInvalidColorSpace = -4209 #Profile colorspace does not match bitmap type -cmErrIncompatibleProfile = -4208 #Other ColorSync Errors -cmSearchError = -4207 #cmSearchError -cmInvalidSearch = -4206 #Bad Search Handle -cmInvalidProfileLocation = -4205 #Operation not supported for this profile location -cmInvalidProfile = -4204 #A Profile must contain a 'cs1 ' tag to be valid -cmFatalProfileErr = -4203 #cmFatalProfileErr -cmCantDeleteElement = -4202 #cmCantDeleteElement -cmIndexRangeErr = -4201 #Tag index out of range -kNSLInitializationFailed = -4200 #UNABLE TO INITIALIZE THE MANAGER!!!!! DO NOT CONTINUE!!!! -kNSLNotInitialized = -4199 #kNSLNotInitialized -kNSLInsufficientSysVer = -4198 #kNSLInsufficientSysVer -kNSLInsufficientOTVer = -4197 #kNSLInsufficientOTVer -kNSLNoElementsInList = -4196 #kNSLNoElementsInList -kNSLBadReferenceErr = -4195 #kNSLBadReferenceErr -kNSLBadServiceTypeErr = -4194 #kNSLBadServiceTypeErr -kNSLBadDataTypeErr = -4193 #kNSLBadDataTypeErr -kNSLBadNetConnection = -4192 #kNSLBadNetConnection -kNSLNoSupportForService = -4191 #kNSLNoSupportForService -kNSLInvalidPluginSpec = -4190 #kNSLInvalidPluginSpec -kNSLRequestBufferAlreadyInList = -4189 #kNSLRequestBufferAlreadyInList -kNSLNoContextAvailable = -4188 #(ContinueLookup function ptr invalid) -kNSLBufferTooSmallForData = -4187 #(Client buffer too small for data from plugin) -kNSLCannotContinueLookup = -4186 #(Can't continue lookup; error or bad state) -kNSLBadClientInfoPtr = -4185 #(nil ClientAsyncInfoPtr; no reference available) -kNSLNullListPtr = -4184 #(client is trying to add items to a nil list) -kNSLBadProtocolTypeErr = -4183 #(client is trying to add a null protocol type) -kNSLPluginLoadFailed = -4182 #(manager unable to load one of the plugins) -kNSLNoPluginsFound = -4181 #(manager didn't find any valid plugins to load) -kNSLSearchAlreadyInProgress = -4180 #(you can only have one ongoing search per clientRef) -kNSLNoPluginsForSearch = -4179 #(no plugins will respond to search request; bad protocol(s)?) -kNSLNullNeighborhoodPtr = -4178 #(client passed a null neighborhood ptr) -kNSLSomePluginsFailedToLoad = -4177 #(one or more plugins failed to load, but at least one did load; this error isn't fatal) -kNSLErrNullPtrError = -4176 #kNSLErrNullPtrError -kNSLNotImplementedYet = -4175 #kNSLNotImplementedYet -kNSLUILibraryNotAvailable = -4174 #The NSL UI Library needs to be in the Extensions Folder -kNSLNoCarbonLib = -4173 #kNSLNoCarbonLib -kNSLBadURLSyntax = -4172 #URL contains illegal characters -kNSLSchedulerError = -4171 #A custom thread routine encountered an error -kNSL68kContextNotSupported = -4170 #no 68k allowed -noHelpForItem = -4009 #noHelpForItem -badProfileError = -4008 #badProfileError -colorSyncNotInstalled = -4007 #colorSyncNotInstalled -pickerCantLive = -4006 #pickerCantLive -cantLoadPackage = -4005 #cantLoadPackage -cantCreatePickerWindow = -4004 #cantCreatePickerWindow -cantLoadPicker = -4003 #cantLoadPicker -pickerResourceError = -4002 #pickerResourceError -requiredFlagsDontMatch = -4001 #requiredFlagsDontMatch -firstPickerError = -4000 #firstPickerError -kOTPortLostConnection = -3285 # -kOTUserRequestedErr = -3284 # -kOTConfigurationChangedErr = -3283 # -kOTBadConfigurationErr = -3282 # -kOTPortWasEjectedErr = -3281 # -kOTPortHasDiedErr = -3280 # -kOTClientNotInittedErr = -3279 # -kENOMSGErr = -3278 # -kESRCHErr = -3277 # -kEINPROGRESSErr = -3276 # -kENODATAErr = -3275 # -kENOSTRErr = -3274 # -kECANCELErr = -3273 # -kEBADMSGErr = -3272 # -kENOSRErr = -3271 # -kETIMEErr = -3270 # -kEPROTOErr = -3269 #‚‚‚ fill out missing codes ‚‚‚ -kEHOSTUNREACHErr = -3264 #No route to host -kEHOSTDOWNErr = -3263 #Host is down -kECONNREFUSEDErr = -3260 #Connection refused -kETIMEDOUTErr = -3259 #Connection timed out -kETOOMANYREFSErr = -3258 #Too many references: can't splice -kESHUTDOWNErr = -3257 #Can't send after socket shutdown -kENOTCONNErr = -3256 #Socket is not connected -kEISCONNErr = -3255 #Socket is already connected -kENOBUFSErr = -3254 #No buffer space available -kECONNRESETErr = -3253 #Connection reset by peer -kECONNABORTEDErr = -3252 #Software caused connection abort -kENETRESETErr = -3251 #Network dropped connection on reset -kENETUNREACHErr = -3250 #Network is unreachable -kENETDOWNErr = -3249 #Network is down -kEADDRNOTAVAILErr = -3248 #Can't assign requested address -kEADDRINUSEErr = -3247 #Address already in use -kEOPNOTSUPPErr = -3244 #Operation not supported on socket -kESOCKTNOSUPPORTErr = -3243 #Socket type not supported -kEPROTONOSUPPORTErr = -3242 #Protocol not supported -kENOPROTOOPTErr = -3241 #Protocol not available -kEPROTOTYPEErr = -3240 #Protocol wrong type for socket -kEMSGSIZEErr = -3239 #Message too long -kEDESTADDRREQErr = -3238 #Destination address required -kENOTSOCKErr = -3237 #Socket operation on non-socket -kEALREADYErr = -3236 # -kEWOULDBLOCKErr = -3234 #Call would block, so was aborted -kERANGEErr = -3233 #Message size too large for STREAM -kEPIPEErr = -3231 #Broken pipe -kENOTTYErr = -3224 #Not a character device -kEINVALErr = -3221 #Invalid argument -kENODEVErr = -3218 #No such device -kOTDuplicateFoundErr = -3216 #OT generic duplicate found error -kEBUSYErr = -3215 #Device or resource busy -kEFAULTErr = -3213 #Bad address -kEACCESErr = -3212 #Permission denied -kOTOutOfMemoryErr = -3211 #OT ran out of memory, may be a temporary -kEAGAINErr = -3210 #Try operation again later -kEBADFErr = -3208 #Bad file number -kENXIOErr = -3205 #No such device or address -kEIOErr = -3204 #I/O error -kEINTRErr = -3203 #Interrupted system service -kENORSRCErr = -3202 #No such resource -kOTNotFoundErr = -3201 #OT generic not found error -kEPERMErr = -3200 #Permission denied -kOTCanceledErr = -3180 #XTI2OSStatus(TCANCELED) The command was cancelled -kOTBadSyncErr = -3179 #XTI2OSStatus(TBADSYNC) A synchronous call at interrupt time -kOTProtocolErr = -3178 #XTI2OSStatus(TPROTO) An unspecified provider error occurred -kOTQFullErr = -3177 #XTI2OSStatus(TQFULL) -kOTResAddressErr = -3176 #XTI2OSStatus(TRESADDR) -kOTResQLenErr = -3175 #XTI2OSStatus(TRESQLEN) -kOTProviderMismatchErr = -3174 #XTI2OSStatus(TPROVMISMATCH) Tried to accept on incompatible endpoint -kOTIndOutErr = -3173 #XTI2OSStatus(TINDOUT) Accept failed because of pending listen -kOTAddressBusyErr = -3172 #XTI2OSStatus(TADDRBUSY) Address requested is already in use -kOTBadQLenErr = -3171 #XTI2OSStatus(TBADQLEN) A Bind to an in-use addr with qlen > 0 -kOTBadNameErr = -3170 #XTI2OSStatus(TBADNAME) A bad endpoint name was supplied -kOTNoStructureTypeErr = -3169 #XTI2OSStatus(TNOSTRUCTYPE) Bad structure type requested for OTAlloc -kOTStateChangeErr = -3168 #XTI2OSStatus(TSTATECHNG) State is changing - try again later -kOTNotSupportedErr = -3167 #XTI2OSStatus(TNOTSUPPORT) Command is not supported -kOTNoReleaseErr = -3166 #XTI2OSStatus(TNOREL) No orderly release indication available -kOTBadFlagErr = -3165 #XTI2OSStatus(TBADFLAG) A Bad flag value was supplied -kOTNoUDErrErr = -3164 #XTI2OSStatus(TNOUDERR) No Unit Data Error indication available -kOTNoDisconnectErr = -3163 #XTI2OSStatus(TNODIS) No disconnect indication available -kOTNoDataErr = -3162 #XTI2OSStatus(TNODATA) No data available for reading -kOTFlowErr = -3161 #XTI2OSStatus(TFLOW) Provider is flow-controlled -kOTBufferOverflowErr = -3160 #XTI2OSStatus(TBUFOVFLW) Passed buffer not big enough -kOTBadDataErr = -3159 #XTI2OSStatus(TBADDATA) An illegal amount of data was specified -kOTLookErr = -3158 #XTI2OSStatus(TLOOK) An event occurred - call Look() -kOTSysErrorErr = -3157 #XTI2OSStatus(TSYSERR) A system error occurred -kOTBadSequenceErr = -3156 #XTI2OSStatus(TBADSEQ) Sequence specified does not exist -kOTOutStateErr = -3155 #XTI2OSStatus(TOUTSTATE) Call issued in wrong state -kOTNoAddressErr = -3154 #XTI2OSStatus(TNOADDR) No address was specified -kOTBadReferenceErr = -3153 #XTI2OSStatus(TBADF) Bad provider reference -kOTAccessErr = -3152 #XTI2OSStatus(TACCES) Missing access permission -kOTBadOptionErr = -3151 #XTI2OSStatus(TBADOPT) A Bad option was specified -kOTBadAddressErr = -3150 #XTI2OSStatus(TBADADDR) A Bad address was specified -sktClosedErr = -3109 #sktClosedErr -recNotFnd = -3108 #recNotFnd -atpBadRsp = -3107 #atpBadRsp -atpLenErr = -3106 #atpLenErr -readQErr = -3105 #readQErr -extractErr = -3104 #extractErr -ckSumErr = -3103 #ckSumErr -noMPPErr = -3102 #noMPPErr -buf2SmallErr = -3101 #buf2SmallErr -noPrefAppErr = -3032 #noPrefAppErr -badTranslationSpecErr = -3031 #badTranslationSpecErr -noTranslationPathErr = -3030 #noTranslationPathErr -couldNotParseSourceFileErr = -3026 #Source document does not contain source type -invalidTranslationPathErr = -3025 #Source type to destination type not a valid path -retryComponentRegistrationErr = -3005 #retryComponentRegistrationErr -unresolvedComponentDLLErr = -3004 #unresolvedComponentDLLErr -componentDontRegister = -3003 #componentDontRegister -componentNotCaptured = -3002 #componentNotCaptured -validInstancesExist = -3001 #validInstancesExist -invalidComponentID = -3000 #invalidComponentID -cfragLastErrCode = -2899 #The last value in the range of CFM errors. -cfragOutputLengthErr = -2831 #An output parameter is too small to hold the value. -cfragAbortClosureErr = -2830 #Used by notification handlers to abort a closure. -cfragClosureIDErr = -2829 #The closure ID was not valid. -cfragContainerIDErr = -2828 #The fragment container ID was not valid. -cfragNoRegistrationErr = -2827 #The registration name was not found. -cfragNotClosureErr = -2826 #The closure ID was actually a connection ID. -cfragFileSizeErr = -2825 #A file was too large to be mapped. -cfragFragmentUsageErr = -2824 #A semantic error in usage of the fragment. -cfragArchitectureErr = -2823 #A fragment has an unacceptable architecture. -cfragNoApplicationErr = -2822 #No application member found in the cfrg resource. -cfragInitFunctionErr = -2821 #A fragment's initialization routine returned an error. -cfragFragmentCorruptErr = -2820 #A fragment's container was corrupt (known format). -cfragCFMInternalErr = -2819 #An internal inconstistancy has been detected. -cfragCFMStartupErr = -2818 #Internal error during CFM initialization. -cfragLibConnErr = -2817 # -cfragInitAtBootErr = -2816 #A boot library has an initialization function. (System 7 only) -cfragInitLoopErr = -2815 #Circularity in required initialization order. -cfragImportTooNewErr = -2814 #An import library was too new for a client. -cfragImportTooOldErr = -2813 #An import library was too old for a client. -cfragInitOrderErr = -2812 # -cfragNoIDsErr = -2811 #No more CFM IDs for contexts, connections, etc. -cfragNoClientMemErr = -2810 #Out of memory for fragment mapping or section instances. -cfragNoPrivateMemErr = -2809 #Out of memory for internal bookkeeping. -cfragNoPositionErr = -2808 #The registration insertion point was not found. -cfragUnresolvedErr = -2807 #A fragment had "hard" unresolved imports. -cfragFragmentFormatErr = -2806 #A fragment's container format is unknown. -cfragDupRegistrationErr = -2805 #The registration name was already in use. -cfragNoLibraryErr = -2804 #The named library was not found. -cfragNoSectionErr = -2803 #The specified section was not found. -cfragNoSymbolErr = -2802 #The specified symbol was not found. -cfragConnectionIDErr = -2801 #The connection ID was not valid. -cfragFirstErrCode = -2800 #The first value in the range of CFM errors. -errASInconsistentNames = -2780 #English errors: -errASNoResultReturned = -2763 #The range -2780 thru -2799 is reserved for dialect specific error codes. (Error codes from different dialects may overlap.) -errASParameterNotForEvent = -2762 #errASParameterNotForEvent -errASIllegalFormalParameter = -2761 #errASIllegalFormalParameter -errASTerminologyNestingTooDeep = -2760 #errASTerminologyNestingTooDeep -OSAControlFlowError = -2755 #Signaled when illegal control flow occurs in an application (no catcher for throw, non-lexical loop exit, etc.) -OSAInconsistentDeclarations = -2754 #Signaled when a variable is declared inconsistently in the same scope, such as both local and global -OSAUndefinedVariable = -2753 #Signaled when a variable is accessed that has no value -OSADuplicateHandler = -2752 #Signaled when more than one handler is defined with the same name in a scope where the language doesn't allow it -OSADuplicateProperty = -2751 #Signaled when a formal parameter, local variable, or instance variable is specified more than once. -OSADuplicateParameter = -2750 #Signaled when a formal parameter, local variable, or instance variable is specified more than once -OSATokenTooLong = -2742 #Signaled when a name or number is too long to be parsed -OSASyntaxTypeError = -2741 #Signaled when another form of syntax was expected. (e.g. "expected a <type> but found <this>") -OSASyntaxError = -2740 #Signaled when a syntax error occurs. (e.g. "Syntax error" or "<this> can't go after <that>") -errASCantCompareMoreThan32k = -2721 #Parser/Compiler errors: -errASCantConsiderAndIgnore = -2720 #errASCantConsiderAndIgnore -errOSACantCreate = -2710 #errOSACantCreate -errOSACantGetTerminology = -2709 #errOSACantGetTerminology -errOSADataBlockTooLarge = -2708 #Signaled when an intrinsic limitation is exceeded for the size of a value or data structure. -errOSAInternalTableOverflow = -2707 #Signaled when a runtime internal data structure overflows -errOSAStackOverflow = -2706 #Signaled when the runtime stack overflows -errOSACorruptTerminology = -2705 #Signaled when an application's terminology resource is not readable -errOSAAppNotHighLevelEventAware = -2704 #Signaled when an application can't respond to AppleEvents -errOSACantLaunch = -2703 #Signaled when application can't be launched or when it is remote and program linking is not enabled -errOSANumericOverflow = -2702 #Signaled when integer or real value is too large to be represented -errOSADivideByZero = -2701 #Signaled when there is an attempt to divide by zero -errOSAGeneralError = -2700 #Signaled by user scripts or applications when no actual error code is to be returned. -noIconDataAvailableErr = -2582 #The necessary icon data is not available -noSuchIconErr = -2581 #The requested icon could not be found -invalidIconRefErr = -2580 #The icon ref is not valid -nrCallNotSupported = -2557 #This call is not available or supported on this machine -nrTransactionAborted = -2556 #transaction was aborted -nrExitedIteratorScope = -2555 #outer scope of iterator was exited -nrIterationDone = -2554 #iteration operation is done -nrPropertyAlreadyExists = -2553 #property already exists -nrInvalidEntryIterationOp = -2552 #invalid entry iteration operation -nrPathBufferTooSmall = -2551 #buffer for path is too small -nrPathNotFound = -2550 #a path component lookup failed -nrResultCodeBase = -2549 #nrResultCodeBase -nrOverrunErr = -2548 #nrOverrunErr -nrNotModifiedErr = -2547 #nrNotModifiedErr -nrTypeMismatchErr = -2546 #nrTypeMismatchErr -nrPowerSwitchAbortErr = -2545 #nrPowerSwitchAbortErr -nrPowerErr = -2544 #nrPowerErr -nrDataTruncatedErr = -2543 #nrDataTruncatedErr -nrNotSlotDeviceErr = -2542 #nrNotSlotDeviceErr -nrNameErr = -2541 #nrNameErr -nrNotCreatedErr = -2540 #nrNotCreatedErr -nrNotFoundErr = -2539 #nrNotFoundErr -nrInvalidNodeErr = -2538 #nrInvalidNodeErr -nrNotEnoughMemoryErr = -2537 #nrNotEnoughMemoryErr -nrLockedErr = -2536 #nrLockedErr -mmInternalError = -2526 #mmInternalError -tsmDefaultIsNotInputMethodErr = -2524 #Current Input source is KCHR or uchr, not Input Method (GetDefaultInputMethod) -tsmNoStem = -2523 #No stem exists for the token -tsmNoMoreTokens = -2522 #No more tokens are available for the source text -tsmNoHandler = -2521 #No Callback Handler exists for callback -tsmInvalidContext = -2520 #Invalid TSMContext specified in call -tsmUnknownErr = -2519 #any other errors -tsmUnsupportedTypeErr = -2518 #unSupported interface type error -tsmScriptHasNoIMErr = -2517 #script has no imput method or is using old IM -tsmInputMethodIsOldErr = -2516 #returned by GetDefaultInputMethod -tsmComponentAlreadyOpenErr = -2515 #text service already opened for the document -tsmTSNotOpenErr = -2514 #text service is not open -tsmTSHasNoMenuErr = -2513 #the text service has no menu -tsmUseInputWindowErr = -2512 #not TSM aware because we are using input window -tsmDocumentOpenErr = -2511 #there are open documents -tsmTextServiceNotFoundErr = -2510 #no text service found -tsmCantOpenComponentErr = -2509 #canÕt open the component -tsmNoOpenTSErr = -2508 #no open text service -tsmDocNotActiveErr = -2507 #document is NOT active -tsmTSMDocBusyErr = -2506 #document is still active -tsmInvalidDocIDErr = -2505 #invalid TSM documentation id -tsmNeverRegisteredErr = -2504 #app never registered error (not TSM aware) -tsmAlreadyRegisteredErr = -2503 #want to register again error -tsmNotAnAppErr = -2502 #not an application error -tsmInputMethodNotFoundErr = -2501 #tsmInputMethodNotFoundErr -tsmUnsupScriptLanguageErr = -2500 #tsmUnsupScriptLanguageErr -kernelUnrecoverableErr = -2499 #kernelUnrecoverableErr -kernelReturnValueErr = -2422 #kernelReturnValueErr -kernelAlreadyFreeErr = -2421 #kernelAlreadyFreeErr -kernelIDErr = -2419 #kernelIDErr -kernelExceptionErr = -2418 #kernelExceptionErr -kernelTerminatedErr = -2417 #kernelTerminatedErr -kernelInUseErr = -2416 #kernelInUseErr -kernelTimeoutErr = -2415 #kernelTimeoutErr -kernelAsyncReceiveLimitErr = -2414 #kernelAsyncReceiveLimitErr -kernelAsyncSendLimitErr = -2413 #kernelAsyncSendLimitErr -kernelAttributeErr = -2412 #kernelAttributeErr -kernelExecutionLevelErr = -2411 #kernelExecutionLevelErr -kernelDeletePermissionErr = -2410 #kernelDeletePermissionErr -kernelExecutePermissionErr = -2409 #kernelExecutePermissionErr -kernelReadPermissionErr = -2408 #kernelReadPermissionErr -kernelWritePermissionErr = -2407 #kernelWritePermissionErr -kernelObjectExistsErr = -2406 #kernelObjectExistsErr -kernelUnsupportedErr = -2405 #kernelUnsupportedErr -kernelPrivilegeErr = -2404 #kernelPrivilegeErr -kernelOptionsErr = -2403 #kernelOptionsErr -kernelCanceledErr = -2402 #kernelCanceledErr -kernelIncompleteErr = -2401 #kernelIncompleteErr -badCallOrderErr = -2209 #Usually due to a status call being called prior to being setup first -noDMAErr = -2208 #CanÕt do DMA digitizing (i.e. can't go to requested dest -badDepthErr = -2207 #CanÕt digitize into this depth -notExactSizeErr = -2206 #CanÕt do exact size requested -noMoreKeyColorsErr = -2205 #all key indexes in use -notExactMatrixErr = -2204 #warning of bad matrix, digitizer did its best -matrixErr = -2203 #bad matrix, digitizer did nothing -qtParamErr = -2202 #bad input parameter (out of range, etc) -digiUnimpErr = -2201 #feature unimplemented -qtXMLApplicationErr = -2159 #qtXMLApplicationErr -qtXMLParseErr = -2158 #qtXMLParseErr -qtActionNotHandledErr = -2157 #qtActionNotHandledErr -notEnoughDataErr = -2149 #notEnoughDataErr -urlDataHFTPURLErr = -2148 #urlDataHFTPURLErr -urlDataHFTPServerDisconnectedErr = -2147 #urlDataHFTPServerDisconnectedErr -urlDataHFTPNoPasswordErr = -2146 #urlDataHFTPNoPasswordErr -urlDataHFTPNeedPasswordErr = -2145 #urlDataHFTPNeedPasswordErr -urlDataHFTPBadNameListErr = -2144 #urlDataHFTPBadNameListErr -urlDataHFTPNoNetDriverErr = -2143 #urlDataHFTPNoNetDriverErr -urlDataHFTPFilenameErr = -2142 #urlDataHFTPFilenameErr -urlDataHFTPPermissionsErr = -2141 #urlDataHFTPPermissionsErr -urlDataHFTPQuotaErr = -2140 #urlDataHFTPQuotaErr -urlDataHFTPNoDirectoryErr = -2139 #urlDataHFTPNoDirectoryErr -urlDataHFTPDataConnectionErr = -2138 #urlDataHFTPDataConnectionErr -urlDataHFTPServerErr = -2137 #urlDataHFTPServerErr -urlDataHFTPBadPasswordErr = -2136 #urlDataHFTPBadPasswordErr -urlDataHFTPBadUserErr = -2135 #urlDataHFTPBadUserErr -urlDataHFTPShutdownErr = -2134 #urlDataHFTPShutdownErr -urlDataHFTPProtocolErr = -2133 #urlDataHFTPProtocolErr -urlDataHHTTPRedirectErr = -2132 #urlDataHHTTPRedirectErr -urlDataHHTTPURLErr = -2131 #urlDataHHTTPURLErr -urlDataHHTTPNoNetDriverErr = -2130 #urlDataHHTTPNoNetDriverErr -urlDataHHTTPProtocolErr = -2129 #urlDataHHTTPProtocolErr -qtNetworkAlreadyAllocatedErr = -2127 #qtNetworkAlreadyAllocatedErr -notAllowedToSaveMovieErr = -2126 #notAllowedToSaveMovieErr -fileOffsetTooBigErr = -2125 #fileOffsetTooBigErr -ASDEntryNotFoundErr = -2124 #ASDEntryNotFoundErr -ASDBadForkErr = -2123 #ASDBadForkErr -ASDBadHeaderErr = -2122 #ASDBadHeaderErr -AAPNotFoundErr = -2121 #AAPNotFoundErr -AAPNotCreatedErr = -2120 #AAPNotCreatedErr -qfcbNotCreatedErr = -2119 #qfcbNotCreatedErr -qfcbNotFoundErr = -2118 #qfcbNotFoundErr -wackBadMetaDataErr = -2117 #wackBadMetaDataErr -wackForkNotFoundErr = -2116 #wackForkNotFoundErr -wackBadFileErr = -2115 #wackBadFileErr -unknownFormatErr = -2114 #unknownFormatErr -pathNotVerifiedErr = -2113 #pathNotVerifiedErr -noPathMappingErr = -2112 #noPathMappingErr -emptyPathErr = -2111 #emptyPathErr -pathTooLongErr = -2110 #pathTooLongErr -cannotBeLeafAtomErr = -2109 #cannotBeLeafAtomErr -invalidAtomTypeErr = -2108 #invalidAtomTypeErr -invalidAtomContainerErr = -2107 #invalidAtomContainerErr -invalidAtomErr = -2106 #invalidAtomErr -duplicateAtomTypeAndIDErr = -2105 #duplicateAtomTypeAndIDErr -atomIndexInvalidErr = -2104 #atomIndexInvalidErr -atomsNotOfSameTypeErr = -2103 #atomsNotOfSameTypeErr -notLeafAtomErr = -2102 #notLeafAtomErr -cannotFindAtomErr = -2101 #cannotFindAtomErr -unsupportedProcessorErr = -2097 #unsupportedProcessorErr -unsupportedOSErr = -2096 #unsupportedOSErr -qtmlUninitialized = -2095 #qtmlUninitialized -qtmlDllEntryNotFoundErr = -2094 #Windows specific errors (when qtml is loading) -qtmlDllLoadErr = -2093 #Windows specific errors (when qtml is loading) -componentDllEntryNotFoundErr = -2092 #Windows specific errors (when component is loading) -componentDllLoadErr = -2091 #Windows specific errors (when component is loading) -videoOutputInUseErr = -2090 #videoOutputInUseErr -noExportProcAvailableErr = -2089 #noExportProcAvailableErr -tuneParseOSErr = -2087 #tuneParseOSErr -tunePlayerFullOSErr = -2086 #tunePlayerFullOSErr -noteChannelNotAllocatedOSErr = -2085 #noteChannelNotAllocatedOSErr -illegalNoteChannelOSErr = -2084 #illegalNoteChannelOSErr -synthesizerOSErr = -2083 #synthesizerOSErr -synthesizerNotRespondingOSErr = -2082 #synthesizerNotRespondingOSErr -midiManagerAbsentOSErr = -2081 #midiManagerAbsentOSErr -illegalControllerOSErr = -2080 #illegalControllerOSErr -illegalInstrumentOSErr = -2079 #illegalInstrumentOSErr -illegalKnobValueOSErr = -2078 #illegalKnobValueOSErr -illegalKnobOSErr = -2077 #illegalKnobOSErr -illegalChannelOSErr = -2076 #illegalChannelOSErr -illegalPartOSErr = -2075 #illegalPartOSErr -illegalVoiceAllocationOSErr = -2074 #illegalVoiceAllocationOSErr -cantReceiveFromSynthesizerOSErr = -2073 #cantReceiveFromSynthesizerOSErr -cantSendToSynthesizerOSErr = -2072 #cantSendToSynthesizerOSErr -notImplementedMusicOSErr = -2071 #notImplementedMusicOSErr -internalComponentErr = -2070 #internalComponentErr -invalidSpriteIDErr = -2069 #invalidSpriteIDErr -invalidImageIndexErr = -2068 #invalidImageIndexErr -invalidSpriteIndexErr = -2067 #invalidSpriteIndexErr -gWorldsNotSameDepthAndSizeErr = -2066 #gWorldsNotSameDepthAndSizeErr -invalidSpritePropertyErr = -2065 #invalidSpritePropertyErr -invalidSpriteWorldPropertyErr = -2064 #invalidSpriteWorldPropertyErr -missingRequiredParameterErr = -2063 #missingRequiredParameterErr -movieTextNotFoundErr = -2062 #movieTextNotFoundErr -sourceNotFoundErr = -2061 #sourceNotFoundErr -noSourceTreeFoundErr = -2060 #noSourceTreeFoundErr -samplesAlreadyInMediaErr = -2059 #samplesAlreadyInMediaErr -auxiliaryExportDataUnavailable = -2058 #auxiliaryExportDataUnavailable -unsupportedAuxiliaryImportData = -2057 #unsupportedAuxiliaryImportData -soundSupportNotAvailableErr = -2056 #QT for Windows error -noSoundTrackInMovieErr = -2055 #QT for Windows error -noVideoTrackInMovieErr = -2054 #QT for Windows error -featureUnsupported = -2053 #featureUnsupported -couldNotUseAnExistingSample = -2052 #couldNotUseAnExistingSample -noDefaultDataRef = -2051 #noDefaultDataRef -badDataRefIndex = -2050 #badDataRefIndex -invalidDataRefContainer = -2049 #invalidDataRefContainer -noMovieFound = -2048 #noMovieFound -dataNoDataRef = -2047 #dataNoDataRef -endOfDataReached = -2046 #endOfDataReached -dataAlreadyClosed = -2045 #dataAlreadyClosed -dataAlreadyOpenForWrite = -2044 #dataAlreadyOpenForWrite -dataNotOpenForWrite = -2043 #dataNotOpenForWrite -dataNotOpenForRead = -2042 #dataNotOpenForRead -invalidSampleDescription = -2041 #invalidSampleDescription -invalidChunkCache = -2040 #invalidChunkCache -invalidSampleDescIndex = -2039 #invalidSampleDescIndex -invalidChunkNum = -2038 #invalidChunkNum -invalidSampleNum = -2037 #invalidSampleNum -invalidRect = -2036 #invalidRect -cantEnableTrack = -2035 #cantEnableTrack -internalQuickTimeError = -2034 #internalQuickTimeError -badEditIndex = -2033 #badEditIndex -timeNotInMedia = -2032 #timeNotInMedia -timeNotInTrack = -2031 #timeNotInTrack -trackNotInMovie = -2030 #trackNotInMovie -trackIDNotFound = -2029 #trackIDNotFound -badTrackIndex = -2028 #badTrackIndex -maxSizeToGrowTooSmall = -2027 #maxSizeToGrowTooSmall -userDataItemNotFound = -2026 #userDataItemNotFound -staleEditState = -2025 #staleEditState -nonMatchingEditState = -2024 #nonMatchingEditState -invalidEditState = -2023 #invalidEditState -cantCreateSingleForkFile = -2022 #happens when file already exists -wfFileNotFound = -2021 #wfFileNotFound -movieToolboxUninitialized = -2020 #movieToolboxUninitialized -progressProcAborted = -2019 #progressProcAborted -mediaTypesDontMatch = -2018 #mediaTypesDontMatch -badEditList = -2017 #badEditList -cantPutPublicMovieAtom = -2016 #cantPutPublicMovieAtom -invalidTime = -2015 #invalidTime -invalidDuration = -2014 #invalidDuration -invalidHandler = -2013 #invalidHandler -invalidDataRef = -2012 #invalidDataRef -invalidSampleTable = -2011 #invalidSampleTable -invalidMovie = -2010 #invalidMovie -invalidTrack = -2009 #invalidTrack -invalidMedia = -2008 #invalidMedia -noDataHandler = -2007 #noDataHandler -noMediaHandler = -2006 #noMediaHandler -badComponentType = -2005 #badComponentType -cantOpenHandler = -2004 #cantOpenHandler -cantFindHandler = -2003 #cantFindHandler -badPublicMovieAtom = -2002 #badPublicMovieAtom -badImageDescription = -2001 #badImageDescription -couldNotResolveDataRef = -2000 #couldNotResolveDataRef -nonDragOriginatorErr = -1862 #illegal attempt at originator only data -badImageErr = -1861 #bad translucent image PixMap -badImageRgnErr = -1860 #bad translucent image region -noSuitableDisplaysErr = -1859 #no displays support translucency -unsupportedForPlatformErr = -1858 #call is for PowerPC only -dragNotAcceptedErr = -1857 #drag was not accepted by receiver -handlerNotFoundErr = -1856 #handler not found -duplicateHandlerErr = -1855 #handler already exists -cantGetFlavorErr = -1854 #error while trying to get flavor data -duplicateFlavorErr = -1853 #flavor type already exists -badDragFlavorErr = -1852 #unknown flavor type -badDragItemErr = -1851 #unknown drag item reference -badDragRefErr = -1850 #unknown drag reference -errEndOfBody = -1813 #errEndOfBody -errEndOfDocument = -1812 #errEndOfDocument -errTopOfBody = -1811 #errTopOfBody -errTopOfDocument = -1810 #errTopOfDocument -errOffsetIsOutsideOfView = -1801 #errOffsetIsOutsideOfView -errOffsetInvalid = -1800 #errOffsetInvalid -errOSACantOpenComponent = -1762 #Can't connect to scripting system with that ID -errOSAComponentMismatch = -1761 #Parameters are from 2 different components -errOSADataFormatTooNew = -1759 #errOSADataFormatTooNew -errOSADataFormatObsolete = -1758 #errOSADataFormatObsolete -errOSANoSuchDialect = -1757 #errOSANoSuchDialect -errOSASourceNotAvailable = -1756 #errOSASourceNotAvailable -errOSABadSelector = -1754 #errOSABadSelector -errOSAScriptError = -1753 #errOSAScriptError -errOSABadStorageType = -1752 #errOSABadStorageType -errOSAInvalidID = -1751 #errOSAInvalidID -errOSASystemError = -1750 #errOSASystemError -errAEBufferTooSmall = -1741 #buffer for AEFlattenDesc too small -errAEBuildSyntaxError = -1740 #AEBuildDesc and friends detected a syntax error -errAEDescIsNull = -1739 #attempting to perform an invalid operation on a null descriptor -errAEStreamAlreadyConverted = -1738 #attempt to convert a stream that has already been converted -errAEStreamBadNesting = -1737 #nesting violation while streaming -errAEDuplicateHandler = -1736 #attempt to install handler in table for identical class and id (1.1 or greater) -errAEEventFiltered = -1735 #event has been filtered, and should not be propogated (1.1 or greater) -errAEReceiveEscapeCurrent = -1734 #break out of only lowest level of AEReceive (1.1 or greater) -errAEReceiveTerminate = -1733 #break out of all levels of AEReceive to the topmost (1.1 or greater) -errAERecordingIsAlreadyOn = -1732 #available only in version 1.0.1 or greater -errAEUnknownObjectType = -1731 #available only in version 1.0.1 or greater -errAEEmptyListContainer = -1730 #Attempt to pass empty list as container to accessor -errAENegativeCount = -1729 #CountProc returned negative value -errAENoSuchObject = -1728 #e.g.,: specifier asked for the 3rd, but there are only 2. Basically, this indicates a run-time resolution error. -errAENotAnObjSpec = -1727 #Param to AEResolve not of type 'obj ' -errAEBadTestKey = -1726 #Test is neither typeLogicalDescriptor nor typeCompDescriptor -errAENoSuchLogical = -1725 #Something other than AND, OR, or NOT -errAEAccessorNotFound = -1723 #Accessor proc matching wantClass and containerType or wildcards not found -errAEWrongNumberArgs = -1721 #Logical op kAENOT used with other than 1 term -errAEImpossibleRange = -1720 #A range like 3rd to 2nd, or 1st to all. -errAEIllegalIndex = -1719 #index is out of range in a put operation -errAEReplyNotArrived = -1718 #the contents of the reply you are accessing have not arrived yet -errAEHandlerNotFound = -1717 #no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler -errAEUnknownAddressType = -1716 #the target address type is not known -errAEParamMissed = -1715 #a required parameter was not accessed -errAENotASpecialFunction = -1714 #there is no special function for/with this keyword -errAENoUserInteraction = -1713 #no user interaction is allowed -errAETimeout = -1712 #the AppleEvent timed out -errAEWaitCanceled = -1711 #in AESend, the user cancelled out of wait loop for reply or receipt -errAEUnknownSendMode = -1710 #mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown -errAEReplyNotValid = -1709 #AEResetTimer was passed an invalid reply parameter -errAEEventNotHandled = -1708 #the AppleEvent was not handled by any handler -errAENotAppleEvent = -1707 #the event is not in AppleEvent format -errAENewerVersion = -1706 #need newer version of the AppleEvent manager -errAEBadListItem = -1705 #the specified list item does not exist -errAENotAEDesc = -1704 #errAENotAEDesc -errAEWrongDataType = -1703 #errAEWrongDataType -errAECorruptData = -1702 #errAECorruptData -errAEDescNotFound = -1701 #errAEDescNotFound -errAECoercionFail = -1700 #bad parameter data or unable to coerce the data supplied -errFSIteratorNotSupported = -1424 #The iterator's flags or container are not supported by this call -errFSIteratorNotFound = -1423 #Passed FSIterator is not an open iterator -errFSBadIteratorFlags = -1422 #Flags passed to FSOpenIterator are bad -errFSForkExists = -1421 #Named fork already exists. -errFSRefsDifferent = -1420 #FSCompareFSRefs; refs are for different objects -errFSBadSearchParams = -1419 #Something wrong with CatalogSearch searchParams -errFSBadItemCount = -1418 #maximumItems was zero -errFSNoMoreItems = -1417 #Iteration ran out of items to return -errFSBadAllocFlags = -1413 #Invalid bits set in allocationFlags -errFSBadPosMode = -1412 #Newline bits set in positionMode -errFSMissingName = -1411 #A Unicode name parameter was NULL or nameLength parameter was zero -errFSNameTooLong = -1410 #File/fork name is too long to create/rename -errFSForkNotFound = -1409 #Named fork does not exist -errFSNotAFolder = -1407 #Expected a folder, got a file -errFSMissingCatInfo = -1406 #A CatalogInfo parameter was NULL -errFSBadInfoBitmap = -1405 #A CatalogInfoBitmap or VolumeInfoBitmap has reserved or invalid bits set -errFSBadForkRef = -1404 #A ForkRefNum parameter was bad -errFSBadBuffer = -1403 #A buffer parameter was bad -errFSBadForkName = -1402 #Fork name parameter is bad -errFSBadFSRef = -1401 #FSRef parameter is bad -errFSUnknownCall = -1400 #selector is not recognized by this filesystem -badFCBErr = -1327 #FCBRecPtr is not valid -volVMBusyErr = -1311 #can't eject because volume is in use by VM -fsDataTooBigErr = -1310 #file or volume is too big for system -fileBoundsErr = -1309 #file's EOF, offset, mark or size is too big -notARemountErr = -1308 #when _Mount allows only remounts and doesn't get one -badFidErr = -1307 #file id is dangling or doesn't match with the file number -sameFileErr = -1306 #can't exchange a file with itself -desktopDamagedErr = -1305 #desktop database files are corrupted -catChangedErr = -1304 #the catalog has been modified -diffVolErr = -1303 #files on different volumes -notAFileErr = -1302 #directory specified -fidExists = -1301 #file id already exists -fidNotFound = -1300 #no file thread exists. -errRefNum = -1280 #bad connection refNum -errAborted = -1279 #control call was aborted -errState = -1278 #bad connection state for this operation -errOpening = -1277 #open connection request failed -errAttention = -1276 #attention message too long -errFwdReset = -1275 #read terminated by forward reset -errDSPQueueSize = -1274 #DSP Read/Write Queue Too small -errOpenDenied = -1273 #open connection request was denied -reqAborted = -1105 #reqAborted -noDataArea = -1104 #noDataArea -noSendResp = -1103 #noSendResp -cbNotFound = -1102 #cbNotFound -noRelErr = -1101 #noRelErr -badBuffNum = -1100 #badBuffNum -badATPSkt = -1099 #badATPSkt -tooManySkts = -1098 #tooManySkts -tooManyReqs = -1097 #tooManyReqs -reqFailed = -1096 #reqFailed -aspNoAck = -1075 #No ack on attention request (server err) -aspTooMany = -1074 #Too many clients (server error) -aspSizeErr = -1073 #Command block too big -aspSessClosed = -1072 #Session closed -aspServerBusy = -1071 #Server cannot open another session -aspParamErr = -1070 #Parameter error -aspNoServers = -1069 #No servers at that address -aspNoMoreSess = -1068 #No more sessions on server -aspBufTooSmall = -1067 #Buffer too small -aspBadVersNum = -1066 #Server cannot support this ASP version -nbpNISErr = -1029 #Error trying to open the NIS -nbpNotFound = -1028 #Name not found on remove -nbpDuplicate = -1027 #Duplicate name exists already -nbpConfDiff = -1026 #Name confirmed at different socket -nbpNoConfirm = -1025 #nbpNoConfirm -nbpBuffOvr = -1024 #Buffer overflow in LookupName -noMaskFoundErr = -1000 #Icon Utilties Error -kFMFontContainerAccessErr = -985 #kFMFontContainerAccessErr -kFMFontTableAccessErr = -984 #kFMFontTableAccessErr -kFMIterationScopeModifiedErr = -983 #kFMIterationScopeModifiedErr -kFMInvalidFontErr = -982 #kFMInvalidFontErr -kFMInvalidFontFamilyErr = -981 #kFMInvalidFontFamilyErr -kFMIterationCompleted = -980 #kFMIterationCompleted -guestNotAllowedErr = -932 #destination port requires authentication -badLocNameErr = -931 #location name malformed -badServiceMethodErr = -930 #illegal service type, or not supported -noUserRecErr = -928 #Invalid user reference number -authFailErr = -927 #unable to authenticate user at destination -noInformErr = -926 #PPCStart failed because destination did not have inform pending -networkErr = -925 #An error has occurred in the network, not too likely -noUserRefErr = -924 #unable to create a new userRefNum -notLoggedInErr = -923 #The default userRefNum does not yet exist -noDefaultUserErr = -922 #user hasn't typed in owners name in Network Setup Control Pannel -badPortNameErr = -919 #PPCPortRec malformed -sessClosedErr = -917 #session was closed -portClosedErr = -916 #port was closed -noResponseErr = -915 #unable to contact destination -noToolboxNameErr = -914 #A system resource is missing, not too likely -noMachineNameErr = -913 #user hasn't named his Macintosh in the Network Setup Control Panel -userRejectErr = -912 #Destination rejected the session request -noUserNameErr = -911 #user name unknown on destination machine -portNameExistsErr = -910 #port is already open (perhaps in another app) -badReqErr = -909 #bad parameter or invalid state for operation -noSessionErr = -908 #Invalid session reference number -sessTableErr = -907 #Out of session tables, try again later -destPortErr = -906 #Port does not exist at destination -localOnlyErr = -905 #Network activity is currently disabled -noGlobalsErr = -904 #The system is hosed, better re-boot -noPortErr = -903 #Unable to open port or bad portRefNum. If you're calling -nameTypeErr = -902 #Invalid or inappropriate locationKindSelector in locationName -notInitErr = -900 #PPCToolBox not initialized -notAppropriateForClassic = -877 #This application won't or shouldn't run on Classic (Problem 2481058). -appVersionTooOld = -876 #The application's creator and version are incompatible with the current version of Mac OS. -wrongApplicationPlatform = -875 #The application could not launch because the required platform is not available -hmCloseViewActive = -863 #Returned from HMRemoveBalloon if CloseView was active -hmNoBalloonUp = -862 #Returned from HMRemoveBalloon if no balloon was visible when call was made -hmOperationUnsupported = -861 #Returned from HMShowBalloon call if bad method passed to routine -hmUnknownHelpType = -859 #Returned if help msg record contained a bad type -hmWrongVersion = -858 #Returned if help mgr resource was the wrong version -hmSkippedBalloon = -857 #Returned from calls if helpmsg specified a skip balloon -hmHelpManagerNotInited = -855 #Returned from HMGetHelpMenuHandle if help menu not setup -hmSameAsLastBalloon = -854 #Returned from HMShowMenuBalloon if menu & item is same as last time -hmBalloonAborted = -853 #Returned if mouse was moving or mouse wasn't in window port rect -hmHelpDisabled = -850 #Show Balloons mode was off, call to routine ignored -rcDBPackNotInited = -813 #attempt to call other routine before InitDBPack -rcDBWrongVersion = -812 #incompatible versions -rcDBNoHandler = -811 #no app handler for specified data type -rcDBBadAsyncPB = -810 #tried to kill a bad pb -rcDBAsyncNotSupp = -809 #ddev does not support async calls -rcDBBadDDEV = -808 #bad ddev specified on DBInit -rcDBBadSessNum = -807 #bad session number for DBGetConnInfo -rcDBBadSessID = -806 #rcDBBadSessID -rcDBExec = -805 #rcDBExec -rcDBBreak = -804 #rcDBBreak -rcDBBadType = -803 #rcDBBadType -rcDBError = -802 #rcDBError -rcDBValue = -801 #rcDBValue -rcDBNull = -800 #rcDBNull -icTooManyProfilesErr = -677 #too many profiles in database -icProfileNotFoundErr = -676 #profile not found -icConfigInappropriateErr = -675 #incorrect manufacturer code -icConfigNotFoundErr = -674 #no internet configuration was found -icNoURLErr = -673 #no URL found -icNothingToOverrideErr = -672 #no component for the override component to capture -icNoMoreWritersErr = -671 #you cannot begin a write session because someone else is already doing it -icTruncatedErr = -670 #more data was present than was returned -icInternalErr = -669 #Internet Config internal error -icPrefDataErr = -668 #problem with preference data -icPermErr = -667 #cannot set preference -icPrefNotFoundErr = -666 #Internet preference not found -vmInvalidOwningProcessErr = -648 #current process does not own the BackingFileID or FileViewID -vmAddressNotInFileViewErr = -647 #address is not in a FileView -vmNoMoreFileViewsErr = -646 #no more FileViews were found -vmFileViewAccessErr = -645 #requested FileViewAccess cannot be obtained -vmInvalidFileViewIDErr = -644 #invalid FileViewID -vmNoMoreBackingFilesErr = -643 #no more BackingFiles were found -vmBusyBackingFileErr = -642 #open views found on BackingFile -vmMappingPrivilegesErr = -641 #requested MappingPrivileges cannot be obtained -vmInvalidBackingFileIDErr = -640 #invalid BackingFileID -noMMUErr = -626 #no MMU present -cannotDeferErr = -625 #unable to defer additional functions -interruptsMaskedErr = -624 #donÕt call with interrupts masked -notLockedErr = -623 #specified range of memory is not locked -cannotMakeContiguousErr = -622 #cannot make specified range contiguous -notHeldErr = -621 #specified range of memory is not held -notEnoughMemoryErr = -620 #insufficient physical memory -threadProtocolErr = -619 #threadProtocolErr -threadNotFoundErr = -618 #threadNotFoundErr -threadTooManyReqsErr = -617 #threadTooManyReqsErr -noUserInteractionAllowed = -610 #no user interaction allowed -connectionInvalid = -609 #connectionInvalid -noOutstandingHLE = -608 #noOutstandingHLE -bufferIsSmall = -607 #error returns from Post and Accept -appIsDaemon = -606 #app is BG-only, and launch flags disallow this -appMemFullErr = -605 #application SIZE not big enough for launch -hardwareConfigErr = -604 #hardware configuration not correct for call -protocolErr = -603 #app made module calls in improper order -appModeErr = -602 #memory mode is 32-bit, but app not 32-bit clean -memFragErr = -601 #not enough room to launch app w/special requirements -procNotFound = -600 #no eligible process with specified descriptor -driverHardwareGoneErr = -503 #disk driver's hardware was disconnected -hwParamErr = -502 #bad selector for _HWPriv -teScrapSizeErr = -501 #scrap item too big for text edit record -rgnTooBigErr = -500 #rgnTooBigErr -exUserBreak = -492 #user debugger break; execute debugger commands on stack -strUserBreak = -491 #user debugger break; display string on stack -userBreak = -490 #user debugger break -notThePublisherWrn = -463 #not the first registered publisher for that container -containerAlreadyOpenWrn = -462 #container already opened by this section -containerNotFoundWrn = -461 #could not find editionContainer at this time -multiplePublisherWrn = -460 #A Publisher is already registered for that container -badSubPartErr = -454 #can not use sub parts in this release -badEditionFileErr = -453 #edition file is corrupt -notRegisteredSectionErr = -452 #not a registered SectionRecord -badSectionErr = -451 #not a valid SectionRecord -editionMgrInitErr = -450 #edition manager not inited by this app -fsmUnknownFSMMessageErr = -438 #unknown message passed to FSM -fsmNoAlternateStackErr = -437 #no alternate stack for HFS CI -fsmBadFSDVersionErr = -436 #FSM version incompatible with FSD -fsmDuplicateFSIDErr = -435 #FSID already exists on InstallFS -fsmBadFSDLenErr = -434 #FSD size incompatible with current FSM vers -fsmBadFFSNameErr = -433 #Name length not 1 <= length <= 31 -fsmBusyFFSErr = -432 #File system is busy, cannot be removed -fsmFFSNotFoundErr = -431 #Foreign File system does not exist - new Pack2 could return this error too -btKeyAttrErr = -417 #There is no such a key attribute. -btKeyLenErr = -416 #Maximum key length is too long or equal to zero. -btRecNotFnd = -415 #Record cannot be found. -btDupRecErr = -414 #Record already exists. -btNoSpace = -413 #Can't allocate disk space. -notBTree = -410 #The file is not a dictionary. -gcrOnMFMErr = -400 #gcr format on high density media error -slotNumErr = -360 #invalid slot # error -smRecNotFnd = -351 #Record not found in the SRT. -smSRTOvrFlErr = -350 #SRT over flow. -smNoGoodOpens = -349 #No opens were successfull in the loop. -smOffsetErr = -348 #Offset was too big (temporary error -smByteLanesErr = -347 #NumByteLanes was determined to be zero. -smBadsPtrErr = -346 #Bad pointer was passed to sCalcsPointer -smsGetDrvrErr = -345 #Error occurred during _sGetDriver. -smNoMoresRsrcs = -344 #No more sResources -smDisDrvrNamErr = -343 #Error occurred during _sDisDrvrName. -smGetDrvrNamErr = -342 #Error occurred during _sGetDrvrName. -smCkStatusErr = -341 #Status of slot = fail. -smBlkMoveErr = -340 #_BlockMove error -smNewPErr = -339 #_NewPtr error -smSelOOBErr = -338 #Selector out of bounds error -smSlotOOBErr = -337 #Slot out of bounds error -smNilsBlockErr = -336 #Nil sBlock error (Dont allocate and try to use a nil sBlock) -smsPointerNil = -335 #LPointer is nil From sOffsetData. If this error occurs; check sInfo rec for more information. -smCPUErr = -334 #Code revision is wrong -smCodeRevErr = -333 #Code revision is wrong -smReservedErr = -332 #Reserved field not zero -smBadsList = -331 #Bad sList: Id1 < Id2 < Id3 ...format is not followed. -smBadRefId = -330 #Reference Id not found in List -smBusErrTO = -320 #BusError time out. -smBadBoardId = -319 #BoardId was wrong; re-init the PRAM record. -smReservedSlot = -318 #slot is reserved, VM should not use this address space. -smInitTblVErr = -317 #An error occurred while trying to initialize the Slot Resource Table. -smInitStatVErr = -316 #The InitStatusV field was negative after primary or secondary init. -smNoBoardId = -315 #No Board Id. -smGetPRErr = -314 #Error occurred during _sGetPRAMRec (See SIMStatus). -smNoBoardSRsrc = -313 #No Board sResource. -smDisposePErr = -312 #_DisposePointer error -smFHBlkDispErr = -311 #Error occurred during _sDisposePtr (Dispose of FHeader block). -smFHBlockRdErr = -310 #Error occurred during _sGetFHeader. -smBLFieldBad = -309 #ByteLanes field was bad. -smUnExBusErr = -308 #Unexpected BusError -smResrvErr = -307 #Fatal reserved error. Resreved field <> 0. -smNosInfoArray = -306 #No sInfoArray. Memory Mgr error. -smDisabledSlot = -305 #This slot is disabled (-305 use to be smLWTstBad) -smNoDir = -304 #Directory offset is Nil -smRevisionErr = -303 #Wrong revison level -smFormatErr = -302 #FHeader Format is not Apple's -smCRCFail = -301 #CRC check failed for declaration data -smEmptySlot = -300 #No card in slot -nmTypErr = -299 #Notification Manager:wrong queue type -smPriInitErr = -293 #Error; Cards could not be initialized. -smPRAMInitErr = -292 #Error; Slot Resource Table could not be initialized. -smSRTInitErr = -291 #Error; Slot Resource Table could not be initialized. -smSDMInitErr = -290 #Error; SDM could not be initialized. -midiInvalidCmdErr = -261 #command not supported for port type -midiDupIDErr = -260 #duplicate client ID -midiNameLenErr = -259 #name supplied is longer than 31 characters -midiWriteErr = -258 #MIDIWritePacket couldn't write to all connected ports -midiNoConErr = -257 #no connection exists between specified ports -midiVConnectRmvd = -256 #pending virtual connection removed -midiVConnectMade = -255 #pending virtual connection resolved -midiVConnectErr = -254 #pending virtual connection created -midiTooManyConsErr = -253 #too many connections made -midiTooManyPortsErr = -252 #too many ports already installed in the system -midiNoPortErr = -251 #no port with that ID found -midiNoClientErr = -250 #no client with that ID found -badInputText = -247 #badInputText -badDictFormat = -246 #badDictFormat -incompatibleVoice = -245 #incompatibleVoice -voiceNotFound = -244 #voiceNotFound -bufTooSmall = -243 #bufTooSmall -synthNotReady = -242 #synthNotReady -synthOpenFailed = -241 #synthOpenFailed -noSynthFound = -240 #noSynthFound -siUnknownQuality = -232 #invalid quality selector (returned by driver) -siUnknownInfoType = -231 #invalid info type selector (returned by driver) -siInputDeviceErr = -230 #input device hardware failure -siBadRefNum = -229 #invalid input device reference number -siBadDeviceName = -228 #input device could not be opened -siDeviceBusyErr = -227 #input device already in use -siInvalidSampleSize = -226 #invalid sample size -siInvalidSampleRate = -225 #invalid sample rate -siHardDriveTooSlow = -224 #hard drive too slow to record to disk -siInvalidCompression = -223 #invalid compression type -siNoBufferSpecified = -222 #returned by synchronous SPBRecord if nil buffer passed -siBadSoundInDevice = -221 #invalid index passed to SoundInGetIndexedDevice -siNoSoundInHardware = -220 #no Sound Input hardware -siVBRCompressionNotSupported = -213 #vbr audio compression not supported for this operation -noMoreRealTime = -212 #not enough CPU cycles left to add another task -channelNotBusy = -211 #channelNotBusy -buffersTooSmall = -210 #can not operate in the memory allowed -channelBusy = -209 #the Channel is being used for a PFD already -badFileFormat = -208 #was not type AIFF or was of bad format,corrupt -notEnoughBufferSpace = -207 #could not allocate enough memory -badFormat = -206 #Sound Manager Error Returns -badChannel = -205 #Sound Manager Error Returns -resProblem = -204 #Sound Manager Error Returns -queueFull = -203 #Sound Manager Error Returns -notEnoughHardwareErr = -201 #Sound Manager Error Returns -noHardwareErr = -200 #Sound Manager Error Returns -mapReadErr = -199 #map inconsistent with operation -resAttrErr = -198 #attribute inconsistent with operation -rmvRefFailed = -197 #RmveReference failed -rmvResFailed = -196 #RmveResource failed -addRefFailed = -195 #AddReference failed -addResFailed = -194 #AddResource failed -resFNotFound = -193 #Resource file not found -resNotFound = -192 #Resource not found -inputOutOfBounds = -190 #Offset of Count out of bounds -writingPastEnd = -189 #Writing past end of file -resourceInMemory = -188 #Resource already in memory -CantDecompress = -186 #resource bent ("the bends") - can't decompress a compressed resource -badExtResource = -185 #extended resource has a bad format. -cmNoCurrentProfile = -182 #Responder error -cmUnsupportedDataType = -181 #Responder error -cmCantDeleteProfile = -180 #Responder error -cmCantXYZ = -179 #CMM cant handle XYZ space -cmCantConcatenateError = -178 #Profile can't be concatenated -cmProfilesIdentical = -177 #Profiles the same -cmProfileNotFound = -176 #Responder error -cmMethodNotFound = -175 #CMM not present -cmMethodError = -171 #cmMethodError -cmProfileError = -170 #cmProfileError -cDepthErr = -157 #invalid pixel depth -cResErr = -156 #invalid resolution for MakeITable -cDevErr = -155 #invalid type of graphics device -cProtectErr = -154 #colorTable entry protection violation -cRangeErr = -153 #range error on colorTable request -cNoMemErr = -152 #failed to allocate memory for structure -cTempMemErr = -151 #failed to allocate memory for temporary structures -cMatchErr = -150 #Color2Index failed to find an index -insufficientStackErr = -149 #insufficientStackErr -pixMapTooDeepErr = -148 #pixMapTooDeepErr -rgnOverflowErr = -147 #rgnOverflowErr -noMemForPictPlaybackErr = -145 #noMemForPictPlaybackErr -userCanceledErr = -128 #userCanceledErr -hMenuFindErr = -127 #could not find HMenu's parent in MenuKey (wrong error code - obsolete) -mBarNFnd = -126 #system error code for MBDF not found -updPixMemErr = -125 #insufficient memory to update a pixmap -volGoneErr = -124 #Server volume has been disconnected. -wrgVolTypErr = -123 #Wrong volume type error [operation not supported for MFS] -badMovErr = -122 #Move into offspring error -tmwdoErr = -121 #No free WDCB available -dirNFErr = -120 #Directory not found -memLockedErr = -117 #trying to move a locked block (MoveHHi) -memSCErr = -116 #Size Check failed -memBCErr = -115 #Block Check failed -memPCErr = -114 #Pointer Check failed -memAZErr = -113 #Address in zone check failed -memPurErr = -112 #trying to purge a locked or non-purgeable block -memWZErr = -111 #WhichZone failed (applied to free block) -memAdrErr = -110 #address was odd; or out of range -nilHandleErr = -109 #Master Pointer was NIL in HandleZone or other -memFullErr = -108 #Not enough room in heap zone -noTypeErr = -102 #No object of that type in scrap -noScrapErr = -100 #No scrap exists error -memROZWarn = -99 #soft error in ROZ -portNotCf = -98 #driver Open error code (parameter RAM not configured for this connection) -portInUse = -97 #driver Open error code (port is in use) -portNotPwr = -96 #serial port not currently powered -excessCollsns = -95 #excessive collisions on write -lapProtErr = -94 #error in attaching/detaching protocol -noBridgeErr = -93 #no network bridge for non-local send -eLenErr = -92 #Length error ddpLenErr -eMultiErr = -91 #Multicast address error ddpSktErr -breakRecd = -90 #Break received (SCC) -rcvrErr = -89 #SCC receiver error (framing; parity; OR) -prInitErr = -88 #InitUtil found the parameter ram uninitialized -prWrErr = -87 #parameter ram written didn't read-verify -clkWrErr = -86 #time written did not verify -clkRdErr = -85 #unable to read same clock value twice -verErr = -84 #track failed to verify -fmt2Err = -83 #can't get enough sync -fmt1Err = -82 #can't find sector 0 after track format -sectNFErr = -81 #sector number never found on a track -seekErr = -80 #track number wrong on address mark -spdAdjErr = -79 #unable to correctly adjust disk speed -twoSideErr = -78 #tried to read 2nd side on a 1-sided drive -initIWMErr = -77 #unable to initialize IWM -tk0BadErr = -76 #track 0 detect doesn't change -cantStepErr = -75 #step handshake failed -wrUnderrun = -74 #write underrun occurred -badDBtSlp = -73 #bad data mark bit slip nibbles -badDCksum = -72 #bad data mark checksum -noDtaMkErr = -71 #couldn't find a data mark header -badBtSlpErr = -70 #bad addr mark bit slip nibbles -badCksmErr = -69 #addr mark checksum didn't check -dataVerErr = -68 #read verify compare failed -noAdrMkErr = -67 #couldn't find valid addr mark -noNybErr = -66 #couldn't find 5 nybbles in 200 tries -offLinErr = -65 #r/w requested for an off-line drive -fontDecError = -64 #error during font declaration -wrPermErr = -61 #write permissions error -badMDBErr = -60 #bad master directory block -fsRnErr = -59 #file system internal error:during rename the old entry was deleted but could not be restored. -extFSErr = -58 #volume in question belongs to an external fs -noMacDskErr = -57 #not a mac diskette (sig bytes are wrong) -nsDrvErr = -56 #no such drive (tried to mount a bad drive num) -volOnLinErr = -55 #drive volume already on-line at MountVol -permErr = -54 #permissions error (on file open) -volOffLinErr = -53 #volume not on line error (was Ejected) -gfpErr = -52 #get file position error -rfNumErr = -51 #refnum error -paramErr = -50 #error in user parameter list -opWrErr = -49 #file already open with with write permission -dupFNErr = -48 #duplicate filename (rename) -fBsyErr = -47 #File is busy (delete) -vLckdErr = -46 #volume is locked -fLckdErr = -45 #file is locked -wPrErr = -44 #diskette is write protected. -fnfErr = -43 #File not found -tmfoErr = -42 #too many files open -mFulErr = -41 #memory full (open) or file won't fit (load) -posErr = -40 #tried to position to before start of file (r/w) -eofErr = -39 #End of file -fnOpnErr = -38 #File not open -bdNamErr = -37 #there may be no bad names in the final system! -ioErr = -36 #I/O error (bummers) -nsvErr = -35 #no such volume -dskFulErr = -34 #disk full -dirFulErr = -33 #Directory full -dceExtErr = -30 #dce extension error -unitTblFullErr = -29 #unit table has no more entries -notOpenErr = -28 #Couldn't rd/wr/ctl/sts cause driver not opened -iIOAbortErr = -27 #IO abort error (Printing Manager) -dInstErr = -26 #DrvrInstall couldn't find driver in resources -dRemovErr = -25 #tried to remove an open driver -closErr = -24 #I/O System Errors -openErr = -23 #I/O System Errors -unitEmptyErr = -22 #I/O System Errors -badUnitErr = -21 #I/O System Errors -writErr = -20 #I/O System Errors -readErr = -19 #I/O System Errors -statusErr = -18 #I/O System Errors -controlErr = -17 #I/O System Errors -dsExtensionsDisabled = -13 #say –Extensions Disabled” -dsHD20Installed = -12 #say –HD20 Startup” -dsDisassemblerInstalled = -11 #say –Disassembler Installed” -dsMacsBugInstalled = -10 #say –MacsBug Installed” -seNoDB = -8 #no debugger installed to handle debugger command -SlpTypeErr = -5 #invalid queue element -unimpErr = -4 #unimplemented core routine -corErr = -3 #core routine number out of range -dsNoExtsDisassembler = -2 #not a SysErr, just a placeholder -qErr = -1 #queue element not found during deletion -tsmComponentNoErr = 0 #component result = no error -EPERM = 1 #Operation not permitted -ENOENT = 2 #No such file or directory -ESRCH = 3 #No such process -EINTR = 4 #Interrupted system call -EIO = 5 #Input/output error -ENXIO = 6 #Device not configured -E2BIG = 7 #Argument list too long -ENOEXEC = 8 #Exec format error -EBADF = 9 #Bad file descriptor -ECHILD = 10 #No child processes -EDEADLK = 11 #Resource deadlock avoided -ENOMEM = 12 #Cannot allocate memory -EACCES = 13 #Permission denied -EFAULT = 14 #Bad address -ECANCELED = 15 #Operation cancelled -EBUSY = 16 #Device busy -EEXIST = 17 #File exists -EXDEV = 18 #Cross-device link -ENODEV = 19 #Operation not supported by device -ENOTDIR = 20 #Not a directory -EISDIR = 21 #Is a directory -EINVAL = 22 #Invalid argument -ENFILE = 23 #Too many open files in system -EMFILE = 24 #Too many open files -ENOTTY = 25 #Inappropriate ioctl for device -ESIGPARM = 26 #Signal error -EFBIG = 27 #File too large -ENOSPC = 28 #No space left on device -ESPIPE = 29 #Illegal seek -EROFS = 30 #Read-only file system -EMLINK = 31 #Too many links -EPIPE = 32 #Broken pipe -EDOM = 33 #Numerical argument out of domain -ERANGE = 34 #Result too large -EAGAIN = 35 #Resource temporarily unavailable -EINPROGRESS = 36 #Operation now in progress -EALREADY = 37 #Operation already in progress -ENOTSOCK = 38 #Socket operation on non-socket -EDESTADDRREQ = 39 #Destination address required -EMSGSIZE = 40 #Message too long -EPROTOTYPE = 41 #Protocol wrong type for socket -ENOPROTOOPT = 42 #Protocol not available -EPROTONOSUPPORT = 43 #Protocol not supported -ESOCKTNOSUPPORT = 44 #Socket type not supported -EOPNOTSUPP = 45 #Operation not supported -EPFNOSUPPORT = 46 #Protocol family not supported -EAFNOSUPPORT = 47 #Address family not supported by protocol family -EADDRINUSE = 48 #Address already in use -EADDRNOTAVAIL = 49 #Can't assign requested address -ENETDOWN = 50 #Network is down -ENETUNREACH = 51 #Network is unreachable -ENETRESET = 52 #Network dropped connection on reset -ECONNABORTED = 53 #Software caused connection abort -ECONNRESET = 54 #Connection reset by peer -ENOBUFS = 55 #No buffer space available -EISCONN = 56 #Socket is already connected -ENOTCONN = 57 #Socket is not connected -ESHUTDOWN = 58 #Can't send after socket shutdown -ETOOMANYREFS = 59 #Too many references: can't splice -ETIMEDOUT = 60 #Operation timed out -ECONNREFUSED = 61 #Connection refused -ELOOP = 62 #Too many levels of symbolic links -ENAMETOOLONG = 63 #File name too long -EHOSTDOWN = 64 #Host is down -EHOSTUNREACH = 65 #No route to host -ENOTEMPTY = 66 #Directory not empty -ELOOK = 67 #Internal mapping for kOTLookErr, don't return to client -ENOLCK = 77 #No locks available -ENOSYS = 78 #Function not implemented -EILSEQ = 88 #Wide character encoding error -EUNKNOWN = 99 #Unknown error diff --git a/sys/lib/python/plat-mac/macfs.py b/sys/lib/python/plat-mac/macfs.py deleted file mode 100644 index 73815aeb3..000000000 --- a/sys/lib/python/plat-mac/macfs.py +++ /dev/null @@ -1,198 +0,0 @@ -"""macfs - Pure Python module designed to be backward compatible with -macfs and MACFS. -""" -import sys -import struct -import Carbon.Res -import Carbon.File -import warnings - -warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs", - DeprecationWarning, stacklevel=2) - -# First step: ensure we also emulate the MACFS module, which contained -# all the constants - -sys.modules['MACFS'] = sys.modules[__name__] - -# Import all those constants -from Carbon.Files import * -from Carbon.Folders import * - -# For some obscure historical reason these are here too: -READ = 1 -WRITE = 2 -smAllScripts = -3 - -# -# Find the epoch conversion for file dates in a way that works on OS9 and OSX -import time -if time.gmtime(0)[0] == 1970: - _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L - def _utc2time(utc): - t = utc[1] + _EPOCHCONVERT - return int(t) - def _time2utc(t): - t = int(t) - _EPOCHCONVERT - if t < -0x7fffffff: - t = t + 0x10000000L - return (0, int(t), 0) -else: - def _utc2time(utc): - t = utc[1] - if t < 0: - t = t + 0x100000000L - return t - def _time2utc(t): - if t > 0x7fffffff: - t = t - 0x100000000L - return (0, int(t), 0) - -# The old name of the error object: -error = Carbon.File.Error - -# -# The various objects macfs used to export. We override them here, because some -# of the method names are subtly different. -# -class FSSpec(Carbon.File.FSSpec): - def as_fsref(self): - return FSRef(self) - - def NewAlias(self, src=None): - return Alias(Carbon.File.NewAlias(src, self)) - - def GetCreatorType(self): - finfo = self.FSpGetFInfo() - return finfo.Creator, finfo.Type - - def SetCreatorType(self, ctor, tp): - finfo = self.FSpGetFInfo() - finfo.Creator = ctor - finfo.Type = tp - self.FSpSetFInfo(finfo) - - def GetFInfo(self): - return self.FSpGetFInfo() - - def SetFInfo(self, info): - return self.FSpSetFInfo(info) - - def GetDates(self): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) - cdate = catinfo.createDate - mdate = catinfo.contentModDate - bdate = catinfo.backupDate - return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) - - def SetDates(self, cdate, mdate, bdate): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo = Carbon.File.FSCatalogInfo( - createDate = _time2utc(cdate), - contentModDate = _time2utc(mdate), - backupDate = _time2utc(bdate)) - FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) - -class FSRef(Carbon.File.FSRef): - def as_fsspec(self): - return FSSpec(self) - -class Alias(Carbon.File.Alias): - - def GetInfo(self, index): - return self.GetAliasInfo(index) - - def Update(self, *args): - pass # print "Alias.Update not yet implemented" - - def Resolve(self, src=None): - fss, changed = self.ResolveAlias(src) - return FSSpec(fss), changed - -from Carbon.File import FInfo - -# Backward-compatible type names: -FSSpecType = FSSpec -FSRefType = FSRef -AliasType = Alias -FInfoType = FInfo - -# Global functions: -def ResolveAliasFile(fss, chain=1): - fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) - return FSSpec(fss), isdir, isalias - -def RawFSSpec(data): - return FSSpec(rawdata=data) - -def RawAlias(data): - return Alias(rawdata=data) - -def FindApplication(*args): - raise NotImplementedError, "FindApplication no longer implemented" - -def NewAliasMinimalFromFullPath(path): - return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) - -# Another global function: -from Carbon.Folder import FindFolder - -# -# Finally the old Standard File routine emulators. -# - -_curfolder = None - -def StandardGetFile(*typelist): - """Ask for an input file, optionally specifying 4-char file types that are - allowable""" - return PromptGetFile('', *typelist) - -def PromptGetFile(prompt, *typelist): - """Ask for an input file giving the user a prompt message. Optionally you can - specifying 4-char file types that are allowable""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if not typelist: - typelist = None - fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, - typeList=typelist, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def StandardPutFile(prompt, default=None): - """Ask the user for an output file, with a prompt. Optionally you cn supply a - default output filename""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, - savedFileName=default, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def SetFolder(folder): - global _curfolder - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if _curfolder: - rv = FSSpec(_curfolder) - else: - rv = None - _curfolder = folder - return rv - -def _handleSetFolder(): - global _curfolder - rv = _curfolder - _curfolder = None - return rv - -def GetDirectory(prompt=None): - """Ask the user to select a folder. Optionally you can give a prompt.""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, - defaultLocation=_handleSetFolder()) - return fss, not fss is None diff --git a/sys/lib/python/plat-mac/macostools.py b/sys/lib/python/plat-mac/macostools.py deleted file mode 100644 index f7ce46826..000000000 --- a/sys/lib/python/plat-mac/macostools.py +++ /dev/null @@ -1,142 +0,0 @@ -"""macostools - Various utility functions for MacOS. - -mkalias(src, dst) - Create a finder alias 'dst' pointing to 'src' -copy(src, dst) - Full copy of 'src' to 'dst' -""" - -from Carbon import Res -from Carbon import File, Files -import os -import sys -import MacOS -import time -try: - openrf = MacOS.openrf -except AttributeError: - # Backward compatibility - openrf = open - -Error = 'macostools.Error' - -BUFSIZ=0x80000 # Copy in 0.5Mb chunks - -COPY_FLAGS = (Files.kIsStationary|Files.kNameLocked|Files.kHasBundle| - Files.kIsInvisible|Files.kIsAlias) - -# -# Not guaranteed to be correct or stay correct (Apple doesn't tell you -# how to do this), but it seems to work. -# -def mkalias(src, dst, relative=None): - """Create a finder alias""" - srcfsr = File.FSRef(src) - # The next line will fail under unix-Python if the destination - # doesn't exist yet. We should change this code to be fsref-based. - dstdir, dstname = os.path.split(dst) - if not dstdir: dstdir = os.curdir - dstdirfsr = File.FSRef(dstdir) - if relative: - relativefsr = File.FSRef(relative) - # ik mag er geen None in stoppen :-( - alias = File.FSNewAlias(relativefsr, srcfsr) - else: - alias = srcfsr.FSNewAliasMinimal() - - dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, unicode(dstname), - File.FSGetResourceForkName()) - h = Res.FSOpenResourceFile(dstfsr, File.FSGetResourceForkName(), 3) - resource = Res.Resource(alias.data) - resource.AddResource('alis', 0, '') - Res.CloseResFile(h) - - dstfinfo = dstfss.FSpGetFInfo() - dstfinfo.Flags = dstfinfo.Flags|0x8000 # Alias flag - dstfss.FSpSetFInfo(dstfinfo) - -def mkdirs(dst): - """Make directories leading to 'dst' if they don't exist yet""" - if dst == '' or os.path.exists(dst): - return - head, tail = os.path.split(dst) - if os.sep == ':' and not ':' in head: - head = head + ':' - mkdirs(head) - os.mkdir(dst, 0777) - -def touched(dst): - """Tell the finder a file has changed. No-op on MacOSX.""" - if sys.platform != 'mac': return - import warnings - warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) - import macfs - file_fss = macfs.FSSpec(dst) - vRefNum, dirID, name = file_fss.as_tuple() - dir_fss = macfs.FSSpec((vRefNum, dirID, '')) - crdate, moddate, bkdate = dir_fss.GetDates() - now = time.time() - if now == moddate: - now = now + 1 - try: - dir_fss.SetDates(crdate, now, bkdate) - except macfs.error: - pass - -def touched_ae(dst): - """Tell the finder a file has changed""" - pardir = os.path.split(dst)[0] - if not pardir: - pardir = os.curdir - import Finder - f = Finder.Finder() - f.update(File.FSRef(pardir)) - -def copy(src, dst, createpath=0, copydates=1, forcetype=None): - """Copy a file, including finder info, resource fork, etc""" - src = File.pathname(src) - dst = File.pathname(dst) - if createpath: - mkdirs(os.path.split(dst)[0]) - - ifp = open(src, 'rb') - ofp = open(dst, 'wb') - d = ifp.read(BUFSIZ) - while d: - ofp.write(d) - d = ifp.read(BUFSIZ) - ifp.close() - ofp.close() - - ifp = openrf(src, '*rb') - ofp = openrf(dst, '*wb') - d = ifp.read(BUFSIZ) - while d: - ofp.write(d) - d = ifp.read(BUFSIZ) - ifp.close() - ofp.close() - - srcfss = File.FSSpec(src) - dstfss = File.FSSpec(dst) - sf = srcfss.FSpGetFInfo() - df = dstfss.FSpGetFInfo() - df.Creator, df.Type = sf.Creator, sf.Type - if forcetype != None: - df.Type = forcetype - df.Flags = (sf.Flags & COPY_FLAGS) - dstfss.FSpSetFInfo(df) - if copydates: - srcfsr = File.FSRef(src) - dstfsr = File.FSRef(dst) - catinfo, _, _, _ = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates) - dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo) - touched(dstfss) - -def copytree(src, dst, copydates=1): - """Copy a complete file tree to a new destination""" - if os.path.isdir(src): - mkdirs(dst) - files = os.listdir(src) - for f in files: - copytree(os.path.join(src, f), os.path.join(dst, f), copydates) - else: - copy(src, dst, 1, copydates) diff --git a/sys/lib/python/plat-mac/macresource.py b/sys/lib/python/plat-mac/macresource.py deleted file mode 100644 index f68ecdc8a..000000000 --- a/sys/lib/python/plat-mac/macresource.py +++ /dev/null @@ -1,146 +0,0 @@ -"""macresource - Locate and open the resources needed for a script.""" - -from Carbon import Res -import os -import sys -import MacOS -import macostools - -class ArgumentError(TypeError): pass -class ResourceFileNotFoundError(ImportError): pass - -def need(restype, resid, filename=None, modname=None): - """Open a resource file, if needed. restype and resid - are required parameters, and identify the resource for which to test. If it - is available we are done. If it is not available we look for a file filename - (default: modname with .rsrc appended) either in the same folder as - where modname was loaded from, or otherwise across sys.path. - - Returns the refno of the resource file opened (or None)""" - - if modname is None and filename is None: - raise ArgumentError, "Either filename or modname argument (or both) must be given" - - if type(resid) is type(1): - try: - h = Res.GetResource(restype, resid) - except Res.Error: - pass - else: - return None - else: - try: - h = Res.GetNamedResource(restype, resid) - except Res.Error: - pass - else: - return None - - # Construct a filename if we don't have one - if not filename: - if '.' in modname: - filename = modname.split('.')[-1] + '.rsrc' - else: - filename = modname + '.rsrc' - - # Now create a list of folders to search - searchdirs = [] - if modname == '__main__': - # If we're main we look in the current directory - searchdirs = [os.curdir] - if sys.modules.has_key(modname): - mod = sys.modules[modname] - if hasattr(mod, '__file__'): - searchdirs = [os.path.dirname(mod.__file__)] - searchdirs.extend(sys.path) - - # And look for the file - for dir in searchdirs: - pathname = os.path.join(dir, filename) - if os.path.exists(pathname): - break - else: - raise ResourceFileNotFoundError, filename - - refno = open_pathname(pathname) - - # And check that the resource exists now - if type(resid) is type(1): - h = Res.GetResource(restype, resid) - else: - h = Res.GetNamedResource(restype, resid) - return refno - -def open_pathname(pathname, verbose=0): - """Open a resource file given by pathname, possibly decoding an - AppleSingle file""" - try: - refno = Res.FSpOpenResFile(pathname, 1) - except Res.Error, arg: - if arg[0] in (-37, -39): - # No resource fork. We may be on OSX, and this may be either - # a data-fork based resource file or a AppleSingle file - # from the CVS repository. - try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) - except Res.Error, arg: - if arg[0] != -199: - # -199 is "bad resource map" - raise - else: - return refno - # Finally try decoding an AppleSingle file - pathname = _decode(pathname, verbose=verbose) - refno = Res.FSOpenResourceFile(pathname, u'', 1) - else: - raise - return refno - -def resource_pathname(pathname, verbose=0): - """Return the pathname for a resource file (either DF or RF based). - If the pathname given already refers to such a file simply return it, - otherwise first decode it.""" - try: - refno = Res.FSpOpenResFile(pathname, 1) - Res.CloseResFile(refno) - except Res.Error, arg: - if arg[0] in (-37, -39): - # No resource fork. We may be on OSX, and this may be either - # a data-fork based resource file or a AppleSingle file - # from the CVS repository. - try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) - except Res.Error, arg: - if arg[0] != -199: - # -199 is "bad resource map" - raise - else: - return refno - # Finally try decoding an AppleSingle file - pathname = _decode(pathname, verbose=verbose) - else: - raise - return pathname - -def open_error_resource(): - """Open the resource file containing the error code to error message - mapping.""" - need('Estr', 1, filename="errors.rsrc", modname=__name__) - -def _decode(pathname, verbose=0): - # Decode an AppleSingle resource file, return the new pathname. - newpathname = pathname + '.df.rsrc' - if os.path.exists(newpathname) and \ - os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: - return newpathname - if hasattr(os, 'access') and not \ - os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): - # The destination directory isn't writeable. Create the file in - # a temporary directory - import tempfile - fd, newpathname = tempfile.mkstemp(".rsrc") - if verbose: - print 'Decoding', pathname, 'to', newpathname - import applesingle - applesingle.decode(pathname, newpathname, resonly=1) - return newpathname diff --git a/sys/lib/python/plat-mac/pimp.py b/sys/lib/python/plat-mac/pimp.py deleted file mode 100644 index 456427c1c..000000000 --- a/sys/lib/python/plat-mac/pimp.py +++ /dev/null @@ -1,1177 +0,0 @@ -"""Package Install Manager for Python. - -This is currently a MacOSX-only strawman implementation. -Despite other rumours the name stands for "Packman IMPlementation". - -Tools to allow easy installation of packages. The idea is that there is -an online XML database per (platform, python-version) containing packages -known to work with that combination. This module contains tools for getting -and parsing the database, testing whether packages are installed, computing -dependencies and installing packages. - -There is a minimal main program that works as a command line tool, but the -intention is that the end user will use this through a GUI. -""" -import sys -import os -import popen2 -import urllib -import urllib2 -import urlparse -import plistlib -import distutils.util -import distutils.sysconfig -import hashlib -import tarfile -import tempfile -import shutil -import time - -__all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", - "getDefaultDatabase", "PIMP_VERSION", "main"] - -_scriptExc_NotInstalled = "pimp._scriptExc_NotInstalled" -_scriptExc_OldInstalled = "pimp._scriptExc_OldInstalled" -_scriptExc_BadInstalled = "pimp._scriptExc_BadInstalled" - -NO_EXECUTE=0 - -PIMP_VERSION="0.5" - -# Flavors: -# source: setup-based package -# binary: tar (or other) archive created with setup.py bdist. -# installer: something that can be opened -DEFAULT_FLAVORORDER=['source', 'binary', 'installer'] -DEFAULT_DOWNLOADDIR='/tmp' -DEFAULT_BUILDDIR='/tmp' -DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() -DEFAULT_PIMPDATABASE_FMT="http://www.python.org/packman/version-%s/%s-%s-%s-%s-%s.plist" - -def getDefaultDatabase(experimental=False): - if experimental: - status = "exp" - else: - status = "prod" - - major, minor, micro, state, extra = sys.version_info - pyvers = '%d.%d' % (major, minor) - if micro == 0 and state != 'final': - pyvers = pyvers + '%s%d' % (state, extra) - - longplatform = distutils.util.get_platform() - osname, release, machine = longplatform.split('-') - # For some platforms we may want to differentiate between - # installation types - if osname == 'darwin': - if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'): - osname = 'darwin_apple' - elif sys.prefix.startswith('/Library/Frameworks/Python.framework'): - osname = 'darwin_macpython' - # Otherwise we don't know... - # Now we try various URLs by playing with the release string. - # We remove numbers off the end until we find a match. - rel = release - while True: - url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine) - try: - urllib2.urlopen(url) - except urllib2.HTTPError, arg: - pass - else: - break - if not rel: - # We're out of version numbers to try. Use the - # full release number, this will give a reasonable - # error message later - url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine) - break - idx = rel.rfind('.') - if idx < 0: - rel = '' - else: - rel = rel[:idx] - return url - -def _cmd(output, dir, *cmditems): - """Internal routine to run a shell command in a given directory.""" - - cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) - if output: - output.write("+ %s\n" % cmd) - if NO_EXECUTE: - return 0 - child = popen2.Popen4(cmd) - child.tochild.close() - while 1: - line = child.fromchild.readline() - if not line: - break - if output: - output.write(line) - return child.wait() - -class PimpDownloader: - """Abstract base class - Downloader for archives""" - - def __init__(self, argument, - dir="", - watcher=None): - self.argument = argument - self._dir = dir - self._watcher = watcher - - def download(self, url, filename, output=None): - return None - - def update(self, str): - if self._watcher: - return self._watcher.update(str) - return True - -class PimpCurlDownloader(PimpDownloader): - - def download(self, url, filename, output=None): - self.update("Downloading %s..." % url) - exitstatus = _cmd(output, self._dir, - "curl", - "--output", filename, - url) - self.update("Downloading %s: finished" % url) - return (not exitstatus) - -class PimpUrllibDownloader(PimpDownloader): - - def download(self, url, filename, output=None): - output = open(filename, 'wb') - self.update("Downloading %s: opening connection" % url) - keepgoing = True - download = urllib2.urlopen(url) - if download.headers.has_key("content-length"): - length = long(download.headers['content-length']) - else: - length = -1 - - data = download.read(4096) #read 4K at a time - dlsize = 0 - lasttime = 0 - while keepgoing: - dlsize = dlsize + len(data) - if len(data) == 0: - #this is our exit condition - break - output.write(data) - if int(time.time()) != lasttime: - # Update at most once per second - lasttime = int(time.time()) - if length == -1: - keepgoing = self.update("Downloading %s: %d bytes..." % (url, dlsize)) - else: - keepgoing = self.update("Downloading %s: %d%% (%d bytes)..." % (url, int(100.0*dlsize/length), dlsize)) - data = download.read(4096) - if keepgoing: - self.update("Downloading %s: finished" % url) - return keepgoing - -class PimpUnpacker: - """Abstract base class - Unpacker for archives""" - - _can_rename = False - - def __init__(self, argument, - dir="", - renames=[], - watcher=None): - self.argument = argument - if renames and not self._can_rename: - raise RuntimeError, "This unpacker cannot rename files" - self._dir = dir - self._renames = renames - self._watcher = watcher - - def unpack(self, archive, output=None, package=None): - return None - - def update(self, str): - if self._watcher: - return self._watcher.update(str) - return True - -class PimpCommandUnpacker(PimpUnpacker): - """Unpack archives by calling a Unix utility""" - - _can_rename = False - - def unpack(self, archive, output=None, package=None): - cmd = self.argument % archive - if _cmd(output, self._dir, cmd): - return "unpack command failed" - -class PimpTarUnpacker(PimpUnpacker): - """Unpack tarfiles using the builtin tarfile module""" - - _can_rename = True - - def unpack(self, archive, output=None, package=None): - tf = tarfile.open(archive, "r") - members = tf.getmembers() - skip = [] - if self._renames: - for member in members: - for oldprefix, newprefix in self._renames: - if oldprefix[:len(self._dir)] == self._dir: - oldprefix2 = oldprefix[len(self._dir):] - else: - oldprefix2 = None - if member.name[:len(oldprefix)] == oldprefix: - if newprefix is None: - skip.append(member) - #print 'SKIP', member.name - else: - member.name = newprefix + member.name[len(oldprefix):] - print ' ', member.name - break - elif oldprefix2 and member.name[:len(oldprefix2)] == oldprefix2: - if newprefix is None: - skip.append(member) - #print 'SKIP', member.name - else: - member.name = newprefix + member.name[len(oldprefix2):] - #print ' ', member.name - break - else: - skip.append(member) - #print '????', member.name - for member in members: - if member in skip: - self.update("Skipping %s" % member.name) - continue - self.update("Extracting %s" % member.name) - tf.extract(member, self._dir) - if skip: - names = [member.name for member in skip if member.name[-1] != '/'] - if package: - names = package.filterExpectedSkips(names) - if names: - return "Not all files were unpacked: %s" % " ".join(names) - -ARCHIVE_FORMATS = [ - (".tar.Z", PimpTarUnpacker, None), - (".taz", PimpTarUnpacker, None), - (".tar.gz", PimpTarUnpacker, None), - (".tgz", PimpTarUnpacker, None), - (".tar.bz", PimpTarUnpacker, None), - (".zip", PimpCommandUnpacker, "unzip \"%s\""), -] - -class PimpPreferences: - """Container for per-user preferences, such as the database to use - and where to install packages.""" - - def __init__(self, - flavorOrder=None, - downloadDir=None, - buildDir=None, - installDir=None, - pimpDatabase=None): - if not flavorOrder: - flavorOrder = DEFAULT_FLAVORORDER - if not downloadDir: - downloadDir = DEFAULT_DOWNLOADDIR - if not buildDir: - buildDir = DEFAULT_BUILDDIR - if not pimpDatabase: - pimpDatabase = getDefaultDatabase() - self.setInstallDir(installDir) - self.flavorOrder = flavorOrder - self.downloadDir = downloadDir - self.buildDir = buildDir - self.pimpDatabase = pimpDatabase - self.watcher = None - - def setWatcher(self, watcher): - self.watcher = watcher - - def setInstallDir(self, installDir=None): - if installDir: - # Installing to non-standard location. - self.installLocations = [ - ('--install-lib', installDir), - ('--install-headers', None), - ('--install-scripts', None), - ('--install-data', None)] - else: - installDir = DEFAULT_INSTALLDIR - self.installLocations = [] - self.installDir = installDir - - def isUserInstall(self): - return self.installDir != DEFAULT_INSTALLDIR - - def check(self): - """Check that the preferences make sense: directories exist and are - writable, the install directory is on sys.path, etc.""" - - rv = "" - RWX_OK = os.R_OK|os.W_OK|os.X_OK - if not os.path.exists(self.downloadDir): - rv += "Warning: Download directory \"%s\" does not exist\n" % self.downloadDir - elif not os.access(self.downloadDir, RWX_OK): - rv += "Warning: Download directory \"%s\" is not writable or not readable\n" % self.downloadDir - if not os.path.exists(self.buildDir): - rv += "Warning: Build directory \"%s\" does not exist\n" % self.buildDir - elif not os.access(self.buildDir, RWX_OK): - rv += "Warning: Build directory \"%s\" is not writable or not readable\n" % self.buildDir - if not os.path.exists(self.installDir): - rv += "Warning: Install directory \"%s\" does not exist\n" % self.installDir - elif not os.access(self.installDir, RWX_OK): - rv += "Warning: Install directory \"%s\" is not writable or not readable\n" % self.installDir - else: - installDir = os.path.realpath(self.installDir) - for p in sys.path: - try: - realpath = os.path.realpath(p) - except: - pass - if installDir == realpath: - break - else: - rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir - return rv - - def compareFlavors(self, left, right): - """Compare two flavor strings. This is part of your preferences - because whether the user prefers installing from source or binary is.""" - if left in self.flavorOrder: - if right in self.flavorOrder: - return cmp(self.flavorOrder.index(left), self.flavorOrder.index(right)) - return -1 - if right in self.flavorOrder: - return 1 - return cmp(left, right) - -class PimpDatabase: - """Class representing a pimp database. It can actually contain - information from multiple databases through inclusion, but the - toplevel database is considered the master, as its maintainer is - "responsible" for the contents.""" - - def __init__(self, prefs): - self._packages = [] - self.preferences = prefs - self._url = "" - self._urllist = [] - self._version = "" - self._maintainer = "" - self._description = "" - - # Accessor functions - def url(self): return self._url - def version(self): return self._version - def maintainer(self): return self._maintainer - def description(self): return self._description - - def close(self): - """Clean up""" - self._packages = [] - self.preferences = None - - def appendURL(self, url, included=0): - """Append packages from the database with the given URL. - Only the first database should specify included=0, so the - global information (maintainer, description) get stored.""" - - if url in self._urllist: - return - self._urllist.append(url) - fp = urllib2.urlopen(url).fp - plistdata = plistlib.Plist.fromFile(fp) - # Test here for Pimp version, etc - if included: - version = plistdata.get('Version') - if version and version > self._version: - sys.stderr.write("Warning: included database %s is for pimp version %s\n" % - (url, version)) - else: - self._version = plistdata.get('Version') - if not self._version: - sys.stderr.write("Warning: database has no Version information\n") - elif self._version > PIMP_VERSION: - sys.stderr.write("Warning: database version %s newer than pimp version %s\n" - % (self._version, PIMP_VERSION)) - self._maintainer = plistdata.get('Maintainer', '') - self._description = plistdata.get('Description', '').strip() - self._url = url - self._appendPackages(plistdata['Packages'], url) - others = plistdata.get('Include', []) - for o in others: - o = urllib.basejoin(url, o) - self.appendURL(o, included=1) - - def _appendPackages(self, packages, url): - """Given a list of dictionaries containing package - descriptions create the PimpPackage objects and append them - to our internal storage.""" - - for p in packages: - p = dict(p) - if p.has_key('Download-URL'): - p['Download-URL'] = urllib.basejoin(url, p['Download-URL']) - flavor = p.get('Flavor') - if flavor == 'source': - pkg = PimpPackage_source(self, p) - elif flavor == 'binary': - pkg = PimpPackage_binary(self, p) - elif flavor == 'installer': - pkg = PimpPackage_installer(self, p) - elif flavor == 'hidden': - pkg = PimpPackage_installer(self, p) - else: - pkg = PimpPackage(self, dict(p)) - self._packages.append(pkg) - - def list(self): - """Return a list of all PimpPackage objects in the database.""" - - return self._packages - - def listnames(self): - """Return a list of names of all packages in the database.""" - - rv = [] - for pkg in self._packages: - rv.append(pkg.fullname()) - rv.sort() - return rv - - def dump(self, pathOrFile): - """Dump the contents of the database to an XML .plist file. - - The file can be passed as either a file object or a pathname. - All data, including included databases, is dumped.""" - - packages = [] - for pkg in self._packages: - packages.append(pkg.dump()) - plistdata = { - 'Version': self._version, - 'Maintainer': self._maintainer, - 'Description': self._description, - 'Packages': packages - } - plist = plistlib.Plist(**plistdata) - plist.write(pathOrFile) - - def find(self, ident): - """Find a package. The package can be specified by name - or as a dictionary with name, version and flavor entries. - - Only name is obligatory. If there are multiple matches the - best one (higher version number, flavors ordered according to - users' preference) is returned.""" - - if type(ident) == str: - # Remove ( and ) for pseudo-packages - if ident[0] == '(' and ident[-1] == ')': - ident = ident[1:-1] - # Split into name-version-flavor - fields = ident.split('-') - if len(fields) < 1 or len(fields) > 3: - return None - name = fields[0] - if len(fields) > 1: - version = fields[1] - else: - version = None - if len(fields) > 2: - flavor = fields[2] - else: - flavor = None - else: - name = ident['Name'] - version = ident.get('Version') - flavor = ident.get('Flavor') - found = None - for p in self._packages: - if name == p.name() and \ - (not version or version == p.version()) and \ - (not flavor or flavor == p.flavor()): - if not found or found < p: - found = p - return found - -ALLOWED_KEYS = [ - "Name", - "Version", - "Flavor", - "Description", - "Home-page", - "Download-URL", - "Install-test", - "Install-command", - "Pre-install-command", - "Post-install-command", - "Prerequisites", - "MD5Sum", - "User-install-skips", - "Systemwide-only", -] - -class PimpPackage: - """Class representing a single package.""" - - def __init__(self, db, plistdata): - self._db = db - name = plistdata["Name"] - for k in plistdata.keys(): - if not k in ALLOWED_KEYS: - sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) - self._dict = plistdata - - def __getitem__(self, key): - return self._dict[key] - - def name(self): return self._dict['Name'] - def version(self): return self._dict.get('Version') - def flavor(self): return self._dict.get('Flavor') - def description(self): return self._dict['Description'].strip() - def shortdescription(self): return self.description().splitlines()[0] - def homepage(self): return self._dict.get('Home-page') - def downloadURL(self): return self._dict.get('Download-URL') - def systemwideOnly(self): return self._dict.get('Systemwide-only') - - def fullname(self): - """Return the full name "name-version-flavor" of a package. - - If the package is a pseudo-package, something that cannot be - installed through pimp, return the name in (parentheses).""" - - rv = self._dict['Name'] - if self._dict.has_key('Version'): - rv = rv + '-%s' % self._dict['Version'] - if self._dict.has_key('Flavor'): - rv = rv + '-%s' % self._dict['Flavor'] - if self._dict.get('Flavor') == 'hidden': - # Pseudo-package, show in parentheses - rv = '(%s)' % rv - return rv - - def dump(self): - """Return a dict object containing the information on the package.""" - return self._dict - - def __cmp__(self, other): - """Compare two packages, where the "better" package sorts lower.""" - - if not isinstance(other, PimpPackage): - return cmp(id(self), id(other)) - if self.name() != other.name(): - return cmp(self.name(), other.name()) - if self.version() != other.version(): - return -cmp(self.version(), other.version()) - return self._db.preferences.compareFlavors(self.flavor(), other.flavor()) - - def installed(self): - """Test wheter the package is installed. - - Returns two values: a status indicator which is one of - "yes", "no", "old" (an older version is installed) or "bad" - (something went wrong during the install test) and a human - readable string which may contain more details.""" - - namespace = { - "NotInstalled": _scriptExc_NotInstalled, - "OldInstalled": _scriptExc_OldInstalled, - "BadInstalled": _scriptExc_BadInstalled, - "os": os, - "sys": sys, - } - installTest = self._dict['Install-test'].strip() + '\n' - try: - exec installTest in namespace - except ImportError, arg: - return "no", str(arg) - except _scriptExc_NotInstalled, arg: - return "no", str(arg) - except _scriptExc_OldInstalled, arg: - return "old", str(arg) - except _scriptExc_BadInstalled, arg: - return "bad", str(arg) - except: - sys.stderr.write("-------------------------------------\n") - sys.stderr.write("---- %s: install test got exception\n" % self.fullname()) - sys.stderr.write("---- source:\n") - sys.stderr.write(installTest) - sys.stderr.write("---- exception:\n") - import traceback - traceback.print_exc(file=sys.stderr) - if self._db._maintainer: - sys.stderr.write("---- Please copy this and mail to %s\n" % self._db._maintainer) - sys.stderr.write("-------------------------------------\n") - return "bad", "Package install test got exception" - return "yes", "" - - def prerequisites(self): - """Return a list of prerequisites for this package. - - The list contains 2-tuples, of which the first item is either - a PimpPackage object or None, and the second is a descriptive - string. The first item can be None if this package depends on - something that isn't pimp-installable, in which case the descriptive - string should tell the user what to do.""" - - rv = [] - if not self._dict.get('Download-URL'): - # For pseudo-packages that are already installed we don't - # return an error message - status, _ = self.installed() - if status == "yes": - return [] - return [(None, - "Package %s cannot be installed automatically, see the description" % - self.fullname())] - if self.systemwideOnly() and self._db.preferences.isUserInstall(): - return [(None, - "Package %s can only be installed system-wide" % - self.fullname())] - if not self._dict.get('Prerequisites'): - return [] - for item in self._dict['Prerequisites']: - if type(item) == str: - pkg = None - descr = str(item) - else: - name = item['Name'] - if item.has_key('Version'): - name = name + '-' + item['Version'] - if item.has_key('Flavor'): - name = name + '-' + item['Flavor'] - pkg = self._db.find(name) - if not pkg: - descr = "Requires unknown %s"%name - else: - descr = pkg.shortdescription() - rv.append((pkg, descr)) - return rv - - - def downloadPackageOnly(self, output=None): - """Download a single package, if needed. - - An MD5 signature is used to determine whether download is needed, - and to test that we actually downloaded what we expected. - If output is given it is a file-like object that will receive a log - of what happens. - - If anything unforeseen happened the method returns an error message - string. - """ - - scheme, loc, path, query, frag = urlparse.urlsplit(self._dict['Download-URL']) - path = urllib.url2pathname(path) - filename = os.path.split(path)[1] - self.archiveFilename = os.path.join(self._db.preferences.downloadDir, filename) - if not self._archiveOK(): - if scheme == 'manual': - return "Please download package manually and save as %s" % self.archiveFilename - downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir, - watcher=self._db.preferences.watcher) - if not downloader.download(self._dict['Download-URL'], - self.archiveFilename, output): - return "download command failed" - if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: - return "archive not found after download" - if not self._archiveOK(): - return "archive does not have correct MD5 checksum" - - def _archiveOK(self): - """Test an archive. It should exist and the MD5 checksum should be correct.""" - - if not os.path.exists(self.archiveFilename): - return 0 - if not self._dict.get('MD5Sum'): - sys.stderr.write("Warning: no MD5Sum for %s\n" % self.fullname()) - return 1 - data = open(self.archiveFilename, 'rb').read() - checksum = hashlib.md5(data).hexdigest() - return checksum == self._dict['MD5Sum'] - - def unpackPackageOnly(self, output=None): - """Unpack a downloaded package archive.""" - - filename = os.path.split(self.archiveFilename)[1] - for ext, unpackerClass, arg in ARCHIVE_FORMATS: - if filename[-len(ext):] == ext: - break - else: - return "unknown extension for archive file: %s" % filename - self.basename = filename[:-len(ext)] - unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir, - watcher=self._db.preferences.watcher) - rv = unpacker.unpack(self.archiveFilename, output=output) - if rv: - return rv - - def installPackageOnly(self, output=None): - """Default install method, to be overridden by subclasses""" - return "%s: This package needs to be installed manually (no support for flavor=\"%s\")" \ - % (self.fullname(), self._dict.get(flavor, "")) - - def installSinglePackage(self, output=None): - """Download, unpack and install a single package. - - If output is given it should be a file-like object and it - will receive a log of what happened.""" - - if not self._dict.get('Download-URL'): - return "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname() - msg = self.downloadPackageOnly(output) - if msg: - return "%s: download: %s" % (self.fullname(), msg) - - msg = self.unpackPackageOnly(output) - if msg: - return "%s: unpack: %s" % (self.fullname(), msg) - - return self.installPackageOnly(output) - - def beforeInstall(self): - """Bookkeeping before installation: remember what we have in site-packages""" - self._old_contents = os.listdir(self._db.preferences.installDir) - - def afterInstall(self): - """Bookkeeping after installation: interpret any new .pth files that have - appeared""" - - new_contents = os.listdir(self._db.preferences.installDir) - for fn in new_contents: - if fn in self._old_contents: - continue - if fn[-4:] != '.pth': - continue - fullname = os.path.join(self._db.preferences.installDir, fn) - f = open(fullname) - for line in f.readlines(): - if not line: - continue - if line[0] == '#': - continue - if line[:6] == 'import': - exec line - continue - if line[-1] == '\n': - line = line[:-1] - if not os.path.isabs(line): - line = os.path.join(self._db.preferences.installDir, line) - line = os.path.realpath(line) - if not line in sys.path: - sys.path.append(line) - - def filterExpectedSkips(self, names): - """Return a list that contains only unpexpected skips""" - if not self._db.preferences.isUserInstall(): - return names - expected_skips = self._dict.get('User-install-skips') - if not expected_skips: - return names - newnames = [] - for name in names: - for skip in expected_skips: - if name[:len(skip)] == skip: - break - else: - newnames.append(name) - return newnames - -class PimpPackage_binary(PimpPackage): - - def unpackPackageOnly(self, output=None): - """We don't unpack binary packages until installing""" - pass - - def installPackageOnly(self, output=None): - """Install a single source package. - - If output is given it should be a file-like object and it - will receive a log of what happened.""" - - if self._dict.has_key('Install-command'): - return "%s: Binary package cannot have Install-command" % self.fullname() - - if self._dict.has_key('Pre-install-command'): - if _cmd(output, '/tmp', self._dict['Pre-install-command']): - return "pre-install %s: running \"%s\" failed" % \ - (self.fullname(), self._dict['Pre-install-command']) - - self.beforeInstall() - - # Install by unpacking - filename = os.path.split(self.archiveFilename)[1] - for ext, unpackerClass, arg in ARCHIVE_FORMATS: - if filename[-len(ext):] == ext: - break - else: - return "%s: unknown extension for archive file: %s" % (self.fullname(), filename) - self.basename = filename[:-len(ext)] - - install_renames = [] - for k, newloc in self._db.preferences.installLocations: - if not newloc: - continue - if k == "--install-lib": - oldloc = DEFAULT_INSTALLDIR - else: - return "%s: Don't know installLocation %s" % (self.fullname(), k) - install_renames.append((oldloc, newloc)) - - unpacker = unpackerClass(arg, dir="/", renames=install_renames) - rv = unpacker.unpack(self.archiveFilename, output=output, package=self) - if rv: - return rv - - self.afterInstall() - - if self._dict.has_key('Post-install-command'): - if _cmd(output, '/tmp', self._dict['Post-install-command']): - return "%s: post-install: running \"%s\" failed" % \ - (self.fullname(), self._dict['Post-install-command']) - - return None - - -class PimpPackage_source(PimpPackage): - - def unpackPackageOnly(self, output=None): - """Unpack a source package and check that setup.py exists""" - PimpPackage.unpackPackageOnly(self, output) - # Test that a setup script has been create - self._buildDirname = os.path.join(self._db.preferences.buildDir, self.basename) - setupname = os.path.join(self._buildDirname, "setup.py") - if not os.path.exists(setupname) and not NO_EXECUTE: - return "no setup.py found after unpack of archive" - - def installPackageOnly(self, output=None): - """Install a single source package. - - If output is given it should be a file-like object and it - will receive a log of what happened.""" - - if self._dict.has_key('Pre-install-command'): - if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): - return "pre-install %s: running \"%s\" failed" % \ - (self.fullname(), self._dict['Pre-install-command']) - - self.beforeInstall() - installcmd = self._dict.get('Install-command') - if installcmd and self._install_renames: - return "Package has install-command and can only be installed to standard location" - # This is the "bit-bucket" for installations: everything we don't - # want. After installation we check that it is actually empty - unwanted_install_dir = None - if not installcmd: - extra_args = "" - for k, v in self._db.preferences.installLocations: - if not v: - # We don't want these files installed. Send them - # to the bit-bucket. - if not unwanted_install_dir: - unwanted_install_dir = tempfile.mkdtemp() - v = unwanted_install_dir - extra_args = extra_args + " %s \"%s\"" % (k, v) - installcmd = '"%s" setup.py install %s' % (sys.executable, extra_args) - if _cmd(output, self._buildDirname, installcmd): - return "install %s: running \"%s\" failed" % \ - (self.fullname(), installcmd) - if unwanted_install_dir and os.path.exists(unwanted_install_dir): - unwanted_files = os.listdir(unwanted_install_dir) - if unwanted_files: - rv = "Warning: some files were not installed: %s" % " ".join(unwanted_files) - else: - rv = None - shutil.rmtree(unwanted_install_dir) - return rv - - self.afterInstall() - - if self._dict.has_key('Post-install-command'): - if _cmd(output, self._buildDirname, self._dict['Post-install-command']): - return "post-install %s: running \"%s\" failed" % \ - (self.fullname(), self._dict['Post-install-command']) - return None - -class PimpPackage_installer(PimpPackage): - - def unpackPackageOnly(self, output=None): - """We don't unpack dmg packages until installing""" - pass - - def installPackageOnly(self, output=None): - """Install a single source package. - - If output is given it should be a file-like object and it - will receive a log of what happened.""" - - if self._dict.has_key('Post-install-command'): - return "%s: Installer package cannot have Post-install-command" % self.fullname() - - if self._dict.has_key('Pre-install-command'): - if _cmd(output, '/tmp', self._dict['Pre-install-command']): - return "pre-install %s: running \"%s\" failed" % \ - (self.fullname(), self._dict['Pre-install-command']) - - self.beforeInstall() - - installcmd = self._dict.get('Install-command') - if installcmd: - if '%' in installcmd: - installcmd = installcmd % self.archiveFilename - else: - installcmd = 'open \"%s\"' % self.archiveFilename - if _cmd(output, "/tmp", installcmd): - return '%s: install command failed (use verbose for details)' % self.fullname() - return '%s: downloaded and opened. Install manually and restart Package Manager' % self.archiveFilename - -class PimpInstaller: - """Installer engine: computes dependencies and installs - packages in the right order.""" - - def __init__(self, db): - self._todo = [] - self._db = db - self._curtodo = [] - self._curmessages = [] - - def __contains__(self, package): - return package in self._todo - - def _addPackages(self, packages): - for package in packages: - if not package in self._todo: - self._todo.append(package) - - def _prepareInstall(self, package, force=0, recursive=1): - """Internal routine, recursive engine for prepareInstall. - - Test whether the package is installed and (if not installed - or if force==1) prepend it to the temporary todo list and - call ourselves recursively on all prerequisites.""" - - if not force: - status, message = package.installed() - if status == "yes": - return - if package in self._todo or package in self._curtodo: - return - self._curtodo.insert(0, package) - if not recursive: - return - prereqs = package.prerequisites() - for pkg, descr in prereqs: - if pkg: - self._prepareInstall(pkg, False, recursive) - else: - self._curmessages.append("Problem with dependency: %s" % descr) - - def prepareInstall(self, package, force=0, recursive=1): - """Prepare installation of a package. - - If the package is already installed and force is false nothing - is done. If recursive is true prerequisites are installed first. - - Returns a list of packages (to be passed to install) and a list - of messages of any problems encountered. - """ - - self._curtodo = [] - self._curmessages = [] - self._prepareInstall(package, force, recursive) - rv = self._curtodo, self._curmessages - self._curtodo = [] - self._curmessages = [] - return rv - - def install(self, packages, output): - """Install a list of packages.""" - - self._addPackages(packages) - status = [] - for pkg in self._todo: - msg = pkg.installSinglePackage(output) - if msg: - status.append(msg) - return status - - - -def _run(mode, verbose, force, args, prefargs, watcher): - """Engine for the main program""" - - prefs = PimpPreferences(**prefargs) - if watcher: - prefs.setWatcher(watcher) - rv = prefs.check() - if rv: - sys.stdout.write(rv) - db = PimpDatabase(prefs) - db.appendURL(prefs.pimpDatabase) - - if mode == 'dump': - db.dump(sys.stdout) - elif mode =='list': - if not args: - args = db.listnames() - print "%-20.20s\t%s" % ("Package", "Description") - print - for pkgname in args: - pkg = db.find(pkgname) - if pkg: - description = pkg.shortdescription() - pkgname = pkg.fullname() - else: - description = 'Error: no such package' - print "%-20.20s\t%s" % (pkgname, description) - if verbose: - print "\tHome page:\t", pkg.homepage() - try: - print "\tDownload URL:\t", pkg.downloadURL() - except KeyError: - pass - description = pkg.description() - description = '\n\t\t\t\t\t'.join(description.splitlines()) - print "\tDescription:\t%s" % description - elif mode =='status': - if not args: - args = db.listnames() - print "%-20.20s\t%s\t%s" % ("Package", "Installed", "Message") - print - for pkgname in args: - pkg = db.find(pkgname) - if pkg: - status, msg = pkg.installed() - pkgname = pkg.fullname() - else: - status = 'error' - msg = 'No such package' - print "%-20.20s\t%-9.9s\t%s" % (pkgname, status, msg) - if verbose and status == "no": - prereq = pkg.prerequisites() - for pkg, msg in prereq: - if not pkg: - pkg = '' - else: - pkg = pkg.fullname() - print "%-20.20s\tRequirement: %s %s" % ("", pkg, msg) - elif mode == 'install': - if not args: - print 'Please specify packages to install' - sys.exit(1) - inst = PimpInstaller(db) - for pkgname in args: - pkg = db.find(pkgname) - if not pkg: - print '%s: No such package' % pkgname - continue - list, messages = inst.prepareInstall(pkg, force) - if messages and not force: - print "%s: Not installed:" % pkgname - for m in messages: - print "\t", m - else: - if verbose: - output = sys.stdout - else: - output = None - messages = inst.install(list, output) - if messages: - print "%s: Not installed:" % pkgname - for m in messages: - print "\t", m - -def main(): - """Minimal commandline tool to drive pimp.""" - - import getopt - def _help(): - print "Usage: pimp [options] -s [package ...] List installed status" - print " pimp [options] -l [package ...] Show package information" - print " pimp [options] -i package ... Install packages" - print " pimp -d Dump database to stdout" - print " pimp -V Print version number" - print "Options:" - print " -v Verbose" - print " -f Force installation" - print " -D dir Set destination directory" - print " (default: %s)" % DEFAULT_INSTALLDIR - print " -u url URL for database" - sys.exit(1) - - class _Watcher: - def update(self, msg): - sys.stderr.write(msg + '\r') - return 1 - - try: - opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") - except getopt.GetoptError: - _help() - if not opts and not args: - _help() - mode = None - force = 0 - verbose = 0 - prefargs = {} - watcher = None - for o, a in opts: - if o == '-s': - if mode: - _help() - mode = 'status' - if o == '-l': - if mode: - _help() - mode = 'list' - if o == '-d': - if mode: - _help() - mode = 'dump' - if o == '-V': - if mode: - _help() - mode = 'version' - if o == '-i': - mode = 'install' - if o == '-f': - force = 1 - if o == '-v': - verbose = 1 - watcher = _Watcher() - if o == '-D': - prefargs['installDir'] = a - if o == '-u': - prefargs['pimpDatabase'] = a - if not mode: - _help() - if mode == 'version': - print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) - else: - _run(mode, verbose, force, args, prefargs, watcher) - -# Finally, try to update ourselves to a newer version. -# If the end-user updates pimp through pimp the new version -# will be called pimp_update and live in site-packages -# or somewhere similar -if __name__ != 'pimp_update': - try: - import pimp_update - except ImportError: - pass - else: - if pimp_update.PIMP_VERSION <= PIMP_VERSION: - import warnings - warnings.warn("pimp_update is version %s, not newer than pimp version %s" % - (pimp_update.PIMP_VERSION, PIMP_VERSION)) - else: - from pimp_update import * - -if __name__ == '__main__': - main() diff --git a/sys/lib/python/plat-mac/plistlib.py b/sys/lib/python/plat-mac/plistlib.py deleted file mode 100644 index 49bd5563c..000000000 --- a/sys/lib/python/plat-mac/plistlib.py +++ /dev/null @@ -1,470 +0,0 @@ -"""plistlib.py -- a tool to generate and parse MacOSX .plist files. - -The PropertList (.plist) file format is a simple XML pickle supporting -basic object types, like dictionaries, lists, numbers and strings. -Usually the top level object is a dictionary. - -To write out a plist file, use the writePlist(rootObject, pathOrFile) -function. 'rootObject' is the top level object, 'pathOrFile' is a -filename or a (writable) file object. - -To parse a plist from a file, use the readPlist(pathOrFile) function, -with a file name or a (readable) file object as the only argument. It -returns the top level object (again, usually a dictionary). - -To work with plist data in strings, you can use readPlistFromString() -and writePlistToString(). - -Values can be strings, integers, floats, booleans, tuples, lists, -dictionaries, Data or datetime.datetime objects. String values (including -dictionary keys) may be unicode strings -- they will be written out as -UTF-8. - -The <data> plist type is supported through the Data class. This is a -thin wrapper around a Python string. - -Generate Plist example: - - pl = dict( - aString="Doodah", - aList=["A", "B", 12, 32.1, [1, 2, 3]], - aFloat = 0.1, - anInt = 728, - aDict=dict( - anotherString="<hello & hi there!>", - aUnicodeValue=u'M\xe4ssig, Ma\xdf', - aTrueValue=True, - aFalseValue=False, - ), - someData = Data("<binary gunk>"), - someMoreData = Data("<lots of binary gunk>" * 10), - aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())), - ) - # unicode keys are possible, but a little awkward to use: - pl[u'\xc5benraa'] = "That was a unicode key." - writePlist(pl, fileName) - -Parse Plist example: - - pl = readPlist(pathOrFile) - print pl["aKey"] -""" - - -__all__ = [ - "readPlist", "writePlist", "readPlistFromString", "writePlistToString", - "readPlistFromResource", "writePlistToResource", - "Plist", "Data", "Dict" -] -# Note: the Plist and Dict classes have been deprecated. - -import binascii -import datetime -from cStringIO import StringIO -import re - - -def readPlist(pathOrFile): - """Read a .plist file. 'pathOrFile' may either be a file name or a - (readable) file object. Return the unpacked root object (which - usually is a dictionary). - """ - didOpen = 0 - if isinstance(pathOrFile, (str, unicode)): - pathOrFile = open(pathOrFile) - didOpen = 1 - p = PlistParser() - rootObject = p.parse(pathOrFile) - if didOpen: - pathOrFile.close() - return rootObject - - -def writePlist(rootObject, pathOrFile): - """Write 'rootObject' to a .plist file. 'pathOrFile' may either be a - file name or a (writable) file object. - """ - didOpen = 0 - if isinstance(pathOrFile, (str, unicode)): - pathOrFile = open(pathOrFile, "w") - didOpen = 1 - writer = PlistWriter(pathOrFile) - writer.writeln("<plist version=\"1.0\">") - writer.writeValue(rootObject) - writer.writeln("</plist>") - if didOpen: - pathOrFile.close() - - -def readPlistFromString(data): - """Read a plist data from a string. Return the root object. - """ - return readPlist(StringIO(data)) - - -def writePlistToString(rootObject): - """Return 'rootObject' as a plist-formatted string. - """ - f = StringIO() - writePlist(rootObject, f) - return f.getvalue() - - -def readPlistFromResource(path, restype='plst', resid=0): - """Read plst resource from the resource fork of path. - """ - from Carbon.File import FSRef, FSGetResourceForkName - from Carbon.Files import fsRdPerm - from Carbon import Res - fsRef = FSRef(path) - resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdPerm) - Res.UseResFile(resNum) - plistData = Res.Get1Resource(restype, resid).data - Res.CloseResFile(resNum) - return readPlistFromString(plistData) - - -def writePlistToResource(rootObject, path, restype='plst', resid=0): - """Write 'rootObject' as a plst resource to the resource fork of path. - """ - from Carbon.File import FSRef, FSGetResourceForkName - from Carbon.Files import fsRdWrPerm - from Carbon import Res - plistData = writePlistToString(rootObject) - fsRef = FSRef(path) - resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm) - Res.UseResFile(resNum) - try: - Res.Get1Resource(restype, resid).RemoveResource() - except Res.Error: - pass - res = Res.Resource(plistData) - res.AddResource(restype, resid, '') - res.WriteResource() - Res.CloseResFile(resNum) - - -class DumbXMLWriter: - - def __init__(self, file, indentLevel=0, indent="\t"): - self.file = file - self.stack = [] - self.indentLevel = indentLevel - self.indent = indent - - def beginElement(self, element): - self.stack.append(element) - self.writeln("<%s>" % element) - self.indentLevel += 1 - - def endElement(self, element): - assert self.indentLevel > 0 - assert self.stack.pop() == element - self.indentLevel -= 1 - self.writeln("</%s>" % element) - - def simpleElement(self, element, value=None): - if value is not None: - value = _escapeAndEncode(value) - self.writeln("<%s>%s</%s>" % (element, value, element)) - else: - self.writeln("<%s/>" % element) - - def writeln(self, line): - if line: - self.file.write(self.indentLevel * self.indent + line + "\n") - else: - self.file.write("\n") - - -# Contents should conform to a subset of ISO 8601 -# (in particular, YYYY '-' MM '-' DD 'T' HH ':' MM ':' SS 'Z'. Smaller units may be omitted with -# a loss of precision) -_dateParser = re.compile(r"(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?Z") - -def _dateFromString(s): - order = ('year', 'month', 'day', 'hour', 'minute', 'second') - gd = _dateParser.match(s).groupdict() - lst = [] - for key in order: - val = gd[key] - if val is None: - break - lst.append(int(val)) - return datetime.datetime(*lst) - -def _dateToString(d): - return '%04d-%02d-%02dT%02d:%02d:%02dZ' % ( - d.year, d.month, d.day, - d.hour, d.minute, d.second - ) - - -# Regex to find any control chars, except for \t \n and \r -_controlCharPat = re.compile( - r"[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f" - r"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]") - -def _escapeAndEncode(text): - m = _controlCharPat.search(text) - if m is not None: - raise ValueError("strings can't contains control characters; " - "use plistlib.Data instead") - text = text.replace("\r\n", "\n") # convert DOS line endings - text = text.replace("\r", "\n") # convert Mac line endings - text = text.replace("&", "&") # escape '&' - text = text.replace("<", "<") # escape '<' - text = text.replace(">", ">") # escape '>' - return text.encode("utf-8") # encode as UTF-8 - - -PLISTHEADER = """\ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -""" - -class PlistWriter(DumbXMLWriter): - - def __init__(self, file, indentLevel=0, indent="\t", writeHeader=1): - if writeHeader: - file.write(PLISTHEADER) - DumbXMLWriter.__init__(self, file, indentLevel, indent) - - def writeValue(self, value): - if isinstance(value, (str, unicode)): - self.simpleElement("string", value) - elif isinstance(value, bool): - # must switch for bool before int, as bool is a - # subclass of int... - if value: - self.simpleElement("true") - else: - self.simpleElement("false") - elif isinstance(value, int): - self.simpleElement("integer", str(value)) - elif isinstance(value, float): - self.simpleElement("real", repr(value)) - elif isinstance(value, dict): - self.writeDict(value) - elif isinstance(value, Data): - self.writeData(value) - elif isinstance(value, datetime.datetime): - self.simpleElement("date", _dateToString(value)) - elif isinstance(value, (tuple, list)): - self.writeArray(value) - else: - raise TypeError("unsuported type: %s" % type(value)) - - def writeData(self, data): - self.beginElement("data") - self.indentLevel -= 1 - maxlinelength = 76 - len(self.indent.replace("\t", " " * 8) * - self.indentLevel) - for line in data.asBase64(maxlinelength).split("\n"): - if line: - self.writeln(line) - self.indentLevel += 1 - self.endElement("data") - - def writeDict(self, d): - self.beginElement("dict") - items = d.items() - items.sort() - for key, value in items: - if not isinstance(key, (str, unicode)): - raise TypeError("keys must be strings") - self.simpleElement("key", key) - self.writeValue(value) - self.endElement("dict") - - def writeArray(self, array): - self.beginElement("array") - for value in array: - self.writeValue(value) - self.endElement("array") - - -class _InternalDict(dict): - - # This class is needed while Dict is scheduled for deprecation: - # we only need to warn when a *user* instantiates Dict or when - # the "attribute notation for dict keys" is used. - - def __getattr__(self, attr): - try: - value = self[attr] - except KeyError: - raise AttributeError, attr - from warnings import warn - warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning) - return value - - def __setattr__(self, attr, value): - from warnings import warn - warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning) - self[attr] = value - - def __delattr__(self, attr): - try: - del self[attr] - except KeyError: - raise AttributeError, attr - from warnings import warn - warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning) - -class Dict(_InternalDict): - - def __init__(self, **kwargs): - from warnings import warn - warn("The plistlib.Dict class is deprecated, use builtin dict instead", - PendingDeprecationWarning) - super(Dict, self).__init__(**kwargs) - - -class Plist(_InternalDict): - - """This class has been deprecated. Use readPlist() and writePlist() - functions instead, together with regular dict objects. - """ - - def __init__(self, **kwargs): - from warnings import warn - warn("The Plist class is deprecated, use the readPlist() and " - "writePlist() functions instead", PendingDeprecationWarning) - super(Plist, self).__init__(**kwargs) - - def fromFile(cls, pathOrFile): - """Deprecated. Use the readPlist() function instead.""" - rootObject = readPlist(pathOrFile) - plist = cls() - plist.update(rootObject) - return plist - fromFile = classmethod(fromFile) - - def write(self, pathOrFile): - """Deprecated. Use the writePlist() function instead.""" - writePlist(self, pathOrFile) - - -def _encodeBase64(s, maxlinelength=76): - # copied from base64.encodestring(), with added maxlinelength argument - maxbinsize = (maxlinelength//4)*3 - pieces = [] - for i in range(0, len(s), maxbinsize): - chunk = s[i : i + maxbinsize] - pieces.append(binascii.b2a_base64(chunk)) - return "".join(pieces) - -class Data: - - """Wrapper for binary data.""" - - def __init__(self, data): - self.data = data - - def fromBase64(cls, data): - # base64.decodestring just calls binascii.a2b_base64; - # it seems overkill to use both base64 and binascii. - return cls(binascii.a2b_base64(data)) - fromBase64 = classmethod(fromBase64) - - def asBase64(self, maxlinelength=76): - return _encodeBase64(self.data, maxlinelength) - - def __cmp__(self, other): - if isinstance(other, self.__class__): - return cmp(self.data, other.data) - elif isinstance(other, str): - return cmp(self.data, other) - else: - return cmp(id(self), id(other)) - - def __repr__(self): - return "%s(%s)" % (self.__class__.__name__, repr(self.data)) - - -class PlistParser: - - def __init__(self): - self.stack = [] - self.currentKey = None - self.root = None - - def parse(self, fileobj): - from xml.parsers.expat import ParserCreate - parser = ParserCreate() - parser.StartElementHandler = self.handleBeginElement - parser.EndElementHandler = self.handleEndElement - parser.CharacterDataHandler = self.handleData - parser.ParseFile(fileobj) - return self.root - - def handleBeginElement(self, element, attrs): - self.data = [] - handler = getattr(self, "begin_" + element, None) - if handler is not None: - handler(attrs) - - def handleEndElement(self, element): - handler = getattr(self, "end_" + element, None) - if handler is not None: - handler() - - def handleData(self, data): - self.data.append(data) - - def addObject(self, value): - if self.currentKey is not None: - self.stack[-1][self.currentKey] = value - self.currentKey = None - elif not self.stack: - # this is the root object - self.root = value - else: - self.stack[-1].append(value) - - def getData(self): - data = "".join(self.data) - try: - data = data.encode("ascii") - except UnicodeError: - pass - self.data = [] - return data - - # element handlers - - def begin_dict(self, attrs): - d = _InternalDict() - self.addObject(d) - self.stack.append(d) - def end_dict(self): - self.stack.pop() - - def end_key(self): - self.currentKey = self.getData() - - def begin_array(self, attrs): - a = [] - self.addObject(a) - self.stack.append(a) - def end_array(self): - self.stack.pop() - - def end_true(self): - self.addObject(True) - def end_false(self): - self.addObject(False) - def end_integer(self): - self.addObject(int(self.getData())) - def end_real(self): - self.addObject(float(self.getData())) - def end_string(self): - self.addObject(self.getData()) - def end_data(self): - self.addObject(Data.fromBase64(self.getData())) - def end_date(self): - self.addObject(_dateFromString(self.getData())) diff --git a/sys/lib/python/plat-mac/terminalcommand.py b/sys/lib/python/plat-mac/terminalcommand.py deleted file mode 100644 index 292f09c7d..000000000 --- a/sys/lib/python/plat-mac/terminalcommand.py +++ /dev/null @@ -1,47 +0,0 @@ -"""terminalcommand.py -- A minimal interface to Terminal.app. - -To run a shell command in a new Terminal.app window: - - import terminalcommand - terminalcommand.run("ls -l") - -No result is returned; it is purely meant as a quick way to run a script -with a decent input/output window. -""" - -# -# This module is a fairly straightforward translation of Jack Jansen's -# Mac/OSX/PythonLauncher/doscript.m. -# - -import time -import os -from Carbon import AE -from Carbon.AppleEvents import * - - -TERMINAL_SIG = "trmx" -START_TERMINAL = "/usr/bin/open /Applications/Utilities/Terminal.app" -SEND_MODE = kAENoReply # kAEWaitReply hangs when run from Terminal.app itself - - -def run(command): - """Run a shell command in a new Terminal.app window.""" - termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG) - theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, - kAutoGenerateReturnID, kAnyTransactionID) - commandDesc = AE.AECreateDesc(typeChar, command) - theEvent.AEPutParamDesc(kAECommandClass, commandDesc) - - try: - theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) - except AE.Error, why: - if why[0] != -600: # Terminal.app not yet running - raise - os.system(START_TERMINAL) - time.sleep(1) - theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) - - -if __name__ == "__main__": - run("ls -l") diff --git a/sys/lib/python/plat-mac/videoreader.py b/sys/lib/python/plat-mac/videoreader.py deleted file mode 100644 index f16228b82..000000000 --- a/sys/lib/python/plat-mac/videoreader.py +++ /dev/null @@ -1,291 +0,0 @@ -# Video file reader, using QuickTime -# -# This module was quickly ripped out of another software package, so there is a good -# chance that it does not work as-is and it needs some hacking. -# -# Jack Jansen, August 2000 -# -import sys -from Carbon import Qt -from Carbon import QuickTime -from Carbon import Qd -from Carbon import Qdoffs -from Carbon import QDOffscreen -from Carbon import Res -try: - import MediaDescr -except ImportError: - def _audiodescr(data): - return None -else: - def _audiodescr(data): - return MediaDescr.SoundDescription.decode(data) -try: - from imgformat import macrgb -except ImportError: - macrgb = "Macintosh RGB format" -import os -# import audio.format - -class VideoFormat: - def __init__(self, name, descr, width, height, format): - self.__name = name - self.__descr = descr - self.__width = width - self.__height = height - self.__format = format - - def getname(self): - return self.__name - - def getdescr(self): - return self.__descr - - def getsize(self): - return self.__width, self.__height - - def getformat(self): - return self.__format - -class _Reader: - def __init__(self, path): - fd = Qt.OpenMovieFile(path, 0) - self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0) - self.movietimescale = self.movie.GetMovieTimeScale() - try: - self.audiotrack = self.movie.GetMovieIndTrackType(1, - QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic) - self.audiomedia = self.audiotrack.GetTrackMedia() - except Qt.Error: - self.audiotrack = self.audiomedia = None - self.audiodescr = {} - else: - handle = Res.Handle('') - n = self.audiomedia.GetMediaSampleDescriptionCount() - self.audiomedia.GetMediaSampleDescription(1, handle) - self.audiodescr = _audiodescr(handle.data) - self.audiotimescale = self.audiomedia.GetMediaTimeScale() - del handle - - try: - self.videotrack = self.movie.GetMovieIndTrackType(1, - QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) - self.videomedia = self.videotrack.GetTrackMedia() - except Qt.Error: - self.videotrack = self.videomedia = self.videotimescale = None - if self.videotrack: - self.videotimescale = self.videomedia.GetMediaTimeScale() - x0, y0, x1, y1 = self.movie.GetMovieBox() - self.videodescr = {'width':(x1-x0), 'height':(y1-y0)} - self._initgworld() - self.videocurtime = None - self.audiocurtime = None - - - def __del__(self): - self.audiomedia = None - self.audiotrack = None - self.videomedia = None - self.videotrack = None - self.movie = None - - def _initgworld(self): - old_port, old_dev = Qdoffs.GetGWorld() - try: - movie_w = self.videodescr['width'] - movie_h = self.videodescr['height'] - movie_rect = (0, 0, movie_w, movie_h) - self.gworld = Qdoffs.NewGWorld(32, movie_rect, None, None, QDOffscreen.keepLocal) - self.pixmap = self.gworld.GetGWorldPixMap() - Qdoffs.LockPixels(self.pixmap) - Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None) - Qd.EraseRect(movie_rect) - self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None) - self.movie.SetMovieBox(movie_rect) - self.movie.SetMovieActive(1) - self.movie.MoviesTask(0) - self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality) - # XXXX framerate - finally: - Qdoffs.SetGWorld(old_port, old_dev) - - def _gettrackduration_ms(self, track): - tracktime = track.GetTrackDuration() - return self._movietime_to_ms(tracktime) - - def _movietime_to_ms(self, time): - value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) - return value - - def _videotime_to_ms(self, time): - value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) - return value - - def _audiotime_to_ms(self, time): - value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) - return value - - def _videotime_to_movietime(self, time): - value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), - self.movietimescale) - return value - - def HasAudio(self): - return not self.audiotrack is None - - def HasVideo(self): - return not self.videotrack is None - - def GetAudioDuration(self): - if not self.audiotrack: - return 0 - return self._gettrackduration_ms(self.audiotrack) - - def GetVideoDuration(self): - if not self.videotrack: - return 0 - return self._gettrackduration_ms(self.videotrack) - - def GetAudioFormat(self): - if not self.audiodescr: - return None, None, None, None, None - bps = self.audiodescr['sampleSize'] - nch = self.audiodescr['numChannels'] - if nch == 1: - channels = ['mono'] - elif nch == 2: - channels = ['left', 'right'] - else: - channels = map(lambda x: str(x+1), range(nch)) - if bps % 8: - # Funny bits-per sample. We pretend not to understand - blocksize = 0 - fpb = 0 - else: - # QuickTime is easy (for as far as we support it): samples are always a whole - # number of bytes, so frames are nchannels*samplesize, and there's one frame per block. - blocksize = (bps/8)*nch - fpb = 1 - if self.audiodescr['dataFormat'] == 'raw ': - encoding = 'linear-excess' - elif self.audiodescr['dataFormat'] == 'twos': - encoding = 'linear-signed' - else: - encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] -## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', -## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) - return channels, encoding, blocksize, fpb, bps - - def GetAudioFrameRate(self): - if not self.audiodescr: - return None - return int(self.audiodescr['sampleRate']) - - def GetVideoFormat(self): - width = self.videodescr['width'] - height = self.videodescr['height'] - return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) - - def GetVideoFrameRate(self): - tv = self.videocurtime - if tv == None: - tv = 0 - flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK - tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) - dur = self._videotime_to_ms(dur) - return int((1000.0/dur)+0.5) - - def ReadAudio(self, nframes, time=None): - if not time is None: - self.audiocurtime = time - flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK - if self.audiocurtime == None: - self.audiocurtime = 0 - tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) - if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): - return self._audiotime_to_ms(self.audiocurtime), None - h = Res.Handle('') - desc_h = Res.Handle('') - size, actualtime, sampleduration, desc_index, actualcount, flags = \ - self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) - self.audiocurtime = actualtime + actualcount*sampleduration - return self._audiotime_to_ms(actualtime), h.data - - def ReadVideo(self, time=None): - if not time is None: - self.videocurtime = time - flags = QuickTime.nextTimeStep - if self.videocurtime == None: - flags = flags | QuickTime.nextTimeEdgeOK - self.videocurtime = 0 - tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) - if tv < 0 or (self.videocurtime and tv <= self.videocurtime): - return self._videotime_to_ms(self.videocurtime), None - self.videocurtime = tv - moviecurtime = self._videotime_to_movietime(self.videocurtime) - self.movie.SetMovieTimeValue(moviecurtime) - self.movie.MoviesTask(0) - return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() - - def _getpixmapcontent(self): - """Shuffle the offscreen PixMap data, because it may have funny stride values""" - rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) - width = self.videodescr['width'] - height = self.videodescr['height'] - start = 0 - rv = '' - for i in range(height): - nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) - start = start + rowbytes - rv = rv + nextline - return rv - -def reader(url): - try: - rdr = _Reader(url) - except IOError: - return None - return rdr - -def _test(): - import EasyDialogs - try: - import img - except ImportError: - img = None - import MacOS - Qt.EnterMovies() - path = EasyDialogs.AskFileForOpen(message='Video to convert') - if not path: sys.exit(0) - rdr = reader(path) - if not rdr: - sys.exit(1) - dstdir = EasyDialogs.AskFileForSave(message='Name for output folder') - if not dstdir: sys.exit(0) - num = 0 - os.mkdir(dstdir) - videofmt = rdr.GetVideoFormat() - imgfmt = videofmt.getformat() - imgw, imgh = videofmt.getsize() - timestamp, data = rdr.ReadVideo() - while data: - fname = 'frame%04.4d.jpg'%num - num = num+1 - pname = os.path.join(dstdir, fname) - if not img: print 'Not', - print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) - if img: - wrt = img.writer(imgfmt, pname) - wrt.width = imgw - wrt.height = imgh - wrt.write(data) - timestamp, data = rdr.ReadVideo() - MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') - if num > 20: - print 'stopping at 20 frames so your disk does not fill up:-)' - break - print 'Total frames:', num - -if __name__ == '__main__': - _test() - sys.exit(1) diff --git a/sys/lib/python/sqlite3/test/__init__.py b/sys/lib/python/sqlite3/test/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/sys/lib/python/sqlite3/test/__init__.py +++ /dev/null diff --git a/sys/lib/python/sqlite3/test/dbapi.py b/sys/lib/python/sqlite3/test/dbapi.py deleted file mode 100644 index b08da9c5f..000000000 --- a/sys/lib/python/sqlite3/test/dbapi.py +++ /dev/null @@ -1,732 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/dbapi.py: tests for DB-API compliance -# -# Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import unittest -import threading -import sqlite3 as sqlite - -class ModuleTests(unittest.TestCase): - def CheckAPILevel(self): - self.assertEqual(sqlite.apilevel, "2.0", - "apilevel is %s, should be 2.0" % sqlite.apilevel) - - def CheckThreadSafety(self): - self.assertEqual(sqlite.threadsafety, 1, - "threadsafety is %d, should be 1" % sqlite.threadsafety) - - def CheckParamStyle(self): - self.assertEqual(sqlite.paramstyle, "qmark", - "paramstyle is '%s', should be 'qmark'" % - sqlite.paramstyle) - - def CheckWarning(self): - self.assert_(issubclass(sqlite.Warning, StandardError), - "Warning is not a subclass of StandardError") - - def CheckError(self): - self.failUnless(issubclass(sqlite.Error, StandardError), - "Error is not a subclass of StandardError") - - def CheckInterfaceError(self): - self.failUnless(issubclass(sqlite.InterfaceError, sqlite.Error), - "InterfaceError is not a subclass of Error") - - def CheckDatabaseError(self): - self.failUnless(issubclass(sqlite.DatabaseError, sqlite.Error), - "DatabaseError is not a subclass of Error") - - def CheckDataError(self): - self.failUnless(issubclass(sqlite.DataError, sqlite.DatabaseError), - "DataError is not a subclass of DatabaseError") - - def CheckOperationalError(self): - self.failUnless(issubclass(sqlite.OperationalError, sqlite.DatabaseError), - "OperationalError is not a subclass of DatabaseError") - - def CheckIntegrityError(self): - self.failUnless(issubclass(sqlite.IntegrityError, sqlite.DatabaseError), - "IntegrityError is not a subclass of DatabaseError") - - def CheckInternalError(self): - self.failUnless(issubclass(sqlite.InternalError, sqlite.DatabaseError), - "InternalError is not a subclass of DatabaseError") - - def CheckProgrammingError(self): - self.failUnless(issubclass(sqlite.ProgrammingError, sqlite.DatabaseError), - "ProgrammingError is not a subclass of DatabaseError") - - def CheckNotSupportedError(self): - self.failUnless(issubclass(sqlite.NotSupportedError, - sqlite.DatabaseError), - "NotSupportedError is not a subclass of DatabaseError") - -class ConnectionTests(unittest.TestCase): - def setUp(self): - self.cx = sqlite.connect(":memory:") - cu = self.cx.cursor() - cu.execute("create table test(id integer primary key, name text)") - cu.execute("insert into test(name) values (?)", ("foo",)) - - def tearDown(self): - self.cx.close() - - def CheckCommit(self): - self.cx.commit() - - def CheckCommitAfterNoChanges(self): - """ - A commit should also work when no changes were made to the database. - """ - self.cx.commit() - self.cx.commit() - - def CheckRollback(self): - self.cx.rollback() - - def CheckRollbackAfterNoChanges(self): - """ - A rollback should also work when no changes were made to the database. - """ - self.cx.rollback() - self.cx.rollback() - - def CheckCursor(self): - cu = self.cx.cursor() - - def CheckFailedOpen(self): - YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" - try: - con = sqlite.connect(YOU_CANNOT_OPEN_THIS) - except sqlite.OperationalError: - return - self.fail("should have raised an OperationalError") - - def CheckClose(self): - self.cx.close() - - def CheckExceptions(self): - # Optional DB-API extension. - self.failUnlessEqual(self.cx.Warning, sqlite.Warning) - self.failUnlessEqual(self.cx.Error, sqlite.Error) - self.failUnlessEqual(self.cx.InterfaceError, sqlite.InterfaceError) - self.failUnlessEqual(self.cx.DatabaseError, sqlite.DatabaseError) - self.failUnlessEqual(self.cx.DataError, sqlite.DataError) - self.failUnlessEqual(self.cx.OperationalError, sqlite.OperationalError) - self.failUnlessEqual(self.cx.IntegrityError, sqlite.IntegrityError) - self.failUnlessEqual(self.cx.InternalError, sqlite.InternalError) - self.failUnlessEqual(self.cx.ProgrammingError, sqlite.ProgrammingError) - self.failUnlessEqual(self.cx.NotSupportedError, sqlite.NotSupportedError) - -class CursorTests(unittest.TestCase): - def setUp(self): - self.cx = sqlite.connect(":memory:") - self.cu = self.cx.cursor() - self.cu.execute("create table test(id integer primary key, name text, income number)") - self.cu.execute("insert into test(name) values (?)", ("foo",)) - - def tearDown(self): - self.cu.close() - self.cx.close() - - def CheckExecuteNoArgs(self): - self.cu.execute("delete from test") - - def CheckExecuteIllegalSql(self): - try: - self.cu.execute("select asdf") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - return - except: - self.fail("raised wrong exception") - - def CheckExecuteTooMuchSql(self): - try: - self.cu.execute("select 5+4; select 4+5") - self.fail("should have raised a Warning") - except sqlite.Warning: - return - except: - self.fail("raised wrong exception") - - def CheckExecuteTooMuchSql2(self): - self.cu.execute("select 5+4; -- foo bar") - - def CheckExecuteTooMuchSql3(self): - self.cu.execute(""" - select 5+4; - - /* - foo - */ - """) - - def CheckExecuteWrongSqlArg(self): - try: - self.cu.execute(42) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") - - def CheckExecuteArgInt(self): - self.cu.execute("insert into test(id) values (?)", (42,)) - - def CheckExecuteArgFloat(self): - self.cu.execute("insert into test(income) values (?)", (2500.32,)) - - def CheckExecuteArgString(self): - self.cu.execute("insert into test(name) values (?)", ("Hugo",)) - - def CheckExecuteWrongNoOfArgs1(self): - # too many parameters - try: - self.cu.execute("insert into test(id) values (?)", (17, "Egon")) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckExecuteWrongNoOfArgs2(self): - # too little parameters - try: - self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckExecuteWrongNoOfArgs3(self): - # no parameters, parameters are needed - try: - self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckExecuteDictMapping(self): - self.cu.execute("insert into test(name) values ('foo')") - self.cu.execute("select name from test where name=:name", {"name": "foo"}) - row = self.cu.fetchone() - self.failUnlessEqual(row[0], "foo") - - def CheckExecuteDictMappingTooLittleArgs(self): - self.cu.execute("insert into test(name) values ('foo')") - try: - self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckExecuteDictMappingNoArgs(self): - self.cu.execute("insert into test(name) values ('foo')") - try: - self.cu.execute("select name from test where name=:name") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckExecuteDictMappingUnnamed(self): - self.cu.execute("insert into test(name) values ('foo')") - try: - self.cu.execute("select name from test where name=?", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - - def CheckClose(self): - self.cu.close() - - def CheckRowcountExecute(self): - self.cu.execute("delete from test") - self.cu.execute("insert into test(name) values ('foo')") - self.cu.execute("insert into test(name) values ('foo')") - self.cu.execute("update test set name='bar'") - self.failUnlessEqual(self.cu.rowcount, 2) - - def CheckRowcountExecutemany(self): - self.cu.execute("delete from test") - self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)]) - self.failUnlessEqual(self.cu.rowcount, 3) - - def CheckTotalChanges(self): - self.cu.execute("insert into test(name) values ('foo')") - self.cu.execute("insert into test(name) values ('foo')") - if self.cx.total_changes < 2: - self.fail("total changes reported wrong value") - - # Checks for executemany: - # Sequences are required by the DB-API, iterators - # enhancements in pysqlite. - - def CheckExecuteManySequence(self): - self.cu.executemany("insert into test(income) values (?)", [(x,) for x in range(100, 110)]) - - def CheckExecuteManyIterator(self): - class MyIter: - def __init__(self): - self.value = 5 - - def next(self): - if self.value == 10: - raise StopIteration - else: - self.value += 1 - return (self.value,) - - self.cu.executemany("insert into test(income) values (?)", MyIter()) - - def CheckExecuteManyGenerator(self): - def mygen(): - for i in range(5): - yield (i,) - - self.cu.executemany("insert into test(income) values (?)", mygen()) - - def CheckExecuteManyWrongSqlArg(self): - try: - self.cu.executemany(42, [(3,)]) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") - - def CheckExecuteManySelect(self): - try: - self.cu.executemany("select ?", [(3,)]) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError: - return - except: - self.fail("raised wrong exception.") - - def CheckExecuteManyNotIterable(self): - try: - self.cu.executemany("insert into test(income) values (?)", 42) - self.fail("should have raised a TypeError") - except TypeError: - return - except Exception, e: - print "raised", e.__class__ - self.fail("raised wrong exception.") - - def CheckFetchIter(self): - # Optional DB-API extension. - self.cu.execute("delete from test") - self.cu.execute("insert into test(id) values (?)", (5,)) - self.cu.execute("insert into test(id) values (?)", (6,)) - self.cu.execute("select id from test order by id") - lst = [] - for row in self.cu: - lst.append(row[0]) - self.failUnlessEqual(lst[0], 5) - self.failUnlessEqual(lst[1], 6) - - def CheckFetchone(self): - self.cu.execute("select name from test") - row = self.cu.fetchone() - self.failUnlessEqual(row[0], "foo") - row = self.cu.fetchone() - self.failUnlessEqual(row, None) - - def CheckFetchoneNoStatement(self): - cur = self.cx.cursor() - row = cur.fetchone() - self.failUnlessEqual(row, None) - - def CheckArraySize(self): - # must default ot 1 - self.failUnlessEqual(self.cu.arraysize, 1) - - # now set to 2 - self.cu.arraysize = 2 - - # now make the query return 3 rows - self.cu.execute("delete from test") - self.cu.execute("insert into test(name) values ('A')") - self.cu.execute("insert into test(name) values ('B')") - self.cu.execute("insert into test(name) values ('C')") - self.cu.execute("select name from test") - res = self.cu.fetchmany() - - self.failUnlessEqual(len(res), 2) - - def CheckFetchmany(self): - self.cu.execute("select name from test") - res = self.cu.fetchmany(100) - self.failUnlessEqual(len(res), 1) - res = self.cu.fetchmany(100) - self.failUnlessEqual(res, []) - - def CheckFetchall(self): - self.cu.execute("select name from test") - res = self.cu.fetchall() - self.failUnlessEqual(len(res), 1) - res = self.cu.fetchall() - self.failUnlessEqual(res, []) - - def CheckSetinputsizes(self): - self.cu.setinputsizes([3, 4, 5]) - - def CheckSetoutputsize(self): - self.cu.setoutputsize(5, 0) - - def CheckSetoutputsizeNoColumn(self): - self.cu.setoutputsize(42) - - def CheckCursorConnection(self): - # Optional DB-API extension. - self.failUnlessEqual(self.cu.connection, self.cx) - - def CheckWrongCursorCallable(self): - try: - def f(): pass - cur = self.cx.cursor(f) - self.fail("should have raised a TypeError") - except TypeError: - return - self.fail("should have raised a ValueError") - - def CheckCursorWrongClass(self): - class Foo: pass - foo = Foo() - try: - cur = sqlite.Cursor(foo) - self.fail("should have raised a ValueError") - except TypeError: - pass - -class ThreadTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - self.cur = self.con.cursor() - self.cur.execute("create table test(id integer primary key, name text, bin binary, ratio number, ts timestamp)") - - def tearDown(self): - self.cur.close() - self.con.close() - - def CheckConCursor(self): - def run(con, errors): - try: - cur = con.cursor() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"con": self.con, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckConCommit(self): - def run(con, errors): - try: - con.commit() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"con": self.con, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckConRollback(self): - def run(con, errors): - try: - con.rollback() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"con": self.con, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckConClose(self): - def run(con, errors): - try: - con.close() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"con": self.con, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckCurImplicitBegin(self): - def run(cur, errors): - try: - cur.execute("insert into test(name) values ('a')") - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"cur": self.cur, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckCurClose(self): - def run(cur, errors): - try: - cur.close() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - t = threading.Thread(target=run, kwargs={"cur": self.cur, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckCurExecute(self): - def run(cur, errors): - try: - cur.execute("select name from test") - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - self.cur.execute("insert into test(name) values ('a')") - t = threading.Thread(target=run, kwargs={"cur": self.cur, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - - def CheckCurIterNext(self): - def run(cur, errors): - try: - row = cur.fetchone() - errors.append("did not raise ProgrammingError") - return - except sqlite.ProgrammingError: - return - except: - errors.append("raised wrong exception") - - errors = [] - self.cur.execute("insert into test(name) values ('a')") - self.cur.execute("select name from test") - t = threading.Thread(target=run, kwargs={"cur": self.cur, "errors": errors}) - t.start() - t.join() - if len(errors) > 0: - self.fail("\n".join(errors)) - -class ConstructorTests(unittest.TestCase): - def CheckDate(self): - d = sqlite.Date(2004, 10, 28) - - def CheckTime(self): - t = sqlite.Time(12, 39, 35) - - def CheckTimestamp(self): - ts = sqlite.Timestamp(2004, 10, 28, 12, 39, 35) - - def CheckDateFromTicks(self): - d = sqlite.DateFromTicks(42) - - def CheckTimeFromTicks(self): - t = sqlite.TimeFromTicks(42) - - def CheckTimestampFromTicks(self): - ts = sqlite.TimestampFromTicks(42) - - def CheckBinary(self): - b = sqlite.Binary(chr(0) + "'") - -class ExtensionTests(unittest.TestCase): - def CheckScriptStringSql(self): - con = sqlite.connect(":memory:") - cur = con.cursor() - cur.executescript(""" - -- bla bla - /* a stupid comment */ - create table a(i); - insert into a(i) values (5); - """) - cur.execute("select i from a") - res = cur.fetchone()[0] - self.failUnlessEqual(res, 5) - - def CheckScriptStringUnicode(self): - con = sqlite.connect(":memory:") - cur = con.cursor() - cur.executescript(u""" - create table a(i); - insert into a(i) values (5); - select i from a; - delete from a; - insert into a(i) values (6); - """) - cur.execute("select i from a") - res = cur.fetchone()[0] - self.failUnlessEqual(res, 6) - - def CheckScriptErrorIncomplete(self): - con = sqlite.connect(":memory:") - cur = con.cursor() - raised = False - try: - cur.executescript("create table test(sadfsadfdsa") - except sqlite.ProgrammingError: - raised = True - self.failUnlessEqual(raised, True, "should have raised an exception") - - def CheckScriptErrorNormal(self): - con = sqlite.connect(":memory:") - cur = con.cursor() - raised = False - try: - cur.executescript("create table test(sadfsadfdsa); select foo from hurz;") - except sqlite.OperationalError: - raised = True - self.failUnlessEqual(raised, True, "should have raised an exception") - - def CheckConnectionExecute(self): - con = sqlite.connect(":memory:") - result = con.execute("select 5").fetchone()[0] - self.failUnlessEqual(result, 5, "Basic test of Connection.execute") - - def CheckConnectionExecutemany(self): - con = sqlite.connect(":memory:") - con.execute("create table test(foo)") - con.executemany("insert into test(foo) values (?)", [(3,), (4,)]) - result = con.execute("select foo from test order by foo").fetchall() - self.failUnlessEqual(result[0][0], 3, "Basic test of Connection.executemany") - self.failUnlessEqual(result[1][0], 4, "Basic test of Connection.executemany") - - def CheckConnectionExecutescript(self): - con = sqlite.connect(":memory:") - con.executescript("create table test(foo); insert into test(foo) values (5);") - result = con.execute("select foo from test").fetchone()[0] - self.failUnlessEqual(result, 5, "Basic test of Connection.executescript") - -class ClosedTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - - def CheckClosedConCursor(self): - con = sqlite.connect(":memory:") - con.close() - try: - cur = con.cursor() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") - - def CheckClosedConCommit(self): - con = sqlite.connect(":memory:") - con.close() - try: - con.commit() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") - - def CheckClosedConRollback(self): - con = sqlite.connect(":memory:") - con.close() - try: - con.rollback() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") - - def CheckClosedCurExecute(self): - con = sqlite.connect(":memory:") - cur = con.cursor() - con.close() - try: - cur.execute("select 4") - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") - -def suite(): - module_suite = unittest.makeSuite(ModuleTests, "Check") - connection_suite = unittest.makeSuite(ConnectionTests, "Check") - cursor_suite = unittest.makeSuite(CursorTests, "Check") - thread_suite = unittest.makeSuite(ThreadTests, "Check") - constructor_suite = unittest.makeSuite(ConstructorTests, "Check") - ext_suite = unittest.makeSuite(ExtensionTests, "Check") - closed_suite = unittest.makeSuite(ClosedTests, "Check") - return unittest.TestSuite((module_suite, connection_suite, cursor_suite, thread_suite, constructor_suite, ext_suite, closed_suite)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/factory.py b/sys/lib/python/sqlite3/test/factory.py deleted file mode 100644 index 8778056af..000000000 --- a/sys/lib/python/sqlite3/test/factory.py +++ /dev/null @@ -1,164 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/factory.py: tests for the various factories in pysqlite -# -# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import unittest -import sqlite3 as sqlite - -class MyConnection(sqlite.Connection): - def __init__(self, *args, **kwargs): - sqlite.Connection.__init__(self, *args, **kwargs) - -def dict_factory(cursor, row): - d = {} - for idx, col in enumerate(cursor.description): - d[col[0]] = row[idx] - return d - -class MyCursor(sqlite.Cursor): - def __init__(self, *args, **kwargs): - sqlite.Cursor.__init__(self, *args, **kwargs) - self.row_factory = dict_factory - -class ConnectionFactoryTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:", factory=MyConnection) - - def tearDown(self): - self.con.close() - - def CheckIsInstance(self): - self.failUnless(isinstance(self.con, - MyConnection), - "connection is not instance of MyConnection") - -class CursorFactoryTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - def tearDown(self): - self.con.close() - - def CheckIsInstance(self): - cur = self.con.cursor(factory=MyCursor) - self.failUnless(isinstance(cur, - MyCursor), - "cursor is not instance of MyCursor") - -class RowFactoryTestsBackwardsCompat(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - def CheckIsProducedByFactory(self): - cur = self.con.cursor(factory=MyCursor) - cur.execute("select 4+5 as foo") - row = cur.fetchone() - self.failUnless(isinstance(row, - dict), - "row is not instance of dict") - cur.close() - - def tearDown(self): - self.con.close() - -class RowFactoryTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - def CheckCustomFactory(self): - self.con.row_factory = lambda cur, row: list(row) - row = self.con.execute("select 1, 2").fetchone() - self.failUnless(isinstance(row, - list), - "row is not instance of list") - - def CheckSqliteRow(self): - self.con.row_factory = sqlite.Row - row = self.con.execute("select 1 as a, 2 as b").fetchone() - self.failUnless(isinstance(row, - sqlite.Row), - "row is not instance of sqlite.Row") - - col1, col2 = row["a"], row["b"] - self.failUnless(col1 == 1, "by name: wrong result for column 'a'") - self.failUnless(col2 == 2, "by name: wrong result for column 'a'") - - col1, col2 = row["A"], row["B"] - self.failUnless(col1 == 1, "by name: wrong result for column 'A'") - self.failUnless(col2 == 2, "by name: wrong result for column 'B'") - - col1, col2 = row[0], row[1] - self.failUnless(col1 == 1, "by index: wrong result for column 0") - self.failUnless(col2 == 2, "by index: wrong result for column 1") - - def tearDown(self): - self.con.close() - -class TextFactoryTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - def CheckUnicode(self): - austria = unicode("Österreich", "latin1") - row = self.con.execute("select ?", (austria,)).fetchone() - self.failUnless(type(row[0]) == unicode, "type of row[0] must be unicode") - - def CheckString(self): - self.con.text_factory = str - austria = unicode("Österreich", "latin1") - row = self.con.execute("select ?", (austria,)).fetchone() - self.failUnless(type(row[0]) == str, "type of row[0] must be str") - self.failUnless(row[0] == austria.encode("utf-8"), "column must equal original data in UTF-8") - - def CheckCustom(self): - self.con.text_factory = lambda x: unicode(x, "utf-8", "ignore") - austria = unicode("Österreich", "latin1") - row = self.con.execute("select ?", (austria.encode("latin1"),)).fetchone() - self.failUnless(type(row[0]) == unicode, "type of row[0] must be unicode") - self.failUnless(row[0].endswith(u"reich"), "column must contain original data") - - def CheckOptimizedUnicode(self): - self.con.text_factory = sqlite.OptimizedUnicode - austria = unicode("Österreich", "latin1") - germany = unicode("Deutchland") - a_row = self.con.execute("select ?", (austria,)).fetchone() - d_row = self.con.execute("select ?", (germany,)).fetchone() - self.failUnless(type(a_row[0]) == unicode, "type of non-ASCII row must be unicode") - self.failUnless(type(d_row[0]) == str, "type of ASCII-only row must be str") - - def tearDown(self): - self.con.close() - -def suite(): - connection_suite = unittest.makeSuite(ConnectionFactoryTests, "Check") - cursor_suite = unittest.makeSuite(CursorFactoryTests, "Check") - row_suite_compat = unittest.makeSuite(RowFactoryTestsBackwardsCompat, "Check") - row_suite = unittest.makeSuite(RowFactoryTests, "Check") - text_suite = unittest.makeSuite(TextFactoryTests, "Check") - return unittest.TestSuite((connection_suite, cursor_suite, row_suite_compat, row_suite, text_suite)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/hooks.py b/sys/lib/python/sqlite3/test/hooks.py deleted file mode 100644 index 761bdaa6b..000000000 --- a/sys/lib/python/sqlite3/test/hooks.py +++ /dev/null @@ -1,117 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/hooks.py: tests for various SQLite-specific hooks -# -# Copyright (C) 2006 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import os, unittest -import sqlite3 as sqlite - -class CollationTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - - def CheckCreateCollationNotCallable(self): - con = sqlite.connect(":memory:") - try: - con.create_collation("X", 42) - self.fail("should have raised a TypeError") - except TypeError, e: - self.failUnlessEqual(e.args[0], "parameter must be callable") - - def CheckCreateCollationNotAscii(self): - con = sqlite.connect(":memory:") - try: - con.create_collation("collä", cmp) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError, e: - pass - - def CheckCollationIsUsed(self): - if sqlite.version_info < (3, 2, 1): # old SQLite versions crash on this test - return - def mycoll(x, y): - # reverse order - return -cmp(x, y) - - con = sqlite.connect(":memory:") - con.create_collation("mycoll", mycoll) - sql = """ - select x from ( - select 'a' as x - union - select 'b' as x - union - select 'c' as x - ) order by x collate mycoll - """ - result = con.execute(sql).fetchall() - if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a": - self.fail("the expected order was not returned") - - con.create_collation("mycoll", None) - try: - result = con.execute(sql).fetchall() - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll") - - def CheckCollationRegisterTwice(self): - """ - Register two different collation functions under the same name. - Verify that the last one is actually used. - """ - con = sqlite.connect(":memory:") - con.create_collation("mycoll", cmp) - con.create_collation("mycoll", lambda x, y: -cmp(x, y)) - result = con.execute(""" - select x from (select 'a' as x union select 'b' as x) order by x collate mycoll - """).fetchall() - if result[0][0] != 'b' or result[1][0] != 'a': - self.fail("wrong collation function is used") - - def CheckDeregisterCollation(self): - """ - Register a collation, then deregister it. Make sure an error is raised if we try - to use it. - """ - con = sqlite.connect(":memory:") - con.create_collation("mycoll", cmp) - con.create_collation("mycoll", None) - try: - con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - if not e.args[0].startswith("no such collation sequence"): - self.fail("wrong OperationalError raised") - -def suite(): - collation_suite = unittest.makeSuite(CollationTests, "Check") - return unittest.TestSuite((collation_suite,)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/regression.py b/sys/lib/python/sqlite3/test/regression.py deleted file mode 100644 index c8733b963..000000000 --- a/sys/lib/python/sqlite3/test/regression.py +++ /dev/null @@ -1,81 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/regression.py: pysqlite regression tests -# -# Copyright (C) 2006 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import unittest -import sqlite3 as sqlite - -class RegressionTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - def tearDown(self): - self.con.close() - - def CheckPragmaUserVersion(self): - # This used to crash pysqlite because this pragma command returns NULL for the column name - cur = self.con.cursor() - cur.execute("pragma user_version") - - def CheckPragmaSchemaVersion(self): - # This still crashed pysqlite <= 2.2.1 - con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) - try: - cur = self.con.cursor() - cur.execute("pragma schema_version") - finally: - cur.close() - con.close() - - def CheckStatementReset(self): - # pysqlite 2.1.0 to 2.2.0 have the problem that not all statements are - # reset before a rollback, but only those that are still in the - # statement cache. The others are not accessible from the connection object. - con = sqlite.connect(":memory:", cached_statements=5) - cursors = [con.cursor() for x in xrange(5)] - cursors[0].execute("create table test(x)") - for i in range(10): - cursors[0].executemany("insert into test(x) values (?)", [(x,) for x in xrange(10)]) - - for i in range(5): - cursors[i].execute(" " * i + "select x from test") - - con.rollback() - - def CheckColumnNameWithSpaces(self): - cur = self.con.cursor() - cur.execute('select 1 as "foo bar [datetime]"') - self.failUnlessEqual(cur.description[0][0], "foo bar") - - cur.execute('select 1 as "foo baz"') - self.failUnlessEqual(cur.description[0][0], "foo baz") - -def suite(): - regression_suite = unittest.makeSuite(RegressionTests, "Check") - return unittest.TestSuite((regression_suite,)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/transactions.py b/sys/lib/python/sqlite3/test/transactions.py deleted file mode 100644 index 1f0b19aa9..000000000 --- a/sys/lib/python/sqlite3/test/transactions.py +++ /dev/null @@ -1,156 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/transactions.py: tests transactions -# -# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import os, unittest -import sqlite3 as sqlite - -def get_db_path(): - return "sqlite_testdb" - -class TransactionTests(unittest.TestCase): - def setUp(self): - try: - os.remove(get_db_path()) - except: - pass - - self.con1 = sqlite.connect(get_db_path(), timeout=0.1) - self.cur1 = self.con1.cursor() - - self.con2 = sqlite.connect(get_db_path(), timeout=0.1) - self.cur2 = self.con2.cursor() - - def tearDown(self): - self.cur1.close() - self.con1.close() - - self.cur2.close() - self.con2.close() - - os.unlink(get_db_path()) - - def CheckDMLdoesAutoCommitBefore(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.cur1.execute("create table test2(j)") - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 1) - - def CheckInsertStartsTransaction(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 0) - - def CheckUpdateStartsTransaction(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.con1.commit() - self.cur1.execute("update test set i=6") - self.cur2.execute("select i from test") - res = self.cur2.fetchone()[0] - self.failUnlessEqual(res, 5) - - def CheckDeleteStartsTransaction(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.con1.commit() - self.cur1.execute("delete from test") - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 1) - - def CheckReplaceStartsTransaction(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.con1.commit() - self.cur1.execute("replace into test(i) values (6)") - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 1) - self.failUnlessEqual(res[0][0], 5) - - def CheckToggleAutoCommit(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - self.con1.isolation_level = None - self.failUnlessEqual(self.con1.isolation_level, None) - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 1) - - self.con1.isolation_level = "DEFERRED" - self.failUnlessEqual(self.con1.isolation_level , "DEFERRED") - self.cur1.execute("insert into test(i) values (5)") - self.cur2.execute("select i from test") - res = self.cur2.fetchall() - self.failUnlessEqual(len(res), 1) - - def CheckRaiseTimeout(self): - self.cur1.execute("create table test(i)") - self.cur1.execute("insert into test(i) values (5)") - try: - self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") - -class SpecialCommandTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - self.cur = self.con.cursor() - - def CheckVacuum(self): - self.cur.execute("create table test(i)") - self.cur.execute("insert into test(i) values (5)") - self.cur.execute("vacuum") - - def CheckDropTable(self): - self.cur.execute("create table test(i)") - self.cur.execute("insert into test(i) values (5)") - self.cur.execute("drop table test") - - def CheckPragma(self): - self.cur.execute("create table test(i)") - self.cur.execute("insert into test(i) values (5)") - self.cur.execute("pragma count_changes=1") - - def tearDown(self): - self.cur.close() - self.con.close() - -def suite(): - default_suite = unittest.makeSuite(TransactionTests, "Check") - special_command_suite = unittest.makeSuite(SpecialCommandTests, "Check") - return unittest.TestSuite((default_suite, special_command_suite)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/types.py b/sys/lib/python/sqlite3/test/types.py deleted file mode 100644 index 8da5722d5..000000000 --- a/sys/lib/python/sqlite3/test/types.py +++ /dev/null @@ -1,351 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/types.py: tests for type conversion and detection -# -# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import bz2, datetime -import unittest -import sqlite3 as sqlite - -class SqliteTypeTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - self.cur = self.con.cursor() - self.cur.execute("create table test(i integer, s varchar, f number, b blob)") - - def tearDown(self): - self.cur.close() - self.con.close() - - def CheckString(self): - self.cur.execute("insert into test(s) values (?)", (u"Österreich",)) - self.cur.execute("select s from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], u"Österreich") - - def CheckSmallInt(self): - self.cur.execute("insert into test(i) values (?)", (42,)) - self.cur.execute("select i from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], 42) - - def CheckLargeInt(self): - num = 2**40 - self.cur.execute("insert into test(i) values (?)", (num,)) - self.cur.execute("select i from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], num) - - def CheckFloat(self): - val = 3.14 - self.cur.execute("insert into test(f) values (?)", (val,)) - self.cur.execute("select f from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], val) - - def CheckBlob(self): - val = buffer("Guglhupf") - self.cur.execute("insert into test(b) values (?)", (val,)) - self.cur.execute("select b from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], val) - - def CheckUnicodeExecute(self): - self.cur.execute(u"select 'Österreich'") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], u"Österreich") - -class DeclTypesTests(unittest.TestCase): - class Foo: - def __init__(self, _val): - self.val = _val - - def __cmp__(self, other): - if not isinstance(other, DeclTypesTests.Foo): - raise ValueError - if self.val == other.val: - return 0 - else: - return 1 - - def __conform__(self, protocol): - if protocol is sqlite.PrepareProtocol: - return self.val - else: - return None - - def __str__(self): - return "<%s>" % self.val - - def setUp(self): - self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES) - self.cur = self.con.cursor() - self.cur.execute("create table test(i int, s str, f float, b bool, u unicode, foo foo, bin blob)") - - # override float, make them always return the same number - sqlite.converters["FLOAT"] = lambda x: 47.2 - - # and implement two custom ones - sqlite.converters["BOOL"] = lambda x: bool(int(x)) - sqlite.converters["FOO"] = DeclTypesTests.Foo - - def tearDown(self): - del sqlite.converters["FLOAT"] - del sqlite.converters["BOOL"] - del sqlite.converters["FOO"] - self.cur.close() - self.con.close() - - def CheckString(self): - # default - self.cur.execute("insert into test(s) values (?)", ("foo",)) - self.cur.execute("select s from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], "foo") - - def CheckSmallInt(self): - # default - self.cur.execute("insert into test(i) values (?)", (42,)) - self.cur.execute("select i from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], 42) - - def CheckLargeInt(self): - # default - num = 2**40 - self.cur.execute("insert into test(i) values (?)", (num,)) - self.cur.execute("select i from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], num) - - def CheckFloat(self): - # custom - val = 3.14 - self.cur.execute("insert into test(f) values (?)", (val,)) - self.cur.execute("select f from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], 47.2) - - def CheckBool(self): - # custom - self.cur.execute("insert into test(b) values (?)", (False,)) - self.cur.execute("select b from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], False) - - self.cur.execute("delete from test") - self.cur.execute("insert into test(b) values (?)", (True,)) - self.cur.execute("select b from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], True) - - def CheckUnicode(self): - # default - val = u"\xd6sterreich" - self.cur.execute("insert into test(u) values (?)", (val,)) - self.cur.execute("select u from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], val) - - def CheckFoo(self): - val = DeclTypesTests.Foo("bla") - self.cur.execute("insert into test(foo) values (?)", (val,)) - self.cur.execute("select foo from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], val) - - def CheckUnsupportedSeq(self): - class Bar: pass - val = Bar() - try: - self.cur.execute("insert into test(f) values (?)", (val,)) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") - - def CheckUnsupportedDict(self): - class Bar: pass - val = Bar() - try: - self.cur.execute("insert into test(f) values (:val)", {"val": val}) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") - - def CheckBlob(self): - # default - val = buffer("Guglhupf") - self.cur.execute("insert into test(bin) values (?)", (val,)) - self.cur.execute("select bin from test") - row = self.cur.fetchone() - self.failUnlessEqual(row[0], val) - -class ColNamesTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES|sqlite.PARSE_DECLTYPES) - self.cur = self.con.cursor() - self.cur.execute("create table test(x foo)") - - sqlite.converters["FOO"] = lambda x: "[%s]" % x - sqlite.converters["BAR"] = lambda x: "<%s>" % x - sqlite.converters["EXC"] = lambda x: 5/0 - - def tearDown(self): - del sqlite.converters["FOO"] - del sqlite.converters["BAR"] - del sqlite.converters["EXC"] - self.cur.close() - self.con.close() - - def CheckDeclType(self): - self.cur.execute("insert into test(x) values (?)", ("xxx",)) - self.cur.execute("select x from test") - val = self.cur.fetchone()[0] - self.failUnlessEqual(val, "[xxx]") - - def CheckNone(self): - self.cur.execute("insert into test(x) values (?)", (None,)) - self.cur.execute("select x from test") - val = self.cur.fetchone()[0] - self.failUnlessEqual(val, None) - - def CheckColName(self): - self.cur.execute("insert into test(x) values (?)", ("xxx",)) - self.cur.execute('select x as "x [bar]" from test') - val = self.cur.fetchone()[0] - self.failUnlessEqual(val, "<xxx>") - - # Check if the stripping of colnames works. Everything after the first - # whitespace should be stripped. - self.failUnlessEqual(self.cur.description[0][0], "x") - - def CheckCursorDescriptionNoRow(self): - """ - cursor.description should at least provide the column name(s), even if - no row returned. - """ - self.cur.execute("select * from test where 0 = 1") - self.assert_(self.cur.description[0][0] == "x") - -class ObjectAdaptationTests(unittest.TestCase): - def cast(obj): - return float(obj) - cast = staticmethod(cast) - - def setUp(self): - self.con = sqlite.connect(":memory:") - try: - del sqlite.adapters[int] - except: - pass - sqlite.register_adapter(int, ObjectAdaptationTests.cast) - self.cur = self.con.cursor() - - def tearDown(self): - del sqlite.adapters[(int, sqlite.PrepareProtocol)] - self.cur.close() - self.con.close() - - def CheckCasterIsUsed(self): - self.cur.execute("select ?", (4,)) - val = self.cur.fetchone()[0] - self.failUnlessEqual(type(val), float) - -class BinaryConverterTests(unittest.TestCase): - def convert(s): - return bz2.decompress(s) - convert = staticmethod(convert) - - def setUp(self): - self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) - sqlite.register_converter("bin", BinaryConverterTests.convert) - - def tearDown(self): - self.con.close() - - def CheckBinaryInputForConverter(self): - testdata = "abcdefg" * 10 - result = self.con.execute('select ? as "x [bin]"', (buffer(bz2.compress(testdata)),)).fetchone()[0] - self.failUnlessEqual(testdata, result) - -class DateTimeTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES) - self.cur = self.con.cursor() - self.cur.execute("create table test(d date, ts timestamp)") - - def tearDown(self): - self.cur.close() - self.con.close() - - def CheckSqliteDate(self): - d = sqlite.Date(2004, 2, 14) - self.cur.execute("insert into test(d) values (?)", (d,)) - self.cur.execute("select d from test") - d2 = self.cur.fetchone()[0] - self.failUnlessEqual(d, d2) - - def CheckSqliteTimestamp(self): - ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0) - self.cur.execute("insert into test(ts) values (?)", (ts,)) - self.cur.execute("select ts from test") - ts2 = self.cur.fetchone()[0] - self.failUnlessEqual(ts, ts2) - - def CheckSqlTimestamp(self): - # The date functions are only available in SQLite version 3.1 or later - if sqlite.sqlite_version_info < (3, 1): - return - - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. - now = datetime.datetime.now() - self.cur.execute("insert into test(ts) values (current_timestamp)") - self.cur.execute("select ts from test") - ts = self.cur.fetchone()[0] - self.failUnlessEqual(type(ts), datetime.datetime) - self.failUnlessEqual(ts.year, now.year) - - def CheckDateTimeSubSeconds(self): - ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 500000) - self.cur.execute("insert into test(ts) values (?)", (ts,)) - self.cur.execute("select ts from test") - ts2 = self.cur.fetchone()[0] - self.failUnlessEqual(ts, ts2) - -def suite(): - sqlite_type_suite = unittest.makeSuite(SqliteTypeTests, "Check") - decltypes_type_suite = unittest.makeSuite(DeclTypesTests, "Check") - colnames_type_suite = unittest.makeSuite(ColNamesTests, "Check") - adaptation_suite = unittest.makeSuite(ObjectAdaptationTests, "Check") - bin_suite = unittest.makeSuite(BinaryConverterTests, "Check") - date_suite = unittest.makeSuite(DateTimeTests, "Check") - return unittest.TestSuite((sqlite_type_suite, decltypes_type_suite, colnames_type_suite, adaptation_suite, bin_suite, date_suite)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/lib/python/sqlite3/test/userfunctions.py b/sys/lib/python/sqlite3/test/userfunctions.py deleted file mode 100644 index 31bf28919..000000000 --- a/sys/lib/python/sqlite3/test/userfunctions.py +++ /dev/null @@ -1,413 +0,0 @@ -#-*- coding: ISO-8859-1 -*- -# pysqlite2/test/userfunctions.py: tests for user-defined functions and -# aggregates. -# -# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> -# -# This file is part of pysqlite. -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. - -import unittest -import sqlite3 as sqlite - -def func_returntext(): - return "foo" -def func_returnunicode(): - return u"bar" -def func_returnint(): - return 42 -def func_returnfloat(): - return 3.14 -def func_returnnull(): - return None -def func_returnblob(): - return buffer("blob") -def func_raiseexception(): - 5/0 - -def func_isstring(v): - return type(v) is unicode -def func_isint(v): - return type(v) is int -def func_isfloat(v): - return type(v) is float -def func_isnone(v): - return type(v) is type(None) -def func_isblob(v): - return type(v) is buffer - -class AggrNoStep: - def __init__(self): - pass - - def finalize(self): - return 1 - -class AggrNoFinalize: - def __init__(self): - pass - - def step(self, x): - pass - -class AggrExceptionInInit: - def __init__(self): - 5/0 - - def step(self, x): - pass - - def finalize(self): - pass - -class AggrExceptionInStep: - def __init__(self): - pass - - def step(self, x): - 5/0 - - def finalize(self): - return 42 - -class AggrExceptionInFinalize: - def __init__(self): - pass - - def step(self, x): - pass - - def finalize(self): - 5/0 - -class AggrCheckType: - def __init__(self): - self.val = None - - def step(self, whichType, val): - theType = {"str": unicode, "int": int, "float": float, "None": type(None), "blob": buffer} - self.val = int(theType[whichType] is type(val)) - - def finalize(self): - return self.val - -class AggrSum: - def __init__(self): - self.val = 0.0 - - def step(self, val): - self.val += val - - def finalize(self): - return self.val - -class FunctionTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - - self.con.create_function("returntext", 0, func_returntext) - self.con.create_function("returnunicode", 0, func_returnunicode) - self.con.create_function("returnint", 0, func_returnint) - self.con.create_function("returnfloat", 0, func_returnfloat) - self.con.create_function("returnnull", 0, func_returnnull) - self.con.create_function("returnblob", 0, func_returnblob) - self.con.create_function("raiseexception", 0, func_raiseexception) - - self.con.create_function("isstring", 1, func_isstring) - self.con.create_function("isint", 1, func_isint) - self.con.create_function("isfloat", 1, func_isfloat) - self.con.create_function("isnone", 1, func_isnone) - self.con.create_function("isblob", 1, func_isblob) - - def tearDown(self): - self.con.close() - - def CheckFuncErrorOnCreate(self): - try: - self.con.create_function("bla", -100, lambda x: 2*x) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - - def CheckFuncRefCount(self): - def getfunc(): - def f(): - return 1 - return f - f = getfunc() - globals()["foo"] = f - # self.con.create_function("reftest", 0, getfunc()) - self.con.create_function("reftest", 0, f) - cur = self.con.cursor() - cur.execute("select reftest()") - - def CheckFuncReturnText(self): - cur = self.con.cursor() - cur.execute("select returntext()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), unicode) - self.failUnlessEqual(val, "foo") - - def CheckFuncReturnUnicode(self): - cur = self.con.cursor() - cur.execute("select returnunicode()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), unicode) - self.failUnlessEqual(val, u"bar") - - def CheckFuncReturnInt(self): - cur = self.con.cursor() - cur.execute("select returnint()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), int) - self.failUnlessEqual(val, 42) - - def CheckFuncReturnFloat(self): - cur = self.con.cursor() - cur.execute("select returnfloat()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), float) - if val < 3.139 or val > 3.141: - self.fail("wrong value") - - def CheckFuncReturnNull(self): - cur = self.con.cursor() - cur.execute("select returnnull()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), type(None)) - self.failUnlessEqual(val, None) - - def CheckFuncReturnBlob(self): - cur = self.con.cursor() - cur.execute("select returnblob()") - val = cur.fetchone()[0] - self.failUnlessEqual(type(val), buffer) - self.failUnlessEqual(val, buffer("blob")) - - def CheckFuncException(self): - cur = self.con.cursor() - try: - cur.execute("select raiseexception()") - cur.fetchone() - self.fail("should have raised OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0], 'user-defined function raised exception') - - def CheckParamString(self): - cur = self.con.cursor() - cur.execute("select isstring(?)", ("foo",)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckParamInt(self): - cur = self.con.cursor() - cur.execute("select isint(?)", (42,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckParamFloat(self): - cur = self.con.cursor() - cur.execute("select isfloat(?)", (3.14,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckParamNone(self): - cur = self.con.cursor() - cur.execute("select isnone(?)", (None,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckParamBlob(self): - cur = self.con.cursor() - cur.execute("select isblob(?)", (buffer("blob"),)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - -class AggregateTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - cur = self.con.cursor() - cur.execute(""" - create table test( - t text, - i integer, - f float, - n, - b blob - ) - """) - cur.execute("insert into test(t, i, f, n, b) values (?, ?, ?, ?, ?)", - ("foo", 5, 3.14, None, buffer("blob"),)) - - self.con.create_aggregate("nostep", 1, AggrNoStep) - self.con.create_aggregate("nofinalize", 1, AggrNoFinalize) - self.con.create_aggregate("excInit", 1, AggrExceptionInInit) - self.con.create_aggregate("excStep", 1, AggrExceptionInStep) - self.con.create_aggregate("excFinalize", 1, AggrExceptionInFinalize) - self.con.create_aggregate("checkType", 2, AggrCheckType) - self.con.create_aggregate("mysum", 1, AggrSum) - - def tearDown(self): - #self.cur.close() - #self.con.close() - pass - - def CheckAggrErrorOnCreate(self): - try: - self.con.create_function("bla", -100, AggrSum) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - - def CheckAggrNoStep(self): - cur = self.con.cursor() - try: - cur.execute("select nostep(t) from test") - self.fail("should have raised an AttributeError") - except AttributeError, e: - self.failUnlessEqual(e.args[0], "AggrNoStep instance has no attribute 'step'") - - def CheckAggrNoFinalize(self): - cur = self.con.cursor() - try: - cur.execute("select nofinalize(t) from test") - val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") - - def CheckAggrExceptionInInit(self): - cur = self.con.cursor() - try: - cur.execute("select excInit(t) from test") - val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") - - def CheckAggrExceptionInStep(self): - cur = self.con.cursor() - try: - cur.execute("select excStep(t) from test") - val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error") - - def CheckAggrExceptionInFinalize(self): - cur = self.con.cursor() - try: - cur.execute("select excFinalize(t) from test") - val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") - - def CheckAggrCheckParamStr(self): - cur = self.con.cursor() - cur.execute("select checkType('str', ?)", ("foo",)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckAggrCheckParamInt(self): - cur = self.con.cursor() - cur.execute("select checkType('int', ?)", (42,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckAggrCheckParamFloat(self): - cur = self.con.cursor() - cur.execute("select checkType('float', ?)", (3.14,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckAggrCheckParamNone(self): - cur = self.con.cursor() - cur.execute("select checkType('None', ?)", (None,)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckAggrCheckParamBlob(self): - cur = self.con.cursor() - cur.execute("select checkType('blob', ?)", (buffer("blob"),)) - val = cur.fetchone()[0] - self.failUnlessEqual(val, 1) - - def CheckAggrCheckAggrSum(self): - cur = self.con.cursor() - cur.execute("delete from test") - cur.executemany("insert into test(i) values (?)", [(10,), (20,), (30,)]) - cur.execute("select mysum(i) from test") - val = cur.fetchone()[0] - self.failUnlessEqual(val, 60) - -def authorizer_cb(action, arg1, arg2, dbname, source): - if action != sqlite.SQLITE_SELECT: - return sqlite.SQLITE_DENY - if arg2 == 'c2' or arg1 == 't2': - return sqlite.SQLITE_DENY - return sqlite.SQLITE_OK - -class AuthorizerTests(unittest.TestCase): - def setUp(self): - self.con = sqlite.connect(":memory:") - self.con.executescript(""" - create table t1 (c1, c2); - create table t2 (c1, c2); - insert into t1 (c1, c2) values (1, 2); - insert into t2 (c1, c2) values (4, 5); - """) - - # For our security test: - self.con.execute("select c2 from t2") - - self.con.set_authorizer(authorizer_cb) - - def tearDown(self): - pass - - def CheckTableAccess(self): - try: - self.con.execute("select * from t2") - except sqlite.DatabaseError, e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") - - def CheckColumnAccess(self): - try: - self.con.execute("select c2 from t1") - except sqlite.DatabaseError, e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") - -def suite(): - function_suite = unittest.makeSuite(FunctionTests, "Check") - aggregate_suite = unittest.makeSuite(AggregateTests, "Check") - authorizer_suite = unittest.makeSuite(AuthorizerTests, "Check") - return unittest.TestSuite((function_suite, aggregate_suite, authorizer_suite)) - -def test(): - runner = unittest.TextTestRunner() - runner.run(suite()) - -if __name__ == "__main__": - test() diff --git a/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head b/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head deleted file mode 100644 index 1203a2215..000000000 --- a/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head +++ /dev/null @@ -1,163 +0,0 @@ -This file, together with ChangeLog.0_9_7-stable_not-in-head_FIPS, -provides a collection of those CVS change log entries for the -0.9.7 branch (OpenSSL_0_9_7-stable) that do not appear similarly in -0.9.8-dev (CVS head). - -ChangeLog.0_9_7-stable_not-in-head_FIPS - "FIPS" related changes -ChangeLog.0_9_7-stable_not-in-head - everything else - -Some obvious false positives have been eliminated: e.g., we do not -care about a simple "make update"; and we don't care about changes -identified to the 0.9.7 branch that were explicitly identified as -backports from head. - -Eliminating all other entries (and finally this file and its -compantion), either as false positives or as things that should go -into 0.9.8, remains to be done. Any additional changes to 0.9.7 that -are not immediately put into 0.9.8, but belong there as well, should -be added to the end of this file. - - -2002-11-04 17:33 levitte - - Changed: - Configure (1.314.2.38), "Exp", lines: +4 -2 - - Return my normal debug targets to something not so extreme, and - make the extreme ones special (or 'extreme', if you will :-)). - -2002-12-16 19:17 appro - - Changed: - crypto/bn/bn_lcl.h (1.23.2.3), "Exp", lines: +3 -0 - crypto/bn/bn_mul.c (1.28.2.4), "Exp", lines: +84 -445 - - This is rollback to 0.9.6h bn_mul.c to address problem reported in - RT#272. - -2003-07-27 15:46 ben - - Changed: - crypto/aes/aes.h (1.1.2.5), "Exp", lines: +3 -0 - crypto/aes/aes_cfb.c (1.1.2.4), "Exp", lines: +57 -0 - - Add untested CFB-r mode. Will be tested soon. - -2003-07-28 17:07 ben - - Changed: - Makefile.org (1.154.2.69), "Exp", lines: +5 -1 - crypto/aes/aes.h (1.1.2.6), "Exp", lines: +3 -0 - crypto/aes/aes_cfb.c (1.1.2.5), "Exp", lines: +19 -0 - crypto/dsa/Makefile.ssl (1.49.2.6), "Exp", lines: +3 -2 - crypto/err/Makefile.ssl (1.48.2.4), "Exp", lines: +17 -16 - crypto/evp/e_aes.c (1.6.2.5), "Exp", lines: +8 -0 - crypto/evp/e_des.c (1.5.2.2), "Exp", lines: +1 -1 - crypto/evp/e_des3.c (1.8.2.3), "Exp", lines: +2 -2 - crypto/evp/evp.h (1.86.2.11), "Exp", lines: +28 -11 - crypto/evp/evp_locl.h (1.7.2.3), "Exp", lines: +2 -2 - crypto/objects/obj_dat.h (1.49.2.13), "Exp", lines: +10 -5 - crypto/objects/obj_mac.h (1.19.2.13), "Exp", lines: +5 -0 - crypto/objects/obj_mac.num (1.15.2.9), "Exp", lines: +1 -0 - crypto/objects/objects.txt (1.20.2.14), "Exp", lines: +4 -0 - fips/Makefile.ssl (1.1.2.3), "Exp", lines: +7 -0 - fips/aes/Makefile.ssl (1.1.2.2), "Exp", lines: +23 -1 - fips/aes/fips_aesavs.c (1.1.2.3), "Exp", lines: +9 -1 - test/Makefile.ssl (1.84.2.30), "Exp", lines: +101 -43 - - Add support for partial CFB modes, make tests work, update - dependencies. - -2003-07-29 12:56 ben - - Changed: - crypto/aes/aes_cfb.c (1.1.2.6), "Exp", lines: +9 -6 - crypto/evp/c_allc.c (1.8.2.3), "Exp", lines: +1 -0 - crypto/evp/evp_test.c (1.14.2.11), "Exp", lines: +17 -8 - crypto/evp/evptests.txt (1.9.2.2), "Exp", lines: +48 -1 - - Working CFB1 and test vectors. - -2003-07-29 15:24 ben - - Changed: - crypto/evp/e_aes.c (1.6.2.6), "Exp", lines: +14 -0 - crypto/objects/obj_dat.h (1.49.2.14), "Exp", lines: +15 -5 - crypto/objects/obj_mac.h (1.19.2.14), "Exp", lines: +10 -0 - crypto/objects/obj_mac.num (1.15.2.10), "Exp", lines: +2 -0 - crypto/objects/objects.txt (1.20.2.15), "Exp", lines: +2 -0 - fips/aes/Makefile.ssl (1.1.2.3), "Exp", lines: +1 -1 - fips/aes/fips_aesavs.c (1.1.2.4), "Exp", lines: +34 -19 - - The rest of the keysizes for CFB1, working AES AVS test for CFB1. - -2003-07-29 19:05 ben - - Changed: - crypto/aes/aes.h (1.1.2.7), "Exp", lines: +3 -0 - crypto/aes/aes_cfb.c (1.1.2.7), "Exp", lines: +14 -0 - crypto/evp/c_allc.c (1.8.2.4), "Exp", lines: +1 -0 - crypto/evp/e_aes.c (1.6.2.7), "Exp", lines: +4 -9 - crypto/evp/evptests.txt (1.9.2.3), "Exp", lines: +48 -0 - crypto/objects/obj_dat.h (1.49.2.15), "Exp", lines: +20 -5 - crypto/objects/obj_mac.h (1.19.2.15), "Exp", lines: +15 -0 - crypto/objects/obj_mac.num (1.15.2.11), "Exp", lines: +3 -0 - crypto/objects/objects.txt (1.20.2.16), "Exp", lines: +3 -0 - fips/aes/fips_aesavs.c (1.1.2.7), "Exp", lines: +11 -0 - - AES CFB8. - -2003-07-30 20:30 ben - - Changed: - Makefile.org (1.154.2.70), "Exp", lines: +16 -5 - crypto/des/cfb_enc.c (1.7.2.1), "Exp", lines: +2 -1 - crypto/des/des_enc.c (1.11.2.2), "Exp", lines: +4 -0 - crypto/evp/e_aes.c (1.6.2.8), "Exp", lines: +7 -14 - crypto/evp/e_des.c (1.5.2.3), "Exp", lines: +37 -1 - crypto/evp/evp.h (1.86.2.12), "Exp", lines: +6 -0 - crypto/evp/evp_locl.h (1.7.2.4), "Exp", lines: +9 -0 - crypto/objects/obj_dat.h (1.49.2.16), "Exp", lines: +48 -23 - crypto/objects/obj_mac.h (1.19.2.16), "Exp", lines: +31 -6 - crypto/objects/obj_mac.num (1.15.2.12), "Exp", lines: +5 -0 - crypto/objects/objects.txt (1.20.2.17), "Exp", lines: +12 -6 - fips/Makefile.ssl (1.1.2.4), "Exp", lines: +8 -1 - fips/fips_make_sha1 (1.1.2.3), "Exp", lines: +3 -0 - fips/aes/Makefile.ssl (1.1.2.4), "Exp", lines: +1 -1 - fips/des/.cvsignore (1.1.2.1), "Exp", lines: +3 -0 - fips/des/Makefile.ssl (1.1.2.1), "Exp", lines: +96 -0 - fips/des/fingerprint.sha1 (1.1.2.1), "Exp", lines: +2 -0 - fips/des/fips_des_enc.c (1.1.2.1), "Exp", lines: +288 -0 - fips/des/fips_des_locl.h (1.1.2.1), "Exp", lines: +428 -0 - fips/des/fips_desmovs.c (1.1.2.1), "Exp", lines: +659 -0 - - Whoops, forgot FIPS DES, also add EVPs for DES CFB1 and 8. - -2003-08-01 12:25 ben - - Changed: - crypto/des/cfb_enc.c (1.7.2.2), "Exp", lines: +45 -36 - crypto/evp/c_allc.c (1.8.2.5), "Exp", lines: +2 -0 - crypto/evp/e_des.c (1.5.2.4), "Exp", lines: +8 -3 - crypto/evp/evptests.txt (1.9.2.4), "Exp", lines: +6 -0 - - Fix DES CFB-r. - -2003-08-01 12:31 ben - - Changed: - crypto/evp/evptests.txt (1.9.2.5), "Exp", lines: +4 -0 - - DES CFB8 test. - -2005-04-19 16:21 appro - - Changed: - Configure (1.314.2.117), "Exp", lines: +24 -21 - Makefile.org (1.154.2.100), "Exp", lines: +1 -11 - TABLE (1.99.2.52), "Exp", lines: +20 -20 - apps/Makefile (1.1.4.15), "Exp", lines: +1 -1 - test/Makefile (1.1.4.12), "Exp", lines: +1 -1 - - Enable shared link on HP-UX. - diff --git a/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head_FIPS b/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head_FIPS deleted file mode 100644 index 1e6c88f77..000000000 --- a/sys/src/ape/lib/openssl/ChangeLog.0_9_7-stable_not-in-head_FIPS +++ /dev/null @@ -1,1494 +0,0 @@ -See file ChangeLog.0_9_7-stable_not-in-head for explanations. -This is the "FIPS"-related part. - - - -2003-07-27 19:00 ben - - Changed: - Configure (1.314.2.85), "Exp", lines: +2 -0 - Makefile.org (1.154.2.67), "Exp", lines: +12 -3 - crypto/cryptlib.c (1.32.2.9), "Exp", lines: +5 -0 - crypto/md32_common.h (1.22.2.4), "Exp", lines: +11 -0 - crypto/aes/Makefile.ssl (1.4.2.6), "Exp", lines: +2 -1 - crypto/aes/aes_core.c (1.1.2.4), "Exp", lines: +4 -0 - crypto/des/des.h (1.40.2.4), "Exp", lines: +1 -1 - crypto/des/des_old.c (1.11.2.4), "Exp", lines: +1 -1 - crypto/des/destest.c (1.30.2.6), "Exp", lines: +2 -2 - crypto/des/ecb3_enc.c (1.8.2.1), "Exp", lines: +1 -3 - crypto/dsa/Makefile.ssl (1.49.2.5), "Exp", lines: +7 -4 - crypto/dsa/dsa_ossl.c (1.12.2.4), "Exp", lines: +2 -0 - crypto/dsa/dsa_sign.c (1.10.2.3), "Exp", lines: +12 -0 - crypto/dsa/dsa_vrf.c (1.10.2.3), "Exp", lines: +8 -0 - crypto/engine/engine.h (1.36.2.6), "Exp", lines: +4 -0 - crypto/err/err.h (1.35.2.3), "Exp", lines: +2 -0 - crypto/err/err_all.c (1.17.2.2), "Exp", lines: +4 -0 - crypto/err/openssl.ec (1.11.2.1), "Exp", lines: +1 -0 - crypto/evp/Makefile.ssl (1.64.2.8), "Exp", lines: +8 -7 - crypto/evp/c_all.c (1.7.8.7), "Exp", lines: +1 -0 - crypto/evp/e_aes.c (1.6.2.4), "Exp", lines: +12 -4 - crypto/evp/e_des3.c (1.8.2.2), "Exp", lines: +1 -1 - crypto/evp/evp.h (1.86.2.10), "Exp", lines: +2 -0 - crypto/evp/evp_err.c (1.23.2.1), "Exp", lines: +3 -1 - crypto/md4/Makefile.ssl (1.6.2.4), "Exp", lines: +7 -4 - crypto/md5/Makefile.ssl (1.33.2.7), "Exp", lines: +7 -4 - crypto/rand/Makefile.ssl (1.56.2.4), "Exp", lines: +17 -15 - crypto/rand/md_rand.c (1.69.2.2), "Exp", lines: +9 -0 - crypto/rand/rand.h (1.26.2.5), "Exp", lines: +2 -0 - crypto/rand/rand_err.c (1.6.2.1), "Exp", lines: +3 -1 - crypto/rand/rand_lib.c (1.15.2.2), "Exp", lines: +11 -0 - crypto/ripemd/Makefile.ssl (1.25.2.5), "Exp", lines: +7 -2 - crypto/sha/Makefile.ssl (1.26.2.5), "Exp", lines: +16 -6 - fips/.cvsignore (1.1.2.1), "Exp", lines: +1 -0 - fips/Makefile.ssl (1.1.2.1), "Exp", lines: +155 -0 - fips/fingerprint.sha1 (1.1.2.1), "Exp", lines: +3 -0 - fips/fips.c (1.1.2.1), "Exp", lines: +74 -0 - fips/fips.h (1.1.2.1), "Exp", lines: +85 -0 - fips/fips_check_sha1 (1.1.2.1), "Exp", lines: +7 -0 - fips/fips_err.c (1.1.2.1), "Exp", lines: +96 -0 - fips/fips_make_sha1 (1.1.2.1), "Exp", lines: +21 -0 - fips/lib (1.1.2.1), "Exp", lines: +0 -0 - fips/aes/.cvsignore (1.1.2.1), "Exp", lines: +4 -0 - fips/aes/Makefile.ssl (1.1.2.1), "Exp", lines: +95 -0 - fips/aes/fingerprint.sha1 (1.1.2.1), "Exp", lines: +2 -0 - fips/aes/fips_aes_core.c (1.1.2.1), "Exp", lines: +1260 -0 - fips/aes/fips_aes_locl.h (1.1.2.1), "Exp", lines: +85 -0 - fips/aes/fips_aesavs.c (1.1.2.1), "Exp", lines: +896 -0 - fips/dsa/.cvsignore (1.1.2.1), "Exp", lines: +2 -0 - fips/dsa/Makefile.ssl (1.1.2.1), "Exp", lines: +95 -0 - fips/dsa/fingerprint.sha1 (1.1.2.1), "Exp", lines: +1 -0 - fips/dsa/fips_dsa_ossl.c (1.1.2.1), "Exp", lines: +366 -0 - fips/dsa/fips_dsatest.c (1.1.2.1), "Exp", lines: +252 -0 - fips/rand/.cvsignore (1.1.2.1), "Exp", lines: +2 -0 - fips/rand/Makefile.ssl (1.1.2.1), "Exp", lines: +94 -0 - fips/rand/fingerprint.sha1 (1.1.2.1), "Exp", lines: +2 -0 - fips/rand/fips_rand.c (1.1.2.1), "Exp", lines: +236 -0 - fips/rand/fips_rand.h (1.1.2.1), "Exp", lines: +55 -0 - fips/rand/fips_randtest.c (1.1.2.1), "Exp", lines: +348 -0 - fips/sha1/.cvsignore (1.1.2.1), "Exp", lines: +3 -0 - fips/sha1/Makefile.ssl (1.1.2.1), "Exp", lines: +94 -0 - fips/sha1/fingerprint.sha1 (1.1.2.1), "Exp", lines: +3 -0 - fips/sha1/fips_md32_common.h (1.1.2.1), "Exp", lines: +637 -0 - fips/sha1/fips_sha1dgst.c (1.1.2.1), "Exp", lines: +76 -0 - fips/sha1/fips_sha1test.c (1.1.2.1), "Exp", lines: +128 -0 - fips/sha1/fips_sha_locl.h (1.1.2.1), "Exp", lines: +472 -0 - fips/sha1/fips_standalone_sha1.c (1.1.2.1), "Exp", lines: +101 -0 - fips/sha1/standalone.sha1 (1.1.2.1), "Exp", lines: +4 -0 - test/Makefile.ssl (1.84.2.29), "Exp", lines: +81 -13 - util/mkerr.pl (1.18.2.4), "Exp", lines: +2 -1 - - Unfinished FIPS stuff for review/improvement. - -2003-07-27 19:19 ben - - Changed: - fips/fips_check_sha1 (1.1.2.2), "Exp", lines: +1 -1 - - Use unified diff. - -2003-07-27 19:23 ben - - Changed: - fips/Makefile.ssl (1.1.2.2), "Exp", lines: +3 -3 - fips/fingerprint.sha1 (1.1.2.2), "Exp", lines: +2 -1 - fips/fips_make_sha1 (1.1.2.2), "Exp", lines: +1 -1 - - Build in non-FIPS mode. - -2003-07-27 23:13 ben - - Changed: - Makefile.org (1.154.2.68), "Exp", lines: +1 -1 - fips/fips_check_sha1 (1.1.2.3), "Exp", lines: +2 -1 - fips/aes/fips_aesavs.c (1.1.2.2), "Exp", lines: +2 -0 - fips/dsa/fips_dsa_ossl.c (1.1.2.2), "Exp", lines: +8 -0 - fips/dsa/fips_dsatest.c (1.1.2.2), "Exp", lines: +2 -1 - fips/sha1/fingerprint.sha1 (1.1.2.2), "Exp", lines: +1 -1 - fips/sha1/fips_sha1dgst.c (1.1.2.2), "Exp", lines: +5 -1 - fips/sha1/fips_standalone_sha1.c (1.1.2.2), "Exp", lines: +2 -0 - fips/sha1/standalone.sha1 (1.1.2.2), "Exp", lines: +1 -1 - - Build when not FIPS. - -2003-07-28 11:56 ben - - Changed: - fips/dsa/fingerprint.sha1 (1.1.2.2), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.3), "Exp", lines: +1 -1 - - New fingerprints. - -2003-07-29 16:06 ben - - Changed: - fips/aes/fips_aesavs.c (1.1.2.5), "Exp", lines: +295 -303 - - Reformat. - -2003-07-29 16:34 ben - - Changed: - fips/aes/fips_aesavs.c (1.1.2.6), "Exp", lines: +43 -17 - - MMT for CFB1 - -2003-07-29 17:17 ben - - Changed: - fips/fips_err_wrapper.c (1.1.2.1), "Exp", lines: +5 -0 - fips/sha1/sha1hashes.txt (1.1.2.1), "Exp", lines: +342 -0 - fips/sha1/sha1vectors.txt (1.1.2.1), "Exp", lines: +2293 -0 - - Missing files. - -2003-07-31 23:30 levitte - - Changed: - Makefile.org (1.154.2.71), "Exp", lines: +2 -0 - - If FDIRS is to be treated like SDIRS, let's not forget to - initialize it in Makefile.org. - -2003-07-31 23:41 levitte - - Changed: - fips/sha1/fips_sha1test.c (1.1.2.2), "Exp", lines: +3 -3 - - No C++ comments in C programs! - -2003-08-01 15:07 steve - - Changed: - fips/aes/fips_aesavs.c (1.1.2.8), "Exp", lines: +3 -3 - - Replace C++ style comments. - -2003-08-03 14:22 ben - - Changed: - fips/des/fips_desmovs.c (1.1.2.2), "Exp", lines: +55 -37 - - Make tests work (CFB1 still doesn't produce the right answers, - strangely). - -2003-08-08 12:08 levitte - - Changed: - fips/des/fips_des_enc.c (1.1.2.2), "Exp", lines: +9 -0 - - Avoid clashing with the regular DES functions when not compiling - with -DFIPS. This is basically only visible when building with - shared library supoort... - -2003-08-11 11:36 levitte - - Deleted: - fips/sha1/.cvsignore (1.1.2.2) - fips/sha1/Makefile.ssl (1.1.2.3) - fips/sha1/fingerprint.sha1 (1.1.2.3) - fips/sha1/fips_md32_common.h (1.1.2.2) - fips/sha1/fips_sha1dgst.c (1.1.2.3) - fips/sha1/fips_sha1test.c (1.1.2.3) - fips/sha1/fips_sha_locl.h (1.1.2.2) - fips/sha1/fips_standalone_sha1.c (1.1.2.3) - fips/sha1/sha1hashes.txt (1.1.2.2) - fips/sha1/sha1vectors.txt (1.1.2.2) - fips/sha1/standalone.sha1 (1.1.2.4) - fips/dsa/.cvsignore (1.1.2.2) - fips/dsa/Makefile.ssl (1.1.2.2) - fips/dsa/fingerprint.sha1 (1.1.2.3) - fips/dsa/fips_dsa_ossl.c (1.1.2.3) - fips/dsa/fips_dsatest.c (1.1.2.3) - fips/rand/.cvsignore (1.1.2.2) - fips/rand/Makefile.ssl (1.1.2.2) - fips/rand/fingerprint.sha1 (1.1.2.2) - fips/rand/fips_rand.c (1.1.2.2) - fips/rand/fips_rand.h (1.1.2.2) - fips/rand/fips_randtest.c (1.1.2.2) - fips/des/.cvsignore (1.1.2.2) - fips/des/Makefile.ssl (1.1.2.3) - fips/des/fingerprint.sha1 (1.1.2.2) - fips/des/fips_des_enc.c (1.1.2.3) - fips/des/fips_des_locl.h (1.1.2.2) - fips/des/fips_desmovs.c (1.1.2.3) - fips/aes/.cvsignore (1.1.2.2) - fips/aes/Makefile.ssl (1.1.2.5) - fips/aes/fingerprint.sha1 (1.1.2.2) - fips/aes/fips_aes_core.c (1.1.2.2) - fips/aes/fips_aes_locl.h (1.1.2.2) - fips/aes/fips_aesavs.c (1.1.2.9) - fips/.cvsignore (1.1.2.2) - fips/Makefile.ssl (1.1.2.6) - fips/fingerprint.sha1 (1.1.2.3) - fips/fips.c (1.1.2.2) - fips/fips.h (1.1.2.2) - fips/fips_check_sha1 (1.1.2.4) - fips/fips_err.c (1.1.2.2) - fips/fips_err_wrapper.c (1.1.2.2) - fips/fips_make_sha1 (1.1.2.4) - fips/lib (1.1.2.2) - Changed: - util/libeay.num (1.173.2.16), "Exp", lines: +11 -38 - util/mkerr.pl (1.18.2.5), "Exp", lines: +1 -2 - test/Makefile.ssl (1.84.2.31), "Exp", lines: +54 -180 - crypto/ripemd/Makefile.ssl (1.25.2.6), "Exp", lines: +2 -7 - crypto/sha/Makefile.ssl (1.26.2.6), "Exp", lines: +6 -16 - crypto/rand/Makefile.ssl (1.56.2.5), "Exp", lines: +15 -17 - crypto/rand/md_rand.c (1.69.2.3), "Exp", lines: +0 -9 - crypto/rand/rand.h (1.26.2.6), "Exp", lines: +0 -2 - crypto/rand/rand_err.c (1.6.2.2), "Exp", lines: +1 -3 - crypto/rand/rand_lib.c (1.15.2.3), "Exp", lines: +0 -11 - crypto/objects/obj_dat.h (1.49.2.18), "Exp", lines: +3 -27 - crypto/objects/obj_mac.h (1.19.2.18), "Exp", lines: +0 -32 - crypto/objects/obj_mac.num (1.15.2.14), "Exp", lines: +0 -8 - crypto/objects/objects.txt (1.20.2.19), "Exp", lines: +0 -11 - crypto/md4/Makefile.ssl (1.6.2.5), "Exp", lines: +4 -7 - crypto/md5/Makefile.ssl (1.33.2.8), "Exp", lines: +4 -7 - crypto/evp/Makefile.ssl (1.64.2.9), "Exp", lines: +7 -8 - crypto/evp/c_allc.c (1.8.2.6), "Exp", lines: +0 -4 - crypto/evp/e_aes.c (1.6.2.9), "Exp", lines: +4 -22 - crypto/evp/e_des.c (1.5.2.5), "Exp", lines: +2 -43 - crypto/evp/e_des3.c (1.8.2.4), "Exp", lines: +3 -3 - crypto/evp/evp.h (1.86.2.13), "Exp", lines: +11 -36 - crypto/evp/evp_err.c (1.23.2.2), "Exp", lines: +1 -3 - crypto/evp/evp_lib.c (1.6.8.3), "Exp", lines: +0 -24 - crypto/evp/evp_locl.h (1.7.2.5), "Exp", lines: +2 -11 - crypto/evp/evp_test.c (1.14.2.12), "Exp", lines: +8 -17 - crypto/evp/evptests.txt (1.9.2.6), "Exp", lines: +1 -106 - crypto/dsa/Makefile.ssl (1.49.2.7), "Exp", lines: +6 -10 - crypto/dsa/dsa_ossl.c (1.12.2.5), "Exp", lines: +0 -2 - crypto/dsa/dsa_sign.c (1.10.2.4), "Exp", lines: +0 -12 - crypto/dsa/dsa_vrf.c (1.10.2.4), "Exp", lines: +0 -8 - crypto/err/Makefile.ssl (1.48.2.5), "Exp", lines: +16 -17 - crypto/err/err.h (1.35.2.4), "Exp", lines: +0 -2 - crypto/err/err_all.c (1.17.2.3), "Exp", lines: +0 -4 - crypto/err/openssl.ec (1.11.2.2), "Exp", lines: +0 -1 - crypto/des/des.h (1.40.2.5), "Exp", lines: +1 -1 - crypto/des/des_enc.c (1.11.2.3), "Exp", lines: +0 -4 - crypto/des/des_old.c (1.11.2.5), "Exp", lines: +1 -1 - crypto/des/destest.c (1.30.2.7), "Exp", lines: +2 -2 - crypto/des/ecb3_enc.c (1.8.2.2), "Exp", lines: +3 -1 - crypto/aes/Makefile.ssl (1.4.2.7), "Exp", lines: +1 -2 - crypto/aes/aes.h (1.1.2.8), "Exp", lines: +0 -9 - crypto/aes/aes_cfb.c (1.1.2.8), "Exp", lines: +0 -93 - crypto/aes/aes_core.c (1.1.2.5), "Exp", lines: +0 -4 - crypto/cryptlib.c (1.32.2.10), "Exp", lines: +0 -5 - crypto/md32_common.h (1.22.2.5), "Exp", lines: +0 -11 - Configure (1.314.2.86), "Exp", lines: +0 -2 - Makefile.org (1.154.2.72), "Exp", lines: +8 -34 - TABLE (1.99.2.30), "Exp", lines: +0 -50 - - A new branch for FIPS-related changes has been created with the - name OpenSSL-fips-0_9_7-stable. - - Since the 0.9.7-stable branch is supposed to be in freeze - and should only contain bug corrections, this change removes the - FIPS changes from that branch. - -2004-05-11 14:44 ben - - Deleted: - apps/Makefile.ssl (1.100.2.27) - crypto/Makefile.ssl (1.84.2.12) - crypto/aes/Makefile.ssl (1.4.2.9) - crypto/asn1/Makefile.ssl (1.77.2.7) - crypto/bf/Makefile.ssl (1.25.2.6) - crypto/bio/Makefile.ssl (1.52.2.4) - crypto/bn/Makefile.ssl (1.65.2.9) - crypto/buffer/Makefile.ssl (1.32.2.4) - crypto/cast/Makefile.ssl (1.31.2.6) - crypto/comp/Makefile.ssl (1.32.2.4) - crypto/conf/Makefile.ssl (1.38.2.8) - crypto/des/Makefile.ssl (1.61.2.13) - crypto/dh/Makefile.ssl (1.43.2.5) - crypto/dsa/Makefile.ssl (1.49.2.9) - crypto/dso/Makefile.ssl (1.11.2.4) - crypto/ec/Makefile.ssl (1.7.2.4) - crypto/engine/Makefile.ssl (1.30.2.13) - crypto/err/Makefile.ssl (1.48.2.7) - crypto/evp/Makefile.ssl (1.64.2.12) - crypto/hmac/Makefile.ssl (1.33.2.6) - crypto/idea/Makefile.ssl (1.20.2.4) - crypto/krb5/Makefile.ssl (1.5.2.6) - crypto/lhash/Makefile.ssl (1.28.2.4) - crypto/md2/Makefile.ssl (1.29.2.5) - crypto/md4/Makefile.ssl (1.6.2.7) - crypto/md5/Makefile.ssl (1.33.2.10) - crypto/mdc2/Makefile.ssl (1.30.2.4) - crypto/objects/Makefile.ssl (1.46.2.6) - crypto/ocsp/Makefile.ssl (1.19.2.7) - crypto/pem/Makefile.ssl (1.51.2.5) - crypto/pkcs12/Makefile.ssl (1.37.2.5) - crypto/pkcs7/Makefile.ssl (1.47.2.5) - crypto/rand/Makefile.ssl (1.56.2.8) - crypto/rc2/Makefile.ssl (1.20.2.4) - crypto/rc4/Makefile.ssl (1.25.2.6) - crypto/rc5/Makefile.ssl (1.22.2.6) - crypto/ripemd/Makefile.ssl (1.25.2.9) - crypto/rsa/Makefile.ssl (1.53.2.6) - crypto/sha/Makefile.ssl (1.26.2.9) - crypto/stack/Makefile.ssl (1.28.2.4) - crypto/txt_db/Makefile.ssl (1.26.2.4) - crypto/ui/Makefile.ssl (1.10.2.6) - crypto/x509/Makefile.ssl (1.56.2.5) - crypto/x509v3/Makefile.ssl (1.62.2.5) - ssl/Makefile.ssl (1.53.2.11) - test/Makefile.ssl (1.84.2.36) - tools/Makefile.ssl (1.9.2.4) - Changed: - .cvsignore (1.7.6.2), "Exp", lines: +2 -1 - Configure (1.314.2.92), "Exp", lines: +38 -8 - FAQ (1.61.2.31), "Exp", lines: +1 -1 - INSTALL (1.45.2.9), "Exp", lines: +2 -2 - INSTALL.W32 (1.30.2.14), "Exp", lines: +9 -4 - Makefile.org (1.154.2.78), "Exp", lines: +51 -19 - PROBLEMS (1.4.2.10), "Exp", lines: +2 -2 - e_os.h (1.56.2.17), "Exp", lines: +20 -1 - apps/.cvsignore (1.5.8.1), "Exp", lines: +1 -0 - apps/Makefile (1.1.4.1), "Exp", lines: +1147 -0 - apps/apps.c (1.49.2.27), "Exp", lines: +0 -10 - apps/ca.c (1.102.2.31), "Exp", lines: +0 -10 - apps/dgst.c (1.23.2.10), "Exp", lines: +39 -11 - apps/openssl.c (1.48.2.9), "Exp", lines: +19 -0 - crypto/Makefile (1.1.4.1), "Exp", lines: +217 -0 - crypto/cryptlib.c (1.32.2.11), "Exp", lines: +5 -0 - crypto/crypto-lib.com (1.53.2.12), "Exp", lines: +1 -1 - crypto/md32_common.h (1.22.2.6), "Exp", lines: +12 -0 - crypto/aes/Makefile (1.1.4.1), "Exp", lines: +102 -0 - crypto/aes/aes.h (1.1.2.9), "Exp", lines: +9 -0 - crypto/aes/aes_cfb.c (1.1.2.9), "Exp", lines: +93 -0 - crypto/aes/aes_core.c (1.1.2.6), "Exp", lines: +4 -0 - crypto/asn1/Makefile (1.1.4.1), "Exp", lines: +1150 -0 - crypto/bf/Makefile (1.1.4.1), "Exp", lines: +113 -0 - crypto/bio/Makefile (1.1.4.1), "Exp", lines: +214 -0 - crypto/bio/bio.h (1.56.2.6), "Exp", lines: +1 -0 - crypto/bn/Makefile (1.1.4.1), "Exp", lines: +324 -0 - crypto/bn/bntest.c (1.55.2.4), "Exp", lines: +1 -1 - crypto/buffer/Makefile (1.1.4.1), "Exp", lines: +92 -0 - crypto/cast/Makefile (1.1.4.1), "Exp", lines: +118 -0 - crypto/cast/asm/.cvsignore (1.2.8.1), "Exp", lines: +1 -0 - crypto/comp/Makefile (1.1.4.1), "Exp", lines: +112 -0 - crypto/conf/Makefile (1.1.4.1), "Exp", lines: +181 -0 - crypto/des/Makefile (1.1.4.1), "Exp", lines: +314 -0 - crypto/des/cfb64ede.c (1.6.2.4), "Exp", lines: +111 -0 - crypto/des/des.h (1.40.2.6), "Exp", lines: +5 -1 - crypto/des/des_enc.c (1.11.2.4), "Exp", lines: +8 -0 - crypto/des/des_old.c (1.11.2.6), "Exp", lines: +1 -1 - crypto/des/destest.c (1.30.2.8), "Exp", lines: +2 -2 - crypto/des/ecb3_enc.c (1.8.2.3), "Exp", lines: +1 -3 - crypto/des/set_key.c (1.18.2.2), "Exp", lines: +4 -0 - crypto/dh/Makefile (1.1.4.1), "Exp", lines: +131 -0 - crypto/dsa/Makefile (1.1.4.1), "Exp", lines: +173 -0 - crypto/dsa/dsa_gen.c (1.19.2.1), "Exp", lines: +4 -1 - crypto/dsa/dsa_key.c (1.9.2.1), "Exp", lines: +2 -0 - crypto/dsa/dsa_ossl.c (1.12.2.6), "Exp", lines: +2 -0 - crypto/dsa/dsa_sign.c (1.10.2.5), "Exp", lines: +12 -0 - crypto/dsa/dsa_vrf.c (1.10.2.5), "Exp", lines: +8 -0 - crypto/dso/Makefile (1.1.4.1), "Exp", lines: +140 -0 - crypto/ec/Makefile (1.1.4.1), "Exp", lines: +126 -0 - crypto/engine/Makefile (1.1.4.1), "Exp", lines: +536 -0 - crypto/engine/hw_cryptodev.c (1.1.2.6), "Exp", lines: +6 -2 - crypto/err/Makefile (1.1.4.1), "Exp", lines: +118 -0 - crypto/err/err.h (1.35.2.6), "Exp", lines: +2 -0 - crypto/err/err_all.c (1.17.2.4), "Exp", lines: +4 -0 - crypto/err/openssl.ec (1.11.2.3), "Exp", lines: +1 -0 - crypto/evp/Makefile (1.1.4.1), "Exp", lines: +1057 -0 - crypto/evp/bio_md.c (1.11.2.1), "Exp", lines: +6 -0 - crypto/evp/c_allc.c (1.8.2.7), "Exp", lines: +8 -0 - crypto/evp/e_aes.c (1.6.2.10), "Exp", lines: +22 -4 - crypto/evp/e_des.c (1.5.2.8), "Exp", lines: +36 -3 - crypto/evp/e_des3.c (1.8.2.7), "Exp", lines: +43 -4 - crypto/evp/evp.h (1.86.2.15), "Exp", lines: +39 -11 - crypto/evp/evp_err.c (1.23.2.3), "Exp", lines: +3 -1 - crypto/evp/evp_lib.c (1.6.8.4), "Exp", lines: +24 -0 - crypto/evp/evp_locl.h (1.7.2.6), "Exp", lines: +11 -2 - crypto/evp/evp_test.c (1.14.2.13), "Exp", lines: +17 -8 - crypto/evp/evptests.txt (1.9.2.7), "Exp", lines: +106 -1 - crypto/hmac/Makefile (1.1.4.1), "Exp", lines: +99 -0 - crypto/idea/Makefile (1.1.4.1), "Exp", lines: +89 -0 - crypto/krb5/Makefile (1.1.4.1), "Exp", lines: +88 -0 - crypto/lhash/Makefile (1.1.4.1), "Exp", lines: +91 -0 - crypto/md2/Makefile (1.1.4.1), "Exp", lines: +91 -0 - crypto/md4/Makefile (1.1.4.1), "Exp", lines: +93 -0 - crypto/md5/Makefile (1.1.4.1), "Exp", lines: +129 -0 - crypto/mdc2/Makefile (1.1.4.1), "Exp", lines: +96 -0 - crypto/objects/Makefile (1.1.4.1), "Exp", lines: +121 -0 - crypto/objects/obj_dat.h (1.49.2.19), "Exp", lines: +33 -3 - crypto/objects/obj_mac.h (1.19.2.19), "Exp", lines: +40 -0 - crypto/objects/obj_mac.num (1.15.2.15), "Exp", lines: +10 -0 - crypto/objects/objects.txt (1.20.2.20), "Exp", lines: +13 -0 - crypto/ocsp/Makefile (1.1.4.1), "Exp", lines: +291 -0 - crypto/pem/Makefile (1.1.4.1), "Exp", lines: +334 -0 - crypto/pkcs12/Makefile (1.1.4.1), "Exp", lines: +415 -0 - crypto/pkcs7/Makefile (1.1.4.1), "Exp", lines: +241 -0 - crypto/rand/Makefile (1.1.4.1), "Exp", lines: +196 -0 - crypto/rand/md_rand.c (1.69.2.4), "Exp", lines: +9 -0 - crypto/rand/rand.h (1.26.2.7), "Exp", lines: +3 -0 - crypto/rand/rand_err.c (1.6.2.3), "Exp", lines: +4 -1 - crypto/rand/rand_lib.c (1.15.2.4), "Exp", lines: +11 -0 - crypto/rc2/Makefile (1.1.4.1), "Exp", lines: +89 -0 - crypto/rc4/Makefile (1.1.4.1), "Exp", lines: +108 -0 - crypto/rc5/Makefile (1.1.4.1), "Exp", lines: +106 -0 - crypto/ripemd/Makefile (1.1.4.1), "Exp", lines: +111 -0 - crypto/rsa/Makefile (1.1.4.1), "Exp", lines: +239 -0 - crypto/rsa/rsa_eay.c (1.28.2.9), "Exp", lines: +1 -1 - crypto/rsa/rsa_gen.c (1.8.6.1), "Exp", lines: +3 -0 - crypto/sha/Makefile (1.1.4.1), "Exp", lines: +118 -0 - crypto/sha/sha1dgst.c (1.21.2.1), "Exp", lines: +8 -0 - crypto/stack/Makefile (1.1.4.1), "Exp", lines: +86 -0 - crypto/txt_db/Makefile (1.1.4.1), "Exp", lines: +86 -0 - crypto/ui/Makefile (1.1.4.1), "Exp", lines: +115 -0 - crypto/x509/Makefile (1.1.4.1), "Exp", lines: +592 -0 - crypto/x509v3/Makefile (1.1.4.1), "Exp", lines: +601 -0 - fips/Makefile (1.1.4.1), "Exp", lines: +202 -0 - fips/fingerprint.sha1 (1.1.2.4), "Exp", lines: +4 -4 - fips/fips.c (1.1.2.3), "Exp", lines: +120 -5 - fips/fips.h (1.1.2.3), "Exp", lines: +42 -2 - fips/fips_check_sha1 (1.1.2.5), "Exp", lines: +2 -2 - fips/fips_err.h (1.1.4.1), "Exp", lines: +117 -0 - fips/fips_err_wrapper.c (1.1.2.3), "Exp", lines: +4 -2 - fips/fips_locl.h (1.1.4.1), "Exp", lines: +62 -0 - fips/fips_make_sha1 (1.1.2.5), "Exp", lines: +9 -6 - fips/fips_test_suite.c (1.1.4.1), "Exp", lines: +302 -0 - fips/openssl_fips_fingerprint (1.1.4.1), "Exp", lines: +25 -0 - fips/aes/Makefile (1.1.4.1), "Exp", lines: +131 -0 - fips/aes/fingerprint.sha1 (1.1.2.3), "Exp", lines: +3 -2 - fips/aes/fips_aes_core.c (1.1.2.3), "Exp", lines: +5 -2 - fips/aes/fips_aes_locl.h (1.1.2.3), "Exp", lines: +0 -0 - fips/aes/fips_aes_selftest.c (1.1.4.1), "Exp", lines: +112 -0 - fips/aes/fips_aesavs.c (1.1.2.10), "Exp", lines: +12 -6 - fips/des/Makefile (1.1.4.1), "Exp", lines: +155 -0 - fips/des/fingerprint.sha1 (1.1.2.3), "Exp", lines: +5 -2 - fips/des/fips_des_enc.c (1.1.2.4), "Exp", lines: +16 -3 - fips/des/fips_des_locl.h (1.1.2.3), "Exp", lines: +1 -1 - fips/des/fips_des_selftest.c (1.1.4.1), "Exp", lines: +200 -0 - fips/des/fips_desmovs.c (1.1.2.4), "Exp", lines: +186 -79 - fips/des/fips_set_key.c (1.1.4.1), "Exp", lines: +415 -0 - fips/des/asm/fips-dx86-elf.s (1.1.4.1), "Exp", lines: +2697 -0 - fips/dsa/Makefile (1.1.4.1), "Exp", lines: +159 -0 - fips/dsa/fingerprint.sha1 (1.1.2.4), "Exp", lines: +3 -1 - fips/dsa/fips_dsa_gen.c (1.1.4.1), "Exp", lines: +373 -0 - fips/dsa/fips_dsa_ossl.c (1.1.2.4), "Exp", lines: +16 -3 - fips/dsa/fips_dsa_selftest.c (1.1.4.1), "Exp", lines: +168 -0 - fips/dsa/fips_dsatest.c (1.1.2.4), "Exp", lines: +10 -6 - fips/dsa/fips_dssvs.c (1.1.4.1), "Exp", lines: +306 -0 - fips/rand/Makefile (1.1.4.1), "Exp", lines: +104 -0 - fips/rand/fingerprint.sha1 (1.1.2.3), "Exp", lines: +2 -2 - fips/rand/fips_rand.c (1.1.2.3), "Exp", lines: +60 -10 - fips/rand/fips_rand.h (1.1.2.3), "Exp", lines: +19 -1 - fips/rand/fips_randtest.c (1.1.2.3), "Exp", lines: +31 -10 - fips/rsa/Makefile (1.1.4.1), "Exp", lines: +112 -0 - fips/rsa/fingerprint.sha1 (1.1.4.1), "Exp", lines: +3 -0 - fips/rsa/fips_rsa_eay.c (1.1.4.1), "Exp", lines: +735 -0 - fips/rsa/fips_rsa_gen.c (1.1.4.1), "Exp", lines: +249 -0 - fips/rsa/fips_rsa_selftest.c (1.1.4.1), "Exp", lines: +207 -0 - fips/sha1/.cvsignore (1.1.2.3), "Exp", lines: +1 -2 - fips/sha1/Makefile (1.1.4.1), "Exp", lines: +158 -0 - fips/sha1/fingerprint.sha1 (1.1.2.4), "Exp", lines: +5 -3 - fips/sha1/fips_md32_common.h (1.1.2.3), "Exp", lines: +0 -0 - fips/sha1/fips_sha1_selftest.c (1.1.4.1), "Exp", lines: +97 -0 - fips/sha1/fips_sha1dgst.c (1.1.2.4), "Exp", lines: +4 -4 - fips/sha1/fips_sha1test.c (1.1.2.4), "Exp", lines: +17 -0 - fips/sha1/fips_sha_locl.h (1.1.2.3), "Exp", lines: +7 -0 - fips/sha1/fips_standalone_sha1.c (1.1.2.4), "Exp", lines: +60 -7 - fips/sha1/sha1hashes.txt (1.1.2.3), "Exp", lines: +0 -0 - fips/sha1/sha1vectors.txt (1.1.2.3), "Exp", lines: +0 -0 - fips/sha1/standalone.sha1 (1.1.2.5), "Exp", lines: +6 -4 - fips/sha1/asm/sx86-elf.s (1.1.4.1), "Exp", lines: +1568 -0 - ms/do_masm.bat (1.1.8.2), "Exp", lines: +12 -10 - ms/do_ms.bat (1.4.8.2), "Exp", lines: +11 -11 - ms/do_nasm.bat (1.1.8.2), "Exp", lines: +12 -11 - ms/do_nt.bat (1.2.8.1), "Exp", lines: +4 -4 - shlib/hpux10-cc.sh (1.3.2.2), "Exp", lines: +3 -3 - ssl/Makefile (1.1.4.1), "Exp", lines: +1019 -0 - ssl/s3_clnt.c (1.53.2.16), "Exp", lines: +10 -0 - ssl/s3_srvr.c (1.85.2.21), "Exp", lines: +9 -0 - ssl/ssl_cert.c (1.48.2.7), "Exp", lines: +9 -0 - ssl/ssl_lib.c (1.110.2.12), "Exp", lines: +13 -1 - ssl/ssltest.c (1.53.2.23), "Exp", lines: +33 -1 - ssl/t1_enc.c (1.27.2.8), "Exp", lines: +19 -1 - test/.cvsignore (1.4.8.1), "Exp", lines: +4 -0 - test/Makefile (1.1.4.1), "Exp", lines: +941 -0 - test/bctest (1.14.2.1), "Exp", lines: +1 -1 - test/testenc (1.3.8.1), "Exp", lines: +1 -1 - test/testfipsssl (1.1.4.1), "Exp", lines: +113 -0 - tools/Makefile (1.1.4.1), "Exp", lines: +61 -0 - util/cygwin.sh (1.1.2.5), "Exp", lines: +3 -3 - util/domd (1.6.2.3), "Exp", lines: +5 -5 - util/fixNT.sh (1.1.1.2.8.1), "Exp", lines: +3 -3 - util/libeay.num (1.173.2.19), "Exp", lines: +55 -11 - util/mk1mf.pl (1.41.2.10), "Exp", lines: +6 -4 - util/mkdef.pl (1.67.2.7), "Exp", lines: +11 -4 - util/mkerr.pl (1.18.2.6), "Exp", lines: +2 -1 - util/mkfiles.pl (1.12.2.1), "Exp", lines: +8 -1 - util/pod2mantest (1.1.2.7), "Exp", lines: +1 -1 - util/selftest.pl (1.18.2.1), "Exp", lines: +2 -2 - util/pl/BC-16.pl (1.2.2.1), "Exp", lines: +1 -1 - util/pl/BC-32.pl (1.11.2.4), "Exp", lines: +1 -1 - util/pl/Mingw32.pl (1.12.6.5), "Exp", lines: +1 -1 - util/pl/OS2-EMX.pl (1.1.2.3), "Exp", lines: +1 -1 - util/pl/VC-16.pl (1.3.2.1), "Exp", lines: +2 -2 - util/pl/VC-32.pl (1.11.2.3), "Exp", lines: +2 -2 - util/pl/VC-CE.pl (1.1.2.5), "Exp", lines: +1 -1 - util/pl/ultrix.pl (1.2.8.1), "Exp", lines: +1 -1 - - Pull FIPS back into stable. - -2004-05-12 10:27 levitte - - Changed: - apps/Makefile (1.1.4.2), "Exp", lines: +3 -1 - - Only check for FIPS signatures when FIPS is enabled. - -2004-05-12 10:28 levitte - - Changed: - crypto/des/FILES0 (1.1.4.2), "Exp", lines: +1 -1 - - Makefile.ssl changed name to Makefile. - -2004-05-12 10:28 levitte - - Changed: - fips/rand/fips_rand.c (1.1.2.4), "Exp", lines: +5 -1 - - Only really build this file when OPENSSL_FIPS is defined. And oh, - let's keep internal variables static. - -2004-05-12 10:42 levitte - - Changed: - fips/rand/fingerprint.sha1 (1.1.2.4), "Exp", lines: +1 -1 - - I forgot to modify the signature for fips_rand.c... - -2004-05-12 10:46 levitte - - Changed: - fips/rsa/.cvsignore (1.1.4.1), "Exp", lines: +1 -0 - fips/.cvsignore (1.1.2.3), "Exp", lines: +1 -1 - fips/aes/.cvsignore (1.1.2.3), "Exp", lines: +0 -3 - fips/des/.cvsignore (1.1.2.3), "Exp", lines: +0 -2 - fips/dsa/.cvsignore (1.1.2.3), "Exp", lines: +0 -1 - fips/rand/.cvsignore (1.1.2.3), "Exp", lines: +0 -1 - - Ignore the 'lib' timestamp file. - -2004-05-12 12:07 levitte - - Changed: - fips/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - fips/aes/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - fips/des/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - fips/dsa/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - fips/rand/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - fips/rsa/.cvsignore (1.1.4.2), "Exp", lines: +1 -0 - fips/sha1/.cvsignore (1.1.2.4), "Exp", lines: +1 -0 - - Ignore 'Makefile.save' - -2004-05-12 16:11 ben - - Changed: - crypto/rand/rand.h (1.26.2.8), "Exp", lines: +2 -0 - crypto/rand/rand_err.c (1.6.2.4), "Exp", lines: +2 -0 - fips/fingerprint.sha1 (1.1.2.5), "Exp", lines: +1 -1 - fips/fips.c (1.1.2.4), "Exp", lines: +5 -1 - fips/rand/fingerprint.sha1 (1.1.2.5), "Exp", lines: +1 -1 - fips/rand/fips_rand.c (1.1.2.5), "Exp", lines: +29 -0 - - Blow up in people's faces if they don't reseed. - -2004-05-15 19:51 ben - - Changed: - crypto/dh/dh.h (1.23.2.6), "Exp", lines: +1 -0 - crypto/dh/dh_err.c (1.6.2.3), "Exp", lines: +2 -1 - crypto/dh/dh_gen.c (1.8.8.2), "Exp", lines: +9 -0 - fips/fips_test_suite.c (1.1.4.2), "Exp", lines: +4 -3 - fips/aes/fips_aesavs.c (1.1.2.11), "Exp", lines: +49 -1 - fips/des/fingerprint.sha1 (1.1.2.4), "Exp", lines: +1 -1 - fips/des/fips_desmovs.c (1.1.2.5), "Exp", lines: +49 -1 - fips/des/fips_set_key.c (1.1.4.2), "Exp", lines: +2 -0 - fips/sha1/fingerprint.sha1 (1.1.2.5), "Exp", lines: +1 -1 - fips/sha1/fips_md32_common.h (1.1.2.4), "Exp", lines: +3 -0 - fips/sha1/standalone.sha1 (1.1.2.6), "Exp", lines: +1 -1 - - Fix self-tests, ban some things in FIPS mode, fix copyrights. - -2004-05-17 06:28 levitte - - Changed: - util/mk1mf.pl (1.41.2.11), "Exp", lines: +8 -2 - util/pl/BC-16.pl (1.2.2.2), "Exp", lines: +9 -4 - util/pl/BC-32.pl (1.11.2.5), "Exp", lines: +8 -3 - util/pl/Mingw32.pl (1.12.6.6), "Exp", lines: +7 -2 - util/pl/OS2-EMX.pl (1.1.2.4), "Exp", lines: +7 -2 - util/pl/VC-16.pl (1.3.2.2), "Exp", lines: +7 -2 - util/pl/VC-32.pl (1.11.2.4), "Exp", lines: +7 -2 - util/pl/VC-CE.pl (1.1.2.6), "Exp", lines: +7 -2 - util/pl/linux.pl (1.3.6.1), "Exp", lines: +7 -2 - util/pl/ultrix.pl (1.2.8.2), "Exp", lines: +7 -2 - util/pl/unix.pl (1.2.8.1), "Exp", lines: +7 -2 - - Generate SHA1 files on Windows and other platforms supported by - mk1mf.pl, when building in FIPS mode. - - Note: UNTESTED! - -2004-05-17 06:30 levitte - - Changed: - apps/apps.h (1.44.2.14), "Exp", lines: +3 -0 - apps/openssl.c (1.48.2.10), "Exp", lines: +9 -5 - - Make sure the applications know when we are running in FIPS mode. - We can't use the variable in libcrypto, since it's supposedly - unknown. - - Note: currently only supported in MONOLITH mode. - -2004-05-17 06:31 levitte - - Changed: - apps/enc.c (1.35.2.9), "Exp", lines: +10 -1 - - When in FIPS mode, use SHA1 to digest the key, rather than MD5, as - MD5 isn't a FIPS-approved algorithm. - - Note: this means the user needs to keep track of this, and - we need to add support for that... - -2004-05-19 16:16 levitte - - Changed: - fips/rsa/fingerprint.sha1 (1.1.4.2), "Exp", lines: +2 -2 - fips/rsa/fips_rsa_eay.c (1.1.4.2), "Exp", lines: +8 -8 - fips/rsa/fips_rsa_gen.c (1.1.4.2), "Exp", lines: +1 -1 - fips/dsa/fingerprint.sha1 (1.1.2.5), "Exp", lines: +2 -2 - fips/dsa/fips_dsa_gen.c (1.1.4.2), "Exp", lines: +2 -2 - fips/dsa/fips_dsa_ossl.c (1.1.2.5), "Exp", lines: +4 -4 - fips/aes/fingerprint.sha1 (1.1.2.4), "Exp", lines: +1 -1 - fips/aes/fips_aes_core.c (1.1.2.4), "Exp", lines: +5 -5 - crypto/rsa/rsa.h (1.36.2.11), "Exp", lines: +4 -0 - crypto/aes/aes.h (1.1.2.10), "Exp", lines: +6 -0 - crypto/dsa/dsa.h (1.26.2.5), "Exp", lines: +4 -0 - - Define FIPS_*_SIZE_T for AES, DSA and RSA as well, in preparation - for size_t-ification of those algorithms in future version of - OpenSSL... - -2004-05-27 11:33 levitte - - Changed: - makevms.com (1.35.2.3), "Exp", lines: +27 -0 - - Copy the FIPS files to the temporary openssl include directory. - -2004-05-27 12:04 levitte - - Changed: - fips/fips-lib.com (1.1.2.1), "Exp", lines: +1179 -0 - makevms.com (1.35.2.4), "Exp", lines: +8 -0 - - Compile the FIPS directory on VMS as well. fips-lib.com is - essentially a copy of crypto-lib.com, with just a few edits. - -2004-05-27 12:07 levitte - - Changed: - fips/install.com (1.1.2.1), "Exp", lines: +55 -0 - install.com (1.4.2.2), "Exp", lines: +6 -6 - - Run an installation of FIPS stuff as well. - -2004-05-27 12:19 levitte - - Changed: - test/maketests.com (1.13.2.5), "Exp", lines: +3 -3 - apps/makeapps.com (1.18.2.5), "Exp", lines: +3 -3 - - Make sure o_str.h is reachable. - -2004-06-19 15:15 ben - - Changed: - Makefile.org (1.154.2.80), "Exp", lines: +1 -1 - crypto/dh/dh.h (1.23.2.7), "Exp", lines: +0 -1 - crypto/dh/dh_check.c (1.6.2.1), "Exp", lines: +4 -0 - crypto/dh/dh_err.c (1.6.2.4), "Exp", lines: +0 -1 - crypto/dh/dh_gen.c (1.8.8.3), "Exp", lines: +5 -9 - crypto/dh/dh_key.c (1.16.2.3), "Exp", lines: +4 -0 - fips/Makefile (1.1.4.2), "Exp", lines: +13 -14 - fips/fingerprint.sha1 (1.1.2.6), "Exp", lines: +2 -2 - fips/fips.h (1.1.2.4), "Exp", lines: +1 -0 - fips/fips_err.h (1.1.4.2), "Exp", lines: +1 -0 - fips/fips_make_sha1 (1.1.2.6), "Exp", lines: +3 -0 - fips/fips_test_suite.c (1.1.4.3), "Exp", lines: +13 -9 - fips/openssl_fips_fingerprint (1.1.4.2), "Exp", lines: +1 -2 - - The version that was actually submitted for FIPS testing. - -2004-06-19 15:16 ben - - Changed: - fips/dh/Makefile (1.1.2.1), "Exp", lines: +92 -0 - fips/dh/fingerprint.sha1 (1.1.2.1), "Exp", lines: +3 -0 - fips/dh/fips_dh_check.c (1.1.2.1), "Exp", lines: +119 -0 - fips/dh/fips_dh_gen.c (1.1.2.1), "Exp", lines: +182 -0 - fips/dh/fips_dh_key.c (1.1.2.1), "Exp", lines: +222 -0 - - Add Diffie-Hellman to FIPS. - -2004-06-19 15:18 ben - - Changed: - fips/.cvsignore (1.1.2.5), "Exp", lines: +2 -0 - fips/dh/.cvsignore (1.1.2.1), "Exp", lines: +1 -0 - - Update ignores. - -2004-06-21 11:07 levitte - - Changed: - fips/aes/Makefile (1.1.4.2), "Exp", lines: +7 -5 - fips/des/Makefile (1.1.4.2), "Exp", lines: +7 -5 - fips/dh/Makefile (1.1.2.2), "Exp", lines: +7 -6 - fips/dsa/Makefile (1.1.4.2), "Exp", lines: +7 -6 - fips/rsa/Makefile (1.1.4.2), "Exp", lines: +7 -6 - fips/sha1/Makefile (1.1.4.2), "Exp", lines: +7 -5 - - Make sure we don't try to loop over an empty EXHEADER. In the - Makefiles where this was fixed by commenting away code, change it - to check for an empty EXHEADER instead, so we have less hassle in a - future where EXHEADER changes. - - PR: 900 - -2004-06-21 20:05 levitte - - Changed: - Makefile.org (1.154.2.82), "Exp", lines: +3 -1 - - Standard sh doesn't tolerate ! as part of the conditional command. - - PR: 900 - -2004-06-28 22:33 levitte - - Changed: - fips/dh/fips_dh_check.c (1.1.2.2), "Exp", lines: +6 -0 - fips/dh/fips_dh_gen.c (1.1.2.2), "Exp", lines: +6 -2 - fips/dh/fips_dh_key.c (1.1.2.2), "Exp", lines: +8 -0 - - Make sure the FIPS stuff is only really compiled when in FIPS mode. - -2004-07-12 19:59 ben - - Changed: - fips/fips_test_suite.c (1.1.4.4), "Exp", lines: +39 -6 - fips/dh/fingerprint.sha1 (1.1.2.2), "Exp", lines: +3 -3 - - Corrected test program. - -2004-07-17 14:48 appro - - Changed: - fips/des/Makefile (1.1.4.3), "Exp", lines: +1 -1 - - Eliminate enforced -g from CFLAGS. It switches off optimization - with some compilers, e.g. DEC C. - -2004-07-21 19:41 steve - - Changed: - crypto/pem/pem_all.c (1.20.2.1), "Exp", lines: +119 -0 - - When in FIPS mode write private keys in PKCS#8 and PBES2 format to - avoid use of prohibited MD5 algorithm. - -2004-07-23 15:20 ben - - Changed: - fips/rand/fingerprint.sha1 (1.1.2.7), "Exp", lines: +1 -1 - fips/rand/fips_rand.c (1.1.2.7), "Exp", lines: +22 -7 - fips/rand/fips_randtest.c (1.1.2.5), "Exp", lines: +2 -2 - - Convert to X9.31. - -2004-07-21 19:35 steve - - Changed: - fips/fingerprint.sha1 (1.1.2.7), "Exp", lines: +1 -1 - fips/fips.c (1.1.2.5), "Exp", lines: +3 -3 - fips/rsa/fingerprint.sha1 (1.1.4.3), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_selftest.c (1.1.4.2), "Exp", lines: +8 -8 - - Avoid compiler warnings. - -2004-07-27 02:17 steve - - Changed: - fips/fips_test_suite.c (1.1.4.5), "Exp", lines: +9 -8 - - Stop compiler warnings. - -2004-07-27 02:20 steve - - Changed: - crypto/err/err.c (1.51.2.6), "Exp", lines: +1 -0 - - Add FIPS name to error library. - -2004-07-27 14:22 steve - - Changed: - Makefile.org (1.154.2.84), "Exp", lines: +3 -3 - fips/fips_check_sha1 (1.1.2.6), "Exp", lines: +1 -1 - fips/openssl_fips_fingerprint (1.1.4.3), "Exp", lines: +1 -1 - - Rename libcrypto.sha1 to libcrypto.a.sha1 - -2004-07-27 20:28 steve - - Changed: - ssl/s3_lib.c (1.57.2.11), "Exp", lines: +33 -33 - ssl/ssl.h (1.126.2.20), "Exp", lines: +1 -0 - ssl/ssl_ciph.c (1.33.2.9), "Exp", lines: +11 -0 - ssl/ssl_locl.h (1.47.2.3), "Exp", lines: +2 -1 - - New cipher "strength" FIPS which specifies that a cipher suite is - FIPS compatible. - - New cipherstring "FIPS" is all FIPS compatible ciphersuites - except eNULL. - - Only allow FIPS ciphersuites in FIPS mode. - -2004-07-28 04:24 levitte - - Changed: - makevms.com (1.35.2.6), "Exp", lines: +2 -2 - - From the FIPS directory, darnit! - -2004-07-28 15:47 levitte - - Changed: - makevms.com (1.35.2.7), "Exp", lines: +5 -1 - - Define OPENSSL_FIPS in opensslconf.h if a logical name with the - same name is defined. - - Go up one directory level before dealing with FIPS stuff. - -2004-07-30 00:26 levitte - - Changed: - fips/fips-lib.com (1.1.2.2), "Exp", lines: +3 -3 - - We're building crypto stuff, not ssl stuff. Additionally, we're in - the fips subdirectory, not the crypto one... - -2004-07-30 16:37 levitte - - Changed: - fips/sha1/fingerprint.sha1 (1.1.2.7), "Exp", lines: +2 -2 - fips/sha1/fips_md32_common.h (1.1.2.6), "Exp", lines: +1 -1 - fips/sha1/fips_sha_locl.h (1.1.2.5), "Exp", lines: +2 -2 - fips/sha1/fips_standalone_sha1.c (1.1.2.5), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.8), "Exp", lines: +3 -3 - ssl/ssl_ciph.c (1.33.2.10), "Exp", lines: +2 -2 - fips/rsa/fingerprint.sha1 (1.1.4.4), "Exp", lines: +2 -2 - fips/rsa/fips_rsa_eay.c (1.1.4.3), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_gen.c (1.1.4.3), "Exp", lines: +1 -1 - fips/dh/fingerprint.sha1 (1.1.2.3), "Exp", lines: +1 -1 - fips/dh/fips_dh_gen.c (1.1.2.3), "Exp", lines: +1 -1 - fips/dsa/fingerprint.sha1 (1.1.2.6), "Exp", lines: +2 -2 - fips/dsa/fips_dsa_gen.c (1.1.4.3), "Exp", lines: +4 -3 - fips/dsa/fips_dsa_ossl.c (1.1.2.6), "Exp", lines: +2 -2 - fips/des/fingerprint.sha1 (1.1.2.5), "Exp", lines: +2 -2 - fips/des/fips_des_enc.c (1.1.2.5), "Exp", lines: +2 -2 - fips/des/fips_set_key.c (1.1.4.3), "Exp", lines: +3 -3 - fips/fingerprint.sha1 (1.1.2.8), "Exp", lines: +2 -2 - fips/fips.c (1.1.2.6), "Exp", lines: +76 -23 - fips/fips.h (1.1.2.5), "Exp", lines: +2 -3 - fips/fips_locl.h (1.1.4.2), "Exp", lines: +7 -2 - fips/aes/fingerprint.sha1 (1.1.2.5), "Exp", lines: +1 -1 - fips/aes/fips_aes_core.c (1.1.2.5), "Exp", lines: +1 -1 - crypto/rand/md_rand.c (1.69.2.5), "Exp", lines: +1 -1 - crypto/rand/rand_lib.c (1.15.2.5), "Exp", lines: +2 -1 - crypto/dsa/dsa_sign.c (1.10.2.6), "Exp", lines: +2 -2 - crypto/dsa/dsa_vrf.c (1.10.2.6), "Exp", lines: +1 -1 - crypto/pem/pem_all.c (1.20.2.2), "Exp", lines: +2 -2 - crypto/cryptlib.c (1.32.2.12), "Exp", lines: +122 -6 - crypto/crypto.h (1.62.2.8), "Exp", lines: +8 -1 - crypto/md32_common.h (1.22.2.7), "Exp", lines: +2 -2 - - To protect FIPS-related global variables, add locking mechanisms - around them. - - NOTE: because two new locks are added, this adds potential - binary incompatibility with earlier versions in the 0.9.7 series. - However, those locks will only ever be touched when FIPS_mode_set() - is called and after, thanks to a variable that's only changed from - 0 to 1 once (when FIPS_mode_set() is called). So basically, as - long as FIPS mode hasn't been engaged explicitely by the calling - application, the new locks are treated as if they didn't exist at - all, thus not becoming a problem. Applications that are built or - rebuilt to use FIPS functionality will need to be recompiled in any - case, thus not being a problem either. - -2004-08-02 16:15 levitte - - Changed: - crypto/cryptlib.c (1.32.2.13), "Exp", lines: +4 -4 - - Let's lock a write lock when changing values, shall we? - - Thanks to Dr Stephen Henson <shenson@drh-consultancy.co.uk> - for making me aware of this error. - -2004-08-05 20:11 steve - - Changed: - fips/fingerprint.sha1 (1.1.2.9), "Exp", lines: +1 -1 - fips/fips.c (1.1.2.7), "Exp", lines: +1 -1 - - Stop compiler giving bogus shadow warning. - -2004-08-09 14:13 levitte - - Changed: - makevms.com (1.35.2.8), "Exp", lines: +1 -1 - - In the fips directory, we use FIPS-LIB.COM, not CRYPTO-LIB.COM... - -2004-08-09 14:14 levitte - - Changed: - fips/fips-lib.com (1.1.2.3), "Exp", lines: +4 -4 - - Correct typos and include directory specifications. - -2004-08-10 11:11 levitte - - Changed: - fips/fips-lib.com (1.1.2.4), "Exp", lines: +2 -1 - - Update the VMS fips library builder with the DH library. - -2004-08-10 12:04 levitte - - Changed: - fips/rand/fingerprint.sha1 (1.1.2.8), "Exp", lines: +1 -1 - fips/rand/fips_rand.c (1.1.2.8), "Exp", lines: +7 -1 - - With DEC C in ANSI C mode, we need to define _XOPEN_SOURCE_EXTENDED - to get struct timeval and gettimeofday(). - -2004-09-06 16:19 levitte - - Changed: - fips/fips.c (1.1.2.8), "Exp", lines: +5 -4 - - Replace the bogus checks of n with proper uses of feof(), ferror() - and clearerr(). - -2004-09-06 16:21 levitte - - Changed: - fips/sha1/fips_sha_locl.h (1.1.2.6), "Exp", lines: +2 -2 - - num is an unsigned long, but since it was transfered from - crypto/sha/sha_locl.h, where it is in fact an int, we need to check - for less-than-zero as if it was an int... - -2004-10-08 12:03 ben - - Changed: - fips/fingerprint.sha1 (1.1.2.10), "Exp", lines: +1 -1 - fips/sha1/fingerprint.sha1 (1.1.2.8), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.9), "Exp", lines: +1 -1 - - Update fingerprints. - -2004-10-14 07:51 levitte - - Changed: - VMS/mkshared.com (1.3.2.1), "Exp", lines: +8 -0 - - We need to check for OPENSSL_FIPS when building shared libraries, - so we get correct transfer vectors for those functions when - required. - -2004-10-26 13:47 steve - - Changed: - util/mkfiles.pl (1.12.2.2), "Exp", lines: +1 -0 - - Add fips/dh directory to mkfiles.pl - -2004-10-26 14:17 levitte - - Changed: - fips/sha1/Makefile (1.1.4.4), "Exp", lines: +3 -1 - util/mkfiles.pl (1.12.2.3), "Exp", lines: +1 -0 - fips/Makefile (1.1.4.5), "Exp", lines: +7 -1 - crypto/sha/Makefile (1.1.4.4), "Exp", lines: +1 -7 - - fips/dh was missing in mkfiles.pl. make update - -2004-10-26 15:01 steve - - Changed: - util/mkfiles.pl (1.12.2.4), "Exp", lines: +0 -1 - - Only add fips/dh once... - -2004-11-01 09:20 levitte - - Changed: - fips/rand/fingerprint.sha1 (1.1.2.9), "Exp", lines: +1 -1 - fips/rand/fips_rand.c (1.1.2.9), "Exp", lines: +3 -1 - - Make sure _XOPEN_SOURCE_EXTENDED is correctly defined, and only if - not already defined. - -2004-12-09 19:03 appro - - vChanged: - crypto/Makefile (1.1.4.4), "Exp", lines: +2 -0 - - Postpone linking of shared libcrypto in FIPS build. - -2004-12-09 19:13 appro - - Changed: - fips/fingerprint.sha1 (1.1.2.11), "Exp", lines: +1 -1 - fips/fips.c (1.1.2.9), "Exp", lines: +13 -1 - fips/openssl_fips_fingerprint (1.1.4.4), "Exp", lines: +4 -2 - - Cygwin specific FIPS fix-ups. - -2004-12-09 23:43 appro - - Changed: - Configure (1.314.2.100), "Exp", lines: +2 -3 - crypto/des/des_enc.c (1.11.2.5), "Exp", lines: +2 -2 - - Eliminate false dependency on 386 config option is FIPS context. - At the same time limit assembler support to ELF platforms [that's - what is there, ELF modules]. - -2004-12-10 12:37 appro - - Changed: - Configure (1.314.2.101), "Exp", lines: +10 -3 - crypto/des/des_enc.c (1.11.2.6), "Exp", lines: +2 -2 - - Respect no-asm with fips option and disable FIPS DES assembler in - shared context [because it's not PIC]. - -2004-12-10 14:15 appro - - Changed: - fips/sha1/fingerprint.sha1 (1.1.2.10), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.11), "Exp", lines: +1 -1 - fips/sha1/asm/sx86-elf.s (1.1.4.3), "Exp", lines: +32 -32 - - Solaris x86 assembler update. - -2004-12-10 17:30 appro - - Changed: - fips/fips_check_sha1 (1.1.2.7), "Exp", lines: +1 -1 - fips/openssl_fips_fingerprint (1.1.4.5), "Exp", lines: +1 -1 - fips/sha1/Makefile (1.1.4.6), "Exp", lines: +1 -1 - - Adapt FIPS sub-tree for mingw. - -2005-01-03 18:46 steve - - Changed: - fips/rsa/fingerprint.sha1 (1.1.4.5), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_selftest.c (1.1.4.3), "Exp", lines: +55 -11 - - RSA KAT. - -2005-01-11 17:54 levitte - - Changed: - fips/rsa/fingerprint.sha1 (1.1.4.6), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_selftest.c (1.1.4.4), "Exp", lines: +2 -2 - - Clear signed vs. unsigned conflicts. Change the fingerprint - accordingly. - -2005-01-11 19:25 levitte - - Changed: - ssl/ssltest.c (1.53.2.24), "Exp", lines: +2 -2 - fips/rand/fips_randtest.c (1.1.2.6), "Exp", lines: +3 -3 - fips/sha1/fips_sha1test.c (1.1.2.5), "Exp", lines: +10 -4 - fips/des/fips_desmovs.c (1.1.2.6), "Exp", lines: +8 -7 - fips/dsa/fips_dsatest.c (1.1.2.5), "Exp", lines: +2 -2 - apps/openssl.c (1.48.2.12), "Exp", lines: +1 -1 - fips/aes/fips_aesavs.c (1.1.2.12), "Exp", lines: +8 -7 - - Use EXIT() instead of exit(). - -2005-01-26 21:00 steve - - Changed: - apps/dgst.c (1.23.2.13), "Exp", lines: +10 -0 - apps/pkcs12.c (1.60.2.13), "Exp", lines: +8 -1 - crypto/crypto.h (1.62.2.9), "Exp", lines: +49 -0 - crypto/md32_common.h (1.22.2.9), "Exp", lines: +1 -1 - crypto/bf/bf_skey.c (1.6.2.1), "Exp", lines: +2 -1 - crypto/bf/blowfish.h (1.9.2.1), "Exp", lines: +4 -1 - crypto/cast/c_skey.c (1.5.6.1), "Exp", lines: +3 -1 - crypto/cast/cast.h (1.7.2.1), "Exp", lines: +4 -1 - crypto/evp/bio_md.c (1.11.2.3), "Exp", lines: +2 -7 - crypto/evp/digest.c (1.21.2.7), "Exp", lines: +11 -0 - crypto/evp/e_aes.c (1.6.2.11), "Exp", lines: +11 -11 - crypto/evp/e_des.c (1.5.2.9), "Exp", lines: +5 -3 - crypto/evp/e_des3.c (1.8.2.8), "Exp", lines: +6 -6 - crypto/evp/evp.h (1.86.2.16), "Exp", lines: +17 -0 - crypto/evp/evp_enc.c (1.28.2.11), "Exp", lines: +15 -1 - crypto/evp/evp_err.c (1.23.2.4), "Exp", lines: +6 -1 - crypto/evp/evp_locl.h (1.7.2.7), "Exp", lines: +17 -2 - crypto/evp/m_dss.c (1.8.2.1), "Exp", lines: +1 -1 - crypto/evp/m_md2.c (1.9.2.1), "Exp", lines: +1 -0 - crypto/evp/m_md4.c (1.8.2.1), "Exp", lines: +1 -0 - crypto/evp/m_md5.c (1.9.2.1), "Exp", lines: +1 -0 - crypto/evp/m_mdc2.c (1.9.2.1), "Exp", lines: +1 -0 - crypto/evp/m_sha.c (1.8.2.2), "Exp", lines: +1 -0 - crypto/evp/m_sha1.c (1.8.2.1), "Exp", lines: +1 -1 - crypto/evp/names.c (1.7.2.1), "Exp", lines: +3 -0 - crypto/hmac/hmac.c (1.12.2.3), "Exp", lines: +7 -0 - crypto/hmac/hmac.h (1.14.2.2), "Exp", lines: +1 -0 - crypto/idea/i_skey.c (1.5.6.1), "Exp", lines: +13 -0 - crypto/idea/idea.h (1.10.2.1), "Exp", lines: +4 -0 - crypto/md2/md2.h (1.11.2.1), "Exp", lines: +3 -0 - crypto/md2/md2_dgst.c (1.13.2.4), "Exp", lines: +3 -1 - crypto/md4/md4.h (1.3.2.1), "Exp", lines: +3 -0 - crypto/md4/md4_dgst.c (1.2.2.2), "Exp", lines: +1 -1 - crypto/md5/md5.h (1.10.2.3), "Exp", lines: +3 -0 - crypto/md5/md5_dgst.c (1.16.2.2), "Exp", lines: +1 -1 - crypto/mdc2/mdc2.h (1.9.2.1), "Exp", lines: +3 -1 - crypto/mdc2/mdc2dgst.c (1.13.2.1), "Exp", lines: +3 -1 - crypto/rc2/rc2.h (1.10.2.1), "Exp", lines: +4 -1 - crypto/rc2/rc2_skey.c (1.4.6.1), "Exp", lines: +13 -0 - crypto/rc4/rc4.h (1.10.2.2), "Exp", lines: +3 -0 - crypto/rc4/rc4_skey.c (1.10.8.2), "Exp", lines: +2 -1 - crypto/rc5/rc5.h (1.5.2.1), "Exp", lines: +4 -1 - crypto/rc5/rc5_skey.c (1.4.6.1), "Exp", lines: +14 -0 - crypto/ripemd/ripemd.h (1.8.2.1), "Exp", lines: +3 -0 - crypto/ripemd/rmd_dgst.c (1.13.2.2), "Exp", lines: +2 -1 - crypto/sha/sha.h (1.11.2.2), "Exp", lines: +3 -0 - crypto/sha/sha_locl.h (1.16.2.3), "Exp", lines: +4 -0 - crypto/x509/x509_cmp.c (1.22.2.4), "Exp", lines: +7 -1 - crypto/x509/x509_vfy.c (1.56.2.13), "Exp", lines: +1 -1 - ssl/s3_clnt.c (1.53.2.18), "Exp", lines: +2 -0 - ssl/s3_enc.c (1.31.2.9), "Exp", lines: +3 -0 - ssl/s3_srvr.c (1.85.2.23), "Exp", lines: +2 -0 - ssl/t1_enc.c (1.27.2.9), "Exp", lines: +2 -0 - - FIPS algorithm blocking. - - Non FIPS algorithms are not normally allowed in FIPS mode. - - Any attempt to use them via high level functions will - return an error. - - The low level non-FIPS algorithm functions cannot return - errors so they produce assertion failures. HMAC also has to give an - assertion error because it (erroneously) can't return an error - either. - - There are exceptions (such as MD5 in TLS and non - cryptographic use of algorithms) and applications can override the - blocking and use non FIPS algorithms anyway. - - For low level functions the override is perfomed by - prefixing the algorithm initalization function with "private_" for - example private_MD5_Init(). - - For high level functions an override is performed by - setting a flag in the context. - -2005-01-27 02:49 steve - - Changed: - apps/dgst.c (1.23.2.14), "Exp", lines: +9 -5 - crypto/crypto.h (1.62.2.10), "Exp", lines: +3 -0 - crypto/evp/digest.c (1.21.2.8), "Exp", lines: +34 -0 - crypto/hmac/hmac.c (1.12.2.4), "Exp", lines: +9 -0 - - More FIPS algorithm blocking. - - Catch attempted use of non FIPS algorithms with HMAC. - - Give an assertion error for applications that ignore FIPS - digest errors. - - Make -non-fips-allow work with dgst and HMAC. - -2005-01-28 15:03 steve - - Changed: - apps/dgst.c (1.23.2.15), "Exp", lines: +2 -1 - apps/enc.c (1.35.2.13), "Exp", lines: +38 -4 - crypto/evp/e_rc4.c (1.11.2.2), "Exp", lines: +1 -0 - crypto/evp/evp.h (1.86.2.17), "Exp", lines: +3 -0 - crypto/evp/evp_enc.c (1.28.2.12), "Exp", lines: +60 -15 - crypto/evp/evp_locl.h (1.7.2.8), "Exp", lines: +1 -0 - test/testenc (1.3.8.2), "Exp", lines: +8 -8 - - Further FIPS algorithm blocking. - - Fixes to cipher blocking and enabling code. - - Add option -non-fips-allow to 'enc' and update testenc. - -2005-01-31 02:33 steve - - Changed: - ssl/s23_clnt.c (1.20.2.7), "Exp", lines: +16 -0 - ssl/s23_srvr.c (1.41.2.6), "Exp", lines: +9 -0 - ssl/s3_clnt.c (1.53.2.19), "Exp", lines: +0 -8 - ssl/s3_enc.c (1.31.2.10), "Exp", lines: +1 -0 - ssl/s3_srvr.c (1.85.2.24), "Exp", lines: +0 -8 - ssl/ssl.h (1.126.2.21), "Exp", lines: +1 -0 - ssl/ssl_cert.c (1.48.2.10), "Exp", lines: +0 -8 - ssl/ssl_err.c (1.41.2.4), "Exp", lines: +2 -1 - ssl/ssl_lib.c (1.110.2.13), "Exp", lines: +8 -9 - ssl/t1_enc.c (1.27.2.10), "Exp", lines: +0 -18 - - Only allow TLS is FIPS mode. - - Remove old FIPS_allow_md5() calls. - -2005-02-05 19:24 steve - - Changed: - apps/req.c (1.88.2.18), "Exp", lines: +8 -1 - apps/x509.c (1.67.2.20), "Exp", lines: +8 -1 - - In FIPS mode use SHA1 as default digest in x509 and req utilities. - -2005-03-15 10:46 appro - - Changed: - Makefile.org (1.154.2.96), "Exp", lines: +1 -1 - crypto/Makefile (1.1.4.6), "Exp", lines: +2 -3 - fips/Makefile (1.1.4.8), "Exp", lines: +4 -1 - - Real Bourne shell doesn't accept ! as in "if ! grep ..." Fix this - in crypto/Makefile and make Makefile.org and fips/Makefile more - discreet. - -2005-03-22 18:29 steve - - Changed: - fips/fingerprint.sha1 (1.1.2.12), "Exp", lines: +1 -1 - fips/fips.c (1.1.2.10), "Exp", lines: +1 -0 - - Fix memory leak. - -2005-03-27 05:36 steve - - Changed: - crypto/evp/e_null.c (1.9.2.1), "Exp", lines: +1 -1 - ssl/s3_lib.c (1.57.2.13), "Exp", lines: +3 -3 - - Allow 'null' cipher and appropriate Kerberos ciphersuites in FIPS - mode. - -2005-04-14 14:44 steve - - Changed: - fips/fipshashes.sha1 (1.1.2.1), "Exp", lines: +29 -0 - util/checkhash.pl (1.1.2.1), "Exp", lines: +181 -0 - - Perl script that checks or rebuilds FIPS hash files. This works on - both Unix and Windows. - - Merge all FIPS hash files into a single hash file - fips/fips.sha1 - -2005-04-15 05:27 steve - - Changed: - fips/Makefile (1.1.4.9), "Exp", lines: +1 -1 - fips/aes/Makefile (1.1.4.4), "Exp", lines: +1 -4 - fips/des/Makefile (1.1.4.6), "Exp", lines: +1 -4 - fips/dh/Makefile (1.1.2.5), "Exp", lines: +1 -4 - fips/dsa/Makefile (1.1.4.4), "Exp", lines: +1 -4 - fips/rand/Makefile (1.1.4.3), "Exp", lines: +1 -4 - fips/rsa/Makefile (1.1.4.5), "Exp", lines: +1 -4 - fips/sha1/Makefile (1.1.4.9), "Exp", lines: +1 -7 - - Update hash checking in makefiles to use new perl script. - -2005-04-17 06:37 steve - - Changed: - util/checkhash.pl (1.1.2.2), "Exp", lines: +163 -127 - - Modify checkhash.pl so it can be run standalone or included as a - funtion in another perl script. - -2005-04-17 16:00 appro - - Changed: - fips/sha1/Makefile (1.1.4.10), "Exp", lines: +9 -5 - - Bring back fips_standalone_sha1. - -2005-04-17 16:17 appro - - Deleted: - fips/sha1/asm/sx86-elf.s (1.1.4.4) - Changed: - Configure (1.314.2.114), "Exp", lines: +1 -1 - fips/fipshashes.sha1 (1.1.2.2), "Exp", lines: +1 -1 - fips/sha1/Makefile (1.1.4.11), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.13), "Exp", lines: +1 -1 - fips/sha1/asm/fips-sx86-elf.s (1.1.2.1), "Exp", lines: +1568 -0 - - Rename fips/sha1/sx86-elf.s to fips/sha1/fips-sx86-elf.s. - -2005-04-17 16:21 steve - - Changed: - util/checkhash.pl (1.1.2.3), "Exp", lines: +2 -0 - - Return 0 for successful hash check. - -2005-04-17 16:54 appro - - Changed: - Configure (1.314.2.116), "Exp", lines: +8 -1 - Makefile.org (1.154.2.99), "Exp", lines: +3 -2 - crypto/aes/aes_cbc.c (1.1.2.11), "Exp", lines: +2 -0 - fips/fipshashes.sha1 (1.1.2.4), "Exp", lines: +1 -0 - fips/aes/Makefile (1.1.4.5), "Exp", lines: +4 -2 - fips/aes/asm/fips-ax86-elf.s (1.1.2.1), "Exp", lines: +1822 -0 - - Throw in fips/aes/asm/fips-ax86-elf.s. - -2005-04-17 16:35 appro - - Changed: - Configure (1.314.2.115), "Exp", lines: +1 -1 - fips/fipshashes.sha1 (1.1.2.3), "Exp", lines: +1 -1 - fips/des/asm/fips-dx86-elf.s (1.1.4.2), "Exp", lines: +108 -98 - - Regenerate fips/des/asm/fips-dx86-elf.s with -fPIC flag. - -2005-04-17 17:26 appro - - Changed: - crypto/cryptlib.c (1.32.2.18), "Exp", lines: +6 -55 - crypto/crypto.h (1.62.2.11), "Exp", lines: +0 -3 - fips/fips.c (1.1.2.11), "Exp", lines: +62 -8 - fips/fips.h (1.1.2.7), "Exp", lines: +2 -3 - fips/fips_locl.h (1.1.4.3), "Exp", lines: +6 -3 - fips/fipshashes.sha1 (1.1.2.5), "Exp", lines: +4 -4 - fips/rand/fips_rand.c (1.1.2.10), "Exp", lines: +3 -1 - fips/rsa/fips_rsa_gen.c (1.1.4.4), "Exp", lines: +4 -2 - - Resolve minor binary compatibility issues in fips. - -2005-04-17 18:22 appro - - Changed: - fips/fipshashes.sha1 (1.1.2.6), "Exp", lines: +12 -12 - fips/des/fips_des_locl.h (1.1.2.4), "Exp", lines: +1 -1 - fips/des/fips_set_key.c (1.1.4.4), "Exp", lines: +2 -2 - fips/dh/fips_dh_key.c (1.1.2.3), "Exp", lines: +1 -1 - fips/dsa/fips_dsa_ossl.c (1.1.2.7), "Exp", lines: +1 -1 - fips/dsa/fips_dsa_selftest.c (1.1.4.2), "Exp", lines: +3 -3 - fips/rand/fips_rand.c (1.1.2.11), "Exp", lines: +2 -2 - fips/rand/fips_rand.h (1.1.2.5), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_eay.c (1.1.4.4), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_gen.c (1.1.4.5), "Exp", lines: +1 -1 - fips/rsa/fips_rsa_selftest.c (1.1.4.5), "Exp", lines: +11 -11 - fips/sha1/fips_sha1_selftest.c (1.1.4.2), "Exp", lines: +1 -1 - fips/sha1/fips_sha1dgst.c (1.1.2.5), "Exp", lines: +1 -1 - fips/sha1/standalone.sha1 (1.1.2.14), "Exp", lines: +2 -2 - - Minor fips const-ification. - -2005-04-18 07:02 steve - - Changed: - crypto/bf/bf_skey.c (1.6.2.2), "Exp", lines: +1 -0 - crypto/cast/c_skey.c (1.5.6.2), "Exp", lines: +1 -0 - crypto/idea/i_skey.c (1.5.6.2), "Exp", lines: +1 -0 - crypto/rc2/rc2_skey.c (1.4.6.2), "Exp", lines: +1 -0 - crypto/rc4/rc4_skey.c (1.10.8.3), "Exp", lines: +1 -0 - crypto/rc5/rc5_skey.c (1.4.6.2), "Exp", lines: +1 -0 - - Pick up definition of FIPS_mode() in fips.h to avoid warnings. - -2005-04-18 10:34 steve - - Deleted: - fips/fingerprint.sha1 (1.1.2.14) - fips/fips_check_sha1 (1.1.2.8) - fips/fips_make_sha1 (1.1.2.7) - fips/aes/fingerprint.sha1 (1.1.2.7) - fips/des/fingerprint.sha1 (1.1.2.6) - fips/dh/fingerprint.sha1 (1.1.2.4) - fips/dsa/fingerprint.sha1 (1.1.2.7) - fips/rand/fingerprint.sha1 (1.1.2.10) - fips/rsa/fingerprint.sha1 (1.1.4.7) - fips/sha1/fingerprint.sha1 (1.1.2.12) - Changed: - fips/sha1/Makefile (1.1.4.12), "Exp", lines: +1 -4 - - Remove obsolete fingerprint.sha1 files and associated scripts. - Delete test in fips/sha1/Makefile: the top level test checks the - same files. - -2005-04-19 09:11 appro - - Deleted: - fips/fipshashes.sha1 (1.1.2.7) - fips/sha1/standalone.sha1 (1.1.2.15) - Changed: - fips/fipshashes.c (1.1.2.1), "Exp", lines: +32 -0 - util/checkhash.pl (1.1.2.4), "Exp", lines: +7 -4 - - Maintain fingerprint hashes as C source. - -2005-04-19 09:17 appro - - Changed: - util/checkhash.pl (1.1.2.5), "Exp", lines: +1 -1 - - Complete the transition C-code hashes. - -2005-04-21 19:06 steve - - Changed: - apps/openssl.c (1.48.2.13), "Exp", lines: +0 -2 - fips/fips.c (1.1.2.12), "Exp", lines: +0 -27 - fips/fips.h (1.1.2.8), "Exp", lines: +0 -2 - fips/fipshashes.c (1.1.2.2), "Exp", lines: +2 -2 - - Remove defunct FIPS_allow_md5() and related functions. - -2005-04-22 06:15 appro - - Changed: - fips/fips.c (1.1.2.13), "Exp", lines: +3 -3 - fips/fips_err.h (1.1.4.4), "Exp", lines: +3 -3 - fips/fipshashes.c (1.1.2.4), "Exp", lines: +2 -2 - - Move some variables to .bss. - diff --git a/sys/src/ape/lib/openssl/doc/HOWTO/certificates.txt b/sys/src/ape/lib/openssl/doc/HOWTO/certificates.txt deleted file mode 100644 index a8a34c7ab..000000000 --- a/sys/src/ape/lib/openssl/doc/HOWTO/certificates.txt +++ /dev/null @@ -1,105 +0,0 @@ -<DRAFT!> - HOWTO certificates - -1. Introduction - -How you handle certificates depend a great deal on what your role is. -Your role can be one or several of: - - - User of some client software - - User of some server software - - Certificate authority - -This file is for users who wish to get a certificate of their own. -Certificate authorities should read ca.txt. - -In all the cases shown below, the standard configuration file, as -compiled into openssl, will be used. You may find it in /etc/, -/usr/local/ssl/ or somewhere else. The name is openssl.cnf, and -is better described in another HOWTO <config.txt?>. If you want to -use a different configuration file, use the argument '-config {file}' -with the command shown below. - - -2. Relationship with keys - -Certificates are related to public key cryptography by containing a -public key. To be useful, there must be a corresponding private key -somewhere. With OpenSSL, public keys are easily derived from private -keys, so before you create a certificate or a certificate request, you -need to create a private key. - -Private keys are generated with 'openssl genrsa' if you want a RSA -private key, or 'openssl gendsa' if you want a DSA private key. -Further information on how to create private keys can be found in -another HOWTO <keys.txt?>. The rest of this text assumes you have -a private key in the file privkey.pem. - - -3. Creating a certificate request - -To create a certificate, you need to start with a certificate -request (or, as some certificate authorities like to put -it, "certificate signing request", since that's exactly what they do, -they sign it and give you the result back, thus making it authentic -according to their policies). A certificate request can then be sent -to a certificate authority to get it signed into a certificate, or if -you have your own certificate authority, you may sign it yourself, or -if you need a self-signed certificate (because you just want a test -certificate or because you are setting up your own CA). - -The certificate request is created like this: - - openssl req -new -key privkey.pem -out cert.csr - -Now, cert.csr can be sent to the certificate authority, if they can -handle files in PEM format. If not, use the extra argument '-outform' -followed by the keyword for the format to use (see another HOWTO -<formats.txt?>). In some cases, that isn't sufficient and you will -have to be more creative. - -When the certificate authority has then done the checks the need to -do (and probably gotten payment from you), they will hand over your -new certificate to you. - -Section 5 will tell you more on how to handle the certificate you -received. - - -4. Creating a self-signed test certificate - -If you don't want to deal with another certificate authority, or just -want to create a test certificate for yourself. This is similar to -creating a certificate request, but creates a certificate instead of -a certificate request. This is NOT the recommended way to create a -CA certificate, see ca.txt. - - openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 - - -5. What to do with the certificate - -If you created everything yourself, or if the certificate authority -was kind enough, your certificate is a raw DER thing in PEM format. -Your key most definitely is if you have followed the examples above. -However, some (most?) certificate authorities will encode them with -things like PKCS7 or PKCS12, or something else. Depending on your -applications, this may be perfectly OK, it all depends on what they -know how to decode. If not, There are a number of OpenSSL tools to -convert between some (most?) formats. - -So, depending on your application, you may have to convert your -certificate and your key to various formats, most often also putting -them together into one file. The ways to do this is described in -another HOWTO <formats.txt?>, I will just mention the simplest case. -In the case of a raw DER thing in PEM format, and assuming that's all -right for yor applications, simply concatenating the certificate and -the key into a new file and using that one should be enough. With -some applications, you don't even have to do that. - - -By now, you have your cetificate and your private key and can start -using the software that depend on it. - --- -Richard Levitte diff --git a/sys/src/ape/lib/openssl/doc/HOWTO/keys.txt b/sys/src/ape/lib/openssl/doc/HOWTO/keys.txt deleted file mode 100644 index 7ae2a3a11..000000000 --- a/sys/src/ape/lib/openssl/doc/HOWTO/keys.txt +++ /dev/null @@ -1,73 +0,0 @@ -<DRAFT!> - HOWTO keys - -1. Introduction - -Keys are the basis of public key algorithms and PKI. Keys usually -come in pairs, with one half being the public key and the other half -being the private key. With OpenSSL, the private key contains the -public key information as well, so a public key doesn't need to be -generated separately. - -Public keys come in several flavors, using different cryptographic -algorithms. The most popular ones associated with certificates are -RSA and DSA, and this HOWTO will show how to generate each of them. - - -2. To generate a RSA key - -A RSA key can be used both for encryption and for signing. - -Generating a key for the RSA algorithm is quite easy, all you have to -do is the following: - - openssl genrsa -des3 -out privkey.pem 2048 - -With this variant, you will be prompted for a protecting password. If -you don't want your key to be protected by a password, remove the flag -'-des3' from the command line above. - - NOTE: if you intend to use the key together with a server - certificate, it may be a good thing to avoid protecting it - with a password, since that would mean someone would have to - type in the password every time the server needs to access - the key. - -The number 2048 is the size of the key, in bits. Today, 2048 or -higher is recommended for RSA keys, as fewer amount of bits is -consider insecure or to be insecure pretty soon. - - -3. To generate a DSA key - -A DSA key can be used for signing only. This is important to keep -in mind to know what kind of purposes a certificate request with a -DSA key can really be used for. - -Generating a key for the DSA algorithm is a two-step process. First, -you have to generate parameters from which to generate the key: - - openssl dsaparam -out dsaparam.pem 2048 - -The number 2048 is the size of the key, in bits. Today, 2048 or -higher is recommended for DSA keys, as fewer amount of bits is -consider insecure or to be insecure pretty soon. - -When that is done, you can generate a key using the parameters in -question (actually, several keys can be generated from the same -parameters): - - openssl gendsa -des3 -out privkey.pem dsaparam.pem - -With this variant, you will be prompted for a protecting password. If -you don't want your key to be protected by a password, remove the flag -'-des3' from the command line above. - - NOTE: if you intend to use the key together with a server - certificate, it may be a good thing to avoid protecting it - with a password, since that would mean someone would have to - type in the password every time the server needs to access - the key. - --- -Richard Levitte diff --git a/sys/src/ape/lib/openssl/doc/HOWTO/proxy_certificates.txt b/sys/src/ape/lib/openssl/doc/HOWTO/proxy_certificates.txt deleted file mode 100644 index 3d36b02f6..000000000 --- a/sys/src/ape/lib/openssl/doc/HOWTO/proxy_certificates.txt +++ /dev/null @@ -1,322 +0,0 @@ -<DRAFT!> - HOWTO proxy certificates - -0. WARNING - -NONE OF THE CODE PRESENTED HERE HAVE BEEN CHECKED! They are just an -example to show you how things can be done. There may be typos or -type conflicts, and you will have to resolve them. - -1. Introduction - -Proxy certificates are defined in RFC 3820. They are really usual -certificates with the mandatory extension proxyCertInfo. - -Proxy certificates are issued by an End Entity (typically a user), -either directly with the EE certificate as issuing certificate, or by -extension through an already issued proxy certificate.. They are used -to extend rights to some other entity (a computer process, typically, -or sometimes to the user itself), so it can perform operations in the -name of the owner of the EE certificate. - -See http://www.ietf.org/rfc/rfc3820.txt for more information. - - -2. A warning about proxy certificates - -Noone seems to have tested proxy certificates with security in mind. -Basically, to this date, it seems that proxy certificates have only -been used in a world that's highly aware of them. What would happen -if an unsuspecting application is to validate a chain of certificates -that contains proxy certificates? It would usually consider the leaf -to be the certificate to check for authorisation data, and since proxy -certificates are controlled by the EE certificate owner alone, it's -would be normal to consider what the EE certificate owner could do -with them. - -subjectAltName and issuerAltName are forbidden in proxy certificates, -and this is enforced in OpenSSL. The subject must be the same as the -issuer, with one commonName added on. - -Possible threats are, as far as has been imagined so far: - - - impersonation through commonName (think server certificates). - - use of additional extensions, possibly non-standard ones used in - certain environments, that would grant extra or different - authorisation rights. - -For this reason, OpenSSL requires that the use of proxy certificates -be explicitely allowed. Currently, this can be done using the -following methods: - - - if the application calls X509_verify_cert() itself, it can do the - following prior to that call (ctx is the pointer passed in the call - to X509_verify_cert()): - - X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS); - - - in all other cases, proxy certificate validation can be enabled - before starting the application by setting the envirnoment variable - OPENSSL_ALLOW_PROXY with some non-empty value. - -There are thoughts to allow proxy certificates with a line in the -default openssl.cnf, but that's still in the future. - - -3. How to create proxy cerificates - -It's quite easy to create proxy certificates, by taking advantage of -the lack of checks of the 'openssl x509' application (*ahem*). But -first, you need to create a configuration section that contains a -definition of the proxyCertInfo extension, a little like this: - - [ v3_proxy ] - # A proxy certificate MUST NEVER be a CA certificate. - basicConstraints=CA:FALSE - - # Usual authority key ID - authorityKeyIdentifier=keyid,issuer:always - - # Now, for the extension that marks this certificate as a proxy one - proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:1,policy:text:AB - -It's also possible to give the proxy extension in a separate section: - - proxyCertInfo=critical,@proxy_ext - - [ proxy_ext ] - language=id-ppl-anyLanguage - pathlen=0 - policy=text:BC - -The policy value has a specific syntax, {syntag}:{string}, where the -syntag determines what will be done with the string. The recognised -syntags are as follows: - - text indicates that the string is simply the bytes, not - encoded in any kind of way: - - policy=text:räksmörgås - - Previous versions of this design had a specific tag - for UTF-8 text. However, since the bytes are copied - as-is anyway, there's no need for it. Instead, use - the text: tag, like this: - - policy=text:räksmörgÃ¥s - - hex indicates the string is encoded in hex, with colons - between each byte (every second hex digit): - - policy=hex:72:E4:6B:73:6D:F6:72:67:E5:73 - - Previous versions of this design had a tag to insert a - complete DER blob. However, the only legal use for - this would be to surround the bytes that would go with - the hex: tag with what's needed to construct a correct - OCTET STRING. Since hex: does that, the DER tag felt - superfluous, and was therefore removed. - - file indicates that the text of the policy should really be - taken from a file. The string is then really a file - name. This is useful for policies that are large - (more than a few of lines) XML documents, for example. - -The 'policy' setting can be split up in multiple lines like this: - - 0.policy=This is - 1.polisy= a multi- - 2.policy=line policy. - -NOTE: the proxy policy value is the part that determines the rights -granted to the process using the proxy certificate. The value is -completely dependent on the application reading and interpretting it! - -Now that you have created an extension section for your proxy -certificate, you can now easily create a proxy certificate like this: - - openssl req -new -config openssl.cnf \ - -out proxy.req -keyout proxy.key - openssl x509 -req -CAcreateserial -in proxy.req -days 7 \ - -out proxy.crt -CA user.crt -CAkey user.key \ - -extfile openssl.cnf -extensions v3_proxy - -It's just as easy to create a proxy certificate using another proxy -certificate as issuer (note that I'm using a different configuration -section for it): - - openssl req -new -config openssl.cnf \ - -out proxy2.req -keyout proxy2.key - openssl x509 -req -CAcreateserial -in proxy2.req -days 7 \ - -out proxy2.crt -CA proxy.crt -CAkey proxy.key \ - -extfile openssl.cnf -extensions v3_proxy2 - - -4. How to have your application interpret the policy? - -The basic way to interpret proxy policies is to prepare some default -rights, then do a check of the proxy certificate against the a chain -of proxy certificates, user certificate and CA certificates, and see -what rights came out by the end. Sounds easy, huh? It almost is. - -The slightly complicated part is how to pass data between your -application and the certificate validation procedure. - -You need the following ingredients: - - - a callback routing that will be called for every certificate that's - validated. It will be called several times for each certificates, - so you must be attentive to when it's a good time to do the proxy - policy interpretation and check, as well as to fill in the defaults - when the EE certificate is checked. - - - a structure of data that's shared between your application code and - the callback. - - - a wrapper function that sets it all up. - - - an ex_data index function that creates an index into the generic - ex_data store that's attached to an X509 validation context. - -This is some cookbook code for you to fill in: - - /* In this example, I will use a view of granted rights as a bit - array, one bit for each possible right. */ - typedef struct your_rights { - unsigned char rights[total_rights / 8]; - } YOUR_RIGHTS; - - /* The following procedure will create an index for the ex_data - store in the X509 validation context the first time it's called. - Subsequent calls will return the same index. */ - static int get_proxy_auth_ex_data_idx(void) - { - static volatile int idx = -1; - if (idx < 0) - { - CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); - if (idx < 0) - { - idx = X509_STORE_CTX_get_ex_new_index(0, - "for verify callback", - NULL,NULL,NULL); - } - CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); - } - return idx; - } - - /* Callback to be given to the X509 validation procedure. */ - static int verify_callback(int ok, X509_STORE_CTX *ctx) - { - if (ok == 1) /* It's REALLY important you keep the proxy policy - check within this secion. It's important to know - that when ok is 1, the certificates are checked - from top to bottom. You get the CA root first, - followed by the possible chain of intermediate - CAs, followed by the EE certificate, followed by - the possible proxy certificates. */ - { - X509 *xs = ctx->current_cert; - - if (xs->ex_flags & EXFLAG_PROXY) - { - YOUR_RIGHTS *rights = - (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx, - get_proxy_auth_ex_data_idx()); - PROXY_CERT_INFO_EXTENSION *pci = - X509_get_ext_d2i(xs, NID_proxyCertInfo, NULL, NULL); - - switch (OBJ_obj2nid(pci->proxyPolicy->policyLanguage)) - { - case NID_Independent: - /* Do whatever you need to grant explicit rights to - this particular proxy certificate, usually by - pulling them from some database. If there are none - to be found, clear all rights (making this and any - subsequent proxy certificate void of any rights). - */ - memset(rights->rights, 0, sizeof(rights->rights)); - break; - case NID_id_ppl_inheritAll: - /* This is basically a NOP, we simply let the current - rights stand as they are. */ - break; - default: - /* This is usually the most complex section of code. - You really do whatever you want as long as you - follow RFC 3820. In the example we use here, the - simplest thing to do is to build another, temporary - bit array and fill it with the rights granted by - the current proxy certificate, then use it as a - mask on the accumulated rights bit array, and - voilà, you now have a new accumulated rights bit - array. */ - { - int i; - YOUR_RIGHTS tmp_rights; - memset(tmp_rights.rights, 0, sizeof(tmp_rights.rights)); - - /* process_rights() is supposed to be a procedure - that takes a string and it's length, interprets - it and sets the bits in the YOUR_RIGHTS pointed - at by the third argument. */ - process_rights((char *) pci->proxyPolicy->policy->data, - pci->proxyPolicy->policy->length, - &tmp_rights); - - for(i = 0; i < total_rights / 8; i++) - rights->rights[i] &= tmp_rights.rights[i]; - } - break; - } - PROXY_CERT_INFO_EXTENSION_free(pci); - } - else if (!(xs->ex_flags & EXFLAG_CA)) - { - /* We have a EE certificate, let's use it to set default! - */ - YOUR_RIGHTS *rights = - (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx, - get_proxy_auth_ex_data_idx()); - - /* The following procedure finds out what rights the owner - of the current certificate has, and sets them in the - YOUR_RIGHTS structure pointed at by the second - argument. */ - set_default_rights(xs, rights); - } - } - return ok; - } - - static int my_X509_verify_cert(X509_STORE_CTX *ctx, - YOUR_RIGHTS *needed_rights) - { - int i; - int (*save_verify_cb)(int ok,X509_STORE_CTX *ctx) = ctx->verify_cb; - YOUR_RIGHTS rights; - - X509_STORE_CTX_set_verify_cb(ctx, verify_callback); - X509_STORE_CTX_set_ex_data(ctx, get_proxy_auth_ex_data_idx(), &rights); - X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS); - ok = X509_verify_cert(ctx); - - if (ok == 1) - { - ok = check_needed_rights(rights, needed_rights); - } - - X509_STORE_CTX_set_verify_cb(ctx, save_verify_cb); - - return ok; - } - -If you use SSL or TLS, you can easily set up a callback to have the -certificates checked properly, using the code above: - - SSL_CTX_set_cert_verify_callback(s_ctx, my_X509_verify_cert, &needed_rights); - - --- -Richard Levitte diff --git a/sys/src/ape/lib/openssl/doc/README b/sys/src/ape/lib/openssl/doc/README deleted file mode 100644 index 6ecc14d99..000000000 --- a/sys/src/ape/lib/openssl/doc/README +++ /dev/null @@ -1,12 +0,0 @@ - - apps/openssl.pod .... Documentation of OpenSSL `openssl' command - crypto/crypto.pod ... Documentation of OpenSSL crypto.h+libcrypto.a - ssl/ssl.pod ......... Documentation of OpenSSL ssl.h+libssl.a - openssl.txt ......... Assembled documentation files for OpenSSL [not final] - ssleay.txt .......... Assembled documentation of ancestor SSLeay [obsolete] - standards.txt ....... Assembled pointers to standards, RFCs or internet drafts - that are related to OpenSSL. - - An archive of HTML documents for the SSLeay library is available from - http://www.columbia.edu/~ariel/ssleay/ - diff --git a/sys/src/ape/lib/openssl/doc/apps/CA.pl.pod b/sys/src/ape/lib/openssl/doc/apps/CA.pl.pod deleted file mode 100644 index ed69952f3..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/CA.pl.pod +++ /dev/null @@ -1,179 +0,0 @@ - -=pod - -=head1 NAME - -CA.pl - friendlier interface for OpenSSL certificate programs - -=head1 SYNOPSIS - -B<CA.pl> -[B<-?>] -[B<-h>] -[B<-help>] -[B<-newcert>] -[B<-newreq>] -[B<-newreq-nodes>] -[B<-newca>] -[B<-xsign>] -[B<-sign>] -[B<-signreq>] -[B<-signcert>] -[B<-verify>] -[B<files>] - -=head1 DESCRIPTION - -The B<CA.pl> script is a perl script that supplies the relevant command line -arguments to the B<openssl> command for some common certificate operations. -It is intended to simplify the process of certificate creation and management -by the use of some simple options. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<?>, B<-h>, B<-help> - -prints a usage message. - -=item B<-newcert> - -creates a new self signed certificate. The private key and certificate are -written to the file "newreq.pem". - -=item B<-newreq> - -creates a new certificate request. The private key and request are -written to the file "newreq.pem". - -=item B<-newreq-nodes> - -is like B<-newreq> except that the private key will not be encrypted. - -=item B<-newca> - -creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert> -and B<-xsign> options). The user is prompted to enter the filename of the CA -certificates (which should also contain the private key) or by hitting ENTER -details of the CA will be prompted for. The relevant files and directories -are created in a directory called "demoCA" in the current directory. - -=item B<-pkcs12> - -create a PKCS#12 file containing the user certificate, private key and CA -certificate. It expects the user certificate and private key to be in the -file "newcert.pem" and the CA certificate to be in the file demoCA/cacert.pem, -it creates a file "newcert.p12". This command can thus be called after the -B<-sign> option. The PKCS#12 file can be imported directly into a browser. -If there is an additional argument on the command line it will be used as the -"friendly name" for the certificate (which is typically displayed in the browser -list box), otherwise the name "My Certificate" is used. - -=item B<-sign>, B<-signreq>, B<-xsign> - -calls the B<ca> program to sign a certificate request. It expects the request -to be in the file "newreq.pem". The new certificate is written to the file -"newcert.pem" except in the case of the B<-xsign> option when it is written -to standard output. - - -=item B<-signCA> - -this option is the same as the B<-signreq> option except it uses the configuration -file section B<v3_ca> and so makes the signed request a valid CA certificate. This -is useful when creating intermediate CA from a root CA. - -=item B<-signcert> - -this option is the same as B<-sign> except it expects a self signed certificate -to be present in the file "newreq.pem". - -=item B<-verify> - -verifies certificates against the CA certificate for "demoCA". If no certificates -are specified on the command line it tries to verify the file "newcert.pem". - -=item B<files> - -one or more optional certificate file names for use with the B<-verify> command. - -=back - -=head1 EXAMPLES - -Create a CA hierarchy: - - CA.pl -newca - -Complete certificate creation example: create a CA, create a request, sign -the request and finally create a PKCS#12 file containing it. - - CA.pl -newca - CA.pl -newreq - CA.pl -signreq - CA.pl -pkcs12 "My Test Certificate" - -=head1 DSA CERTIFICATES - -Although the B<CA.pl> creates RSA CAs and requests it is still possible to -use it with DSA certificates and requests using the L<req(1)|req(1)> command -directly. The following example shows the steps that would typically be taken. - -Create some DSA parameters: - - openssl dsaparam -out dsap.pem 1024 - -Create a DSA CA certificate and private key: - - openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem - -Create the CA directories and files: - - CA.pl -newca - -enter cacert.pem when prompted for the CA file name. - -Create a DSA certificate request and private key (a different set of parameters -can optionally be created first): - - openssl req -out newreq.pem -newkey dsa:dsap.pem - -Sign the request: - - CA.pl -signreq - -=head1 NOTES - -Most of the filenames mentioned can be modified by editing the B<CA.pl> script. - -If the demoCA directory already exists then the B<-newca> command will not -overwrite it and will do nothing. This can happen if a previous call using -the B<-newca> option terminated abnormally. To get the correct behaviour -delete the demoCA directory if it already exists. - -Under some environments it may not be possible to run the B<CA.pl> script -directly (for example Win32) and the default configuration file location may -be wrong. In this case the command: - - perl -S CA.pl - -can be used and the B<OPENSSL_CONF> environment variable changed to point to -the correct path of the configuration file "openssl.cnf". - -The script is intended as a simple front end for the B<openssl> program for use -by a beginner. Its behaviour isn't always what is wanted. For more control over the -behaviour of the certificate commands call the B<openssl> command directly. - -=head1 ENVIRONMENT VARIABLES - -The variable B<OPENSSL_CONF> if defined allows an alternative configuration -file location to be specified, it should contain the full path to the -configuration file, not just its directory. - -=head1 SEE ALSO - -L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<req(1)|req(1)>, L<pkcs12(1)|pkcs12(1)>, -L<config(5)|config(5)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/asn1parse.pod b/sys/src/ape/lib/openssl/doc/apps/asn1parse.pod deleted file mode 100644 index 542d96906..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/asn1parse.pod +++ /dev/null @@ -1,171 +0,0 @@ -=pod - -=head1 NAME - -asn1parse - ASN.1 parsing tool - -=head1 SYNOPSIS - -B<openssl> B<asn1parse> -[B<-inform PEM|DER>] -[B<-in filename>] -[B<-out filename>] -[B<-noout>] -[B<-offset number>] -[B<-length number>] -[B<-i>] -[B<-oid filename>] -[B<-strparse offset>] -[B<-genstr string>] -[B<-genconf file>] - -=head1 DESCRIPTION - -The B<asn1parse> command is a diagnostic utility that can parse ASN.1 -structures. It can also be used to extract data from ASN.1 formatted data. - -=head1 OPTIONS - -=over 4 - -=item B<-inform> B<DER|PEM> - -the input format. B<DER> is binary format and B<PEM> (the default) is base64 -encoded. - -=item B<-in filename> - -the input file, default is standard input - -=item B<-out filename> - -output file to place the DER encoded data into. If this -option is not present then no data will be output. This is most useful when -combined with the B<-strparse> option. - -=item B<-noout> - -don't output the parsed version of the input file. - -=item B<-offset number> - -starting offset to begin parsing, default is start of file. - -=item B<-length number> - -number of bytes to parse, default is until end of file. - -=item B<-i> - -indents the output according to the "depth" of the structures. - -=item B<-oid filename> - -a file containing additional OBJECT IDENTIFIERs (OIDs). The format of this -file is described in the NOTES section below. - -=item B<-strparse offset> - -parse the contents octets of the ASN.1 object starting at B<offset>. This -option can be used multiple times to "drill down" into a nested structure. - -=item B<-genstr string>, B<-genconf file> - -generate encoded data based on B<string>, B<file> or both using -ASN1_generate_nconf() format. If B<file> only is present then the string -is obtained from the default section using the name B<asn1>. The encoded -data is passed through the ASN1 parser and printed out as though it came -from a file, the contents can thus be examined and written to a file -using the B<out> option. - -=back - -=head2 OUTPUT - -The output will typically contain lines like this: - - 0:d=0 hl=4 l= 681 cons: SEQUENCE - -..... - - 229:d=3 hl=3 l= 141 prim: BIT STRING - 373:d=2 hl=3 l= 162 cons: cont [ 3 ] - 376:d=3 hl=3 l= 159 cons: SEQUENCE - 379:d=4 hl=2 l= 29 cons: SEQUENCE - 381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier - 386:d=5 hl=2 l= 22 prim: OCTET STRING - 410:d=4 hl=2 l= 112 cons: SEQUENCE - 412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier - 417:d=5 hl=2 l= 105 prim: OCTET STRING - 524:d=4 hl=2 l= 12 cons: SEQUENCE - -..... - -This example is part of a self signed certificate. Each line starts with the -offset in decimal. B<d=XX> specifies the current depth. The depth is increased -within the scope of any SET or SEQUENCE. B<hl=XX> gives the header length -(tag and length octets) of the current type. B<l=XX> gives the length of -the contents octets. - -The B<-i> option can be used to make the output more readable. - -Some knowledge of the ASN.1 structure is needed to interpret the output. - -In this example the BIT STRING at offset 229 is the certificate public key. -The contents octets of this will contain the public key information. This can -be examined using the option B<-strparse 229> to yield: - - 0:d=0 hl=3 l= 137 cons: SEQUENCE - 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897 - 135:d=1 hl=2 l= 3 prim: INTEGER :010001 - -=head1 NOTES - -If an OID is not part of OpenSSL's internal table it will be represented in -numerical form (for example 1.2.3.4). The file passed to the B<-oid> option -allows additional OIDs to be included. Each line consists of three columns, -the first column is the OID in numerical format and should be followed by white -space. The second column is the "short name" which is a single word followed -by white space. The final column is the rest of the line and is the -"long name". B<asn1parse> displays the long name. Example: - -C<1.2.3.4 shortName A long name> - -=head1 EXAMPLES - -Parse a file: - - openssl asn1parse -in file.pem - -Parse a DER file: - - openssl asn1parse -inform DER -in file.der - -Generate a simple UTF8String: - - openssl asn1parse -genstr 'UTF8:Hello World' - -Generate and write out a UTF8String, don't print parsed output: - - openssl asn1parse -genstr 'UTF8:Hello World' -noout -out utf8.der - -Generate using a config file: - - openssl asn1parse -genconf asn1.cnf -noout -out asn1.der - -Example config file: - - asn1=SEQUENCE:seq_sect - - [seq_sect] - - field1=BOOL:TRUE - field2=EXP:0, UTF8:some random string - - -=head1 BUGS - -There should be options to change the format of output lines. The output of some -ASN.1 types is not well handled (if at all). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/ca.pod b/sys/src/ape/lib/openssl/doc/apps/ca.pod deleted file mode 100644 index 5618c2dc9..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/ca.pod +++ /dev/null @@ -1,671 +0,0 @@ - -=pod - -=head1 NAME - -ca - sample minimal CA application - -=head1 SYNOPSIS - -B<openssl> B<ca> -[B<-verbose>] -[B<-config filename>] -[B<-name section>] -[B<-gencrl>] -[B<-revoke file>] -[B<-crl_reason reason>] -[B<-crl_hold instruction>] -[B<-crl_compromise time>] -[B<-crl_CA_compromise time>] -[B<-crldays days>] -[B<-crlhours hours>] -[B<-crlexts section>] -[B<-startdate date>] -[B<-enddate date>] -[B<-days arg>] -[B<-md arg>] -[B<-policy arg>] -[B<-keyfile arg>] -[B<-key arg>] -[B<-passin arg>] -[B<-cert file>] -[B<-selfsign>] -[B<-in file>] -[B<-out file>] -[B<-notext>] -[B<-outdir dir>] -[B<-infiles>] -[B<-spkac file>] -[B<-ss_cert file>] -[B<-preserveDN>] -[B<-noemailDN>] -[B<-batch>] -[B<-msie_hack>] -[B<-extensions section>] -[B<-extfile section>] -[B<-engine id>] -[B<-subj arg>] -[B<-utf8>] -[B<-multivalue-rdn>] - -=head1 DESCRIPTION - -The B<ca> command is a minimal CA application. It can be used -to sign certificate requests in a variety of forms and generate -CRLs it also maintains a text database of issued certificates -and their status. - -The options descriptions will be divided into each purpose. - -=head1 CA OPTIONS - -=over 4 - -=item B<-config filename> - -specifies the configuration file to use. - -=item B<-name section> - -specifies the configuration file section to use (overrides -B<default_ca> in the B<ca> section). - -=item B<-in filename> - -an input filename containing a single certificate request to be -signed by the CA. - -=item B<-ss_cert filename> - -a single self signed certificate to be signed by the CA. - -=item B<-spkac filename> - -a file containing a single Netscape signed public key and challenge -and additional field values to be signed by the CA. See the B<SPKAC FORMAT> -section for information on the required format. - -=item B<-infiles> - -if present this should be the last option, all subsequent arguments -are assumed to the the names of files containing certificate requests. - -=item B<-out filename> - -the output file to output certificates to. The default is standard -output. The certificate details will also be printed out to this -file. - -=item B<-outdir directory> - -the directory to output certificates to. The certificate will be -written to a filename consisting of the serial number in hex with -".pem" appended. - -=item B<-cert> - -the CA certificate file. - -=item B<-keyfile filename> - -the private key to sign requests with. - -=item B<-key password> - -the password used to encrypt the private key. Since on some -systems the command line arguments are visible (e.g. Unix with -the 'ps' utility) this option should be used with caution. - -=item B<-selfsign> - -indicates the issued certificates are to be signed with the key -the certificate requests were signed with (given with B<-keyfile>). -Cerificate requests signed with a different key are ignored. If -B<-spkac>, B<-ss_cert> or B<-gencrl> are given, B<-selfsign> is -ignored. - -A consequence of using B<-selfsign> is that the self-signed -certificate appears among the entries in the certificate database -(see the configuration option B<database>), and uses the same -serial number counter as all other certificates sign with the -self-signed certificate. - -=item B<-passin arg> - -the key password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-verbose> - -this prints extra details about the operations being performed. - -=item B<-notext> - -don't output the text form of a certificate to the output file. - -=item B<-startdate date> - -this allows the start date to be explicitly set. The format of the -date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure). - -=item B<-enddate date> - -this allows the expiry date to be explicitly set. The format of the -date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure). - -=item B<-days arg> - -the number of days to certify the certificate for. - -=item B<-md alg> - -the message digest to use. Possible values include md5, sha1 and mdc2. -This option also applies to CRLs. - -=item B<-policy arg> - -this option defines the CA "policy" to use. This is a section in -the configuration file which decides which fields should be mandatory -or match the CA certificate. Check out the B<POLICY FORMAT> section -for more information. - -=item B<-msie_hack> - -this is a legacy option to make B<ca> work with very old versions of -the IE certificate enrollment control "certenr3". It used UniversalStrings -for almost everything. Since the old control has various security bugs -its use is strongly discouraged. The newer control "Xenroll" does not -need this option. - -=item B<-preserveDN> - -Normally the DN order of a certificate is the same as the order of the -fields in the relevant policy section. When this option is set the order -is the same as the request. This is largely for compatibility with the -older IE enrollment control which would only accept certificates if their -DNs match the order of the request. This is not needed for Xenroll. - -=item B<-noemailDN> - -The DN of a certificate can contain the EMAIL field if present in the -request DN, however it is good policy just having the e-mail set into -the altName extension of the certificate. When this option is set the -EMAIL field is removed from the certificate' subject and set only in -the, eventually present, extensions. The B<email_in_dn> keyword can be -used in the configuration file to enable this behaviour. - -=item B<-batch> - -this sets the batch mode. In this mode no questions will be asked -and all certificates will be certified automatically. - -=item B<-extensions section> - -the section of the configuration file containing certificate extensions -to be added when a certificate is issued (defaults to B<x509_extensions> -unless the B<-extfile> option is used). If no extension section is -present then, a V1 certificate is created. If the extension section -is present (even if it is empty), then a V3 certificate is created. - -=item B<-extfile file> - -an additional configuration file to read certificate extensions from -(using the default section unless the B<-extensions> option is also -used). - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<-subj arg> - -supersedes subject name given in the request. -The arg must be formatted as I</type0=value0/type1=value1/type2=...>, -characters may be escaped by \ (backslash), no spaces are skipped. - -=item B<-utf8> - -this option causes field values to be interpreted as UTF8 strings, by -default they are interpreted as ASCII. This means that the field -values, whether prompted from a terminal or obtained from a -configuration file, must be valid UTF8 strings. - -=item B<-multivalue-rdn> - -this option causes the -subj argument to be interpretedt with full -support for multivalued RDNs. Example: - -I</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe> - -If -multi-rdn is not used then the UID value is I<123456+CN=John Doe>. - -=back - -=head1 CRL OPTIONS - -=over 4 - -=item B<-gencrl> - -this option generates a CRL based on information in the index file. - -=item B<-crldays num> - -the number of days before the next CRL is due. That is the days from -now to place in the CRL nextUpdate field. - -=item B<-crlhours num> - -the number of hours before the next CRL is due. - -=item B<-revoke filename> - -a filename containing a certificate to revoke. - -=item B<-crl_reason reason> - -revocation reason, where B<reason> is one of: B<unspecified>, B<keyCompromise>, -B<CACompromise>, B<affiliationChanged>, B<superseded>, B<cessationOfOperation>, -B<certificateHold> or B<removeFromCRL>. The matching of B<reason> is case -insensitive. Setting any revocation reason will make the CRL v2. - -In practive B<removeFromCRL> is not particularly useful because it is only used -in delta CRLs which are not currently implemented. - -=item B<-crl_hold instruction> - -This sets the CRL revocation reason code to B<certificateHold> and the hold -instruction to B<instruction> which must be an OID. Although any OID can be -used only B<holdInstructionNone> (the use of which is discouraged by RFC2459) -B<holdInstructionCallIssuer> or B<holdInstructionReject> will normally be used. - -=item B<-crl_compromise time> - -This sets the revocation reason to B<keyCompromise> and the compromise time to -B<time>. B<time> should be in GeneralizedTime format that is B<YYYYMMDDHHMMSSZ>. - -=item B<-crl_CA_compromise time> - -This is the same as B<crl_compromise> except the revocation reason is set to -B<CACompromise>. - -=item B<-crlexts section> - -the section of the configuration file containing CRL extensions to -include. If no CRL extension section is present then a V1 CRL is -created, if the CRL extension section is present (even if it is -empty) then a V2 CRL is created. The CRL extensions specified are -CRL extensions and B<not> CRL entry extensions. It should be noted -that some software (for example Netscape) can't handle V2 CRLs. - -=back - -=head1 CONFIGURATION FILE OPTIONS - -The section of the configuration file containing options for B<ca> -is found as follows: If the B<-name> command line option is used, -then it names the section to be used. Otherwise the section to -be used must be named in the B<default_ca> option of the B<ca> section -of the configuration file (or in the default section of the -configuration file). Besides B<default_ca>, the following options are -read directly from the B<ca> section: - RANDFILE - preserve - msie_hack -With the exception of B<RANDFILE>, this is probably a bug and may -change in future releases. - -Many of the configuration file options are identical to command line -options. Where the option is present in the configuration file -and the command line the command line value is used. Where an -option is described as mandatory then it must be present in -the configuration file or the command line equivalent (if -any) used. - -=over 4 - -=item B<oid_file> - -This specifies a file containing additional B<OBJECT IDENTIFIERS>. -Each line of the file should consist of the numerical form of the -object identifier followed by white space then the short name followed -by white space and finally the long name. - -=item B<oid_section> - -This specifies a section in the configuration file containing extra -object identifiers. Each line should consist of the short name of the -object identifier followed by B<=> and the numerical form. The short -and long names are the same when this option is used. - -=item B<new_certs_dir> - -the same as the B<-outdir> command line option. It specifies -the directory where new certificates will be placed. Mandatory. - -=item B<certificate> - -the same as B<-cert>. It gives the file containing the CA -certificate. Mandatory. - -=item B<private_key> - -same as the B<-keyfile> option. The file containing the -CA private key. Mandatory. - -=item B<RANDFILE> - -a file used to read and write random number seed information, or -an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). - -=item B<default_days> - -the same as the B<-days> option. The number of days to certify -a certificate for. - -=item B<default_startdate> - -the same as the B<-startdate> option. The start date to certify -a certificate for. If not set the current time is used. - -=item B<default_enddate> - -the same as the B<-enddate> option. Either this option or -B<default_days> (or the command line equivalents) must be -present. - -=item B<default_crl_hours default_crl_days> - -the same as the B<-crlhours> and the B<-crldays> options. These -will only be used if neither command line option is present. At -least one of these must be present to generate a CRL. - -=item B<default_md> - -the same as the B<-md> option. The message digest to use. Mandatory. - -=item B<database> - -the text database file to use. Mandatory. This file must be present -though initially it will be empty. - -=item B<unique_subject> - -if the value B<yes> is given, the valid certificate entries in the -database must have unique subjects. if the value B<no> is given, -several valid certificate entries may have the exact same subject. -The default value is B<yes>, to be compatible with older (pre 0.9.8) -versions of OpenSSL. However, to make CA certificate roll-over easier, -it's recommended to use the value B<no>, especially if combined with -the B<-selfsign> command line option. - -=item B<serial> - -a text file containing the next serial number to use in hex. Mandatory. -This file must be present and contain a valid serial number. - -=item B<crlnumber> - -a text file containing the next CRL number to use in hex. The crl number -will be inserted in the CRLs only if this file exists. If this file is -present, it must contain a valid CRL number. - -=item B<x509_extensions> - -the same as B<-extensions>. - -=item B<crl_extensions> - -the same as B<-crlexts>. - -=item B<preserve> - -the same as B<-preserveDN> - -=item B<email_in_dn> - -the same as B<-noemailDN>. If you want the EMAIL field to be removed -from the DN of the certificate simply set this to 'no'. If not present -the default is to allow for the EMAIL filed in the certificate's DN. - -=item B<msie_hack> - -the same as B<-msie_hack> - -=item B<policy> - -the same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section -for more information. - -=item B<name_opt>, B<cert_opt> - -these options allow the format used to display the certificate details -when asking the user to confirm signing. All the options supported by -the B<x509> utilities B<-nameopt> and B<-certopt> switches can be used -here, except the B<no_signame> and B<no_sigdump> are permanently set -and cannot be disabled (this is because the certificate signature cannot -be displayed because the certificate has not been signed at this point). - -For convenience the values B<ca_default> are accepted by both to produce -a reasonable output. - -If neither option is present the format used in earlier versions of -OpenSSL is used. Use of the old format is B<strongly> discouraged because -it only displays fields mentioned in the B<policy> section, mishandles -multicharacter string types and does not display extensions. - -=item B<copy_extensions> - -determines how extensions in certificate requests should be handled. -If set to B<none> or this option is not present then extensions are -ignored and not copied to the certificate. If set to B<copy> then any -extensions present in the request that are not already present are copied -to the certificate. If set to B<copyall> then all extensions in the -request are copied to the certificate: if the extension is already present -in the certificate it is deleted first. See the B<WARNINGS> section before -using this option. - -The main use of this option is to allow a certificate request to supply -values for certain extensions such as subjectAltName. - -=back - -=head1 POLICY FORMAT - -The policy section consists of a set of variables corresponding to -certificate DN fields. If the value is "match" then the field value -must match the same field in the CA certificate. If the value is -"supplied" then it must be present. If the value is "optional" then -it may be present. Any fields not mentioned in the policy section -are silently deleted, unless the B<-preserveDN> option is set but -this can be regarded more of a quirk than intended behaviour. - -=head1 SPKAC FORMAT - -The input to the B<-spkac> command line option is a Netscape -signed public key and challenge. This will usually come from -the B<KEYGEN> tag in an HTML form to create a new private key. -It is however possible to create SPKACs using the B<spkac> utility. - -The file should contain the variable SPKAC set to the value of -the SPKAC and also the required DN components as name value pairs. -If you need to include the same component twice then it can be -preceded by a number and a '.'. - -=head1 EXAMPLES - -Note: these examples assume that the B<ca> directory structure is -already set up and the relevant files already exist. This usually -involves creating a CA certificate and private key with B<req>, a -serial number file and an empty index file and placing them in -the relevant directories. - -To use the sample configuration file below the directories demoCA, -demoCA/private and demoCA/newcerts would be created. The CA -certificate would be copied to demoCA/cacert.pem and its private -key to demoCA/private/cakey.pem. A file demoCA/serial would be -created containing for example "01" and the empty index file -demoCA/index.txt. - - -Sign a certificate request: - - openssl ca -in req.pem -out newcert.pem - -Sign a certificate request, using CA extensions: - - openssl ca -in req.pem -extensions v3_ca -out newcert.pem - -Generate a CRL - - openssl ca -gencrl -out crl.pem - -Sign several requests: - - openssl ca -infiles req1.pem req2.pem req3.pem - -Certify a Netscape SPKAC: - - openssl ca -spkac spkac.txt - -A sample SPKAC file (the SPKAC line has been truncated for clarity): - - SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5 - CN=Steve Test - emailAddress=steve@openssl.org - 0.OU=OpenSSL Group - 1.OU=Another Group - -A sample configuration file with the relevant sections for B<ca>: - - [ ca ] - default_ca = CA_default # The default ca section - - [ CA_default ] - - dir = ./demoCA # top dir - database = $dir/index.txt # index file. - new_certs_dir = $dir/newcerts # new certs dir - - certificate = $dir/cacert.pem # The CA cert - serial = $dir/serial # serial no file - private_key = $dir/private/cakey.pem# CA private key - RANDFILE = $dir/private/.rand # random number file - - default_days = 365 # how long to certify for - default_crl_days= 30 # how long before next CRL - default_md = md5 # md to use - - policy = policy_any # default policy - email_in_dn = no # Don't add the email into cert DN - - name_opt = ca_default # Subject name display option - cert_opt = ca_default # Certificate display option - copy_extensions = none # Don't copy extensions from request - - [ policy_any ] - countryName = supplied - stateOrProvinceName = optional - organizationName = optional - organizationalUnitName = optional - commonName = supplied - emailAddress = optional - -=head1 FILES - -Note: the location of all files can change either by compile time options, -configuration file entries, environment variables or command line options. -The values below reflect the default values. - - /usr/local/ssl/lib/openssl.cnf - master configuration file - ./demoCA - main CA directory - ./demoCA/cacert.pem - CA certificate - ./demoCA/private/cakey.pem - CA private key - ./demoCA/serial - CA serial number file - ./demoCA/serial.old - CA serial number backup file - ./demoCA/index.txt - CA text database file - ./demoCA/index.txt.old - CA text database backup file - ./demoCA/certs - certificate output file - ./demoCA/.rnd - CA random seed information - -=head1 ENVIRONMENT VARIABLES - -B<OPENSSL_CONF> reflects the location of master configuration file it can -be overridden by the B<-config> command line option. - -=head1 RESTRICTIONS - -The text database index file is a critical part of the process and -if corrupted it can be difficult to fix. It is theoretically possible -to rebuild the index file from all the issued certificates and a current -CRL: however there is no option to do this. - -V2 CRL features like delta CRLs are not currently supported. - -Although several requests can be input and handled at once it is only -possible to include one SPKAC or self signed certificate. - -=head1 BUGS - -The use of an in memory text database can cause problems when large -numbers of certificates are present because, as the name implies -the database has to be kept in memory. - -The B<ca> command really needs rewriting or the required functionality -exposed at either a command or interface level so a more friendly utility -(perl script or GUI) can handle things properly. The scripts B<CA.sh> and -B<CA.pl> help a little but not very much. - -Any fields in a request that are not present in a policy are silently -deleted. This does not happen if the B<-preserveDN> option is used. To -enforce the absence of the EMAIL field within the DN, as suggested by -RFCs, regardless the contents of the request' subject the B<-noemailDN> -option can be used. The behaviour should be more friendly and -configurable. - -Cancelling some commands by refusing to certify a certificate can -create an empty file. - -=head1 WARNINGS - -The B<ca> command is quirky and at times downright unfriendly. - -The B<ca> utility was originally meant as an example of how to do things -in a CA. It was not supposed to be used as a full blown CA itself: -nevertheless some people are using it for this purpose. - -The B<ca> command is effectively a single user command: no locking is -done on the various files and attempts to run more than one B<ca> command -on the same database can have unpredictable results. - -The B<copy_extensions> option should be used with caution. If care is -not taken then it can be a security risk. For example if a certificate -request contains a basicConstraints extension with CA:TRUE and the -B<copy_extensions> value is set to B<copyall> and the user does not spot -this when the certificate is displayed then this will hand the requestor -a valid CA certificate. - -This situation can be avoided by setting B<copy_extensions> to B<copy> -and including basicConstraints with CA:FALSE in the configuration file. -Then if the request contains a basicConstraints extension it will be -ignored. - -It is advisable to also include values for other extensions such -as B<keyUsage> to prevent a request supplying its own values. - -Additional restrictions can be placed on the CA certificate itself. -For example if the CA certificate has: - - basicConstraints = CA:TRUE, pathlen:0 - -then even if a certificate is issued with CA:TRUE it will not be valid. - -=head1 SEE ALSO - -L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>, -L<config(5)|config(5)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/ciphers.pod b/sys/src/ape/lib/openssl/doc/apps/ciphers.pod deleted file mode 100644 index 694e433ef..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/ciphers.pod +++ /dev/null @@ -1,434 +0,0 @@ -=pod - -=head1 NAME - -ciphers - SSL cipher display and cipher list tool. - -=head1 SYNOPSIS - -B<openssl> B<ciphers> -[B<-v>] -[B<-ssl2>] -[B<-ssl3>] -[B<-tls1>] -[B<cipherlist>] - -=head1 DESCRIPTION - -The B<cipherlist> command converts OpenSSL cipher lists into ordered -SSL cipher preference lists. It can be used as a test tool to determine -the appropriate cipherlist. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-v> - -verbose option. List ciphers with a complete description of -protocol version (SSLv2 or SSLv3; the latter includes TLS), key exchange, -authentication, encryption and mac algorithms used along with any key size -restrictions and whether the algorithm is classed as an "export" cipher. -Note that without the B<-v> option, ciphers may seem to appear twice -in a cipher list; this is when similar ciphers are available for -SSL v2 and for SSL v3/TLS v1. - -=item B<-ssl3> - -only include SSL v3 ciphers. - -=item B<-ssl2> - -only include SSL v2 ciphers. - -=item B<-tls1> - -only include TLS v1 ciphers. - -=item B<-h>, B<-?> - -print a brief usage message. - -=item B<cipherlist> - -a cipher list to convert to a cipher preference list. If it is not included -then the default cipher list will be used. The format is described below. - -=back - -=head1 CIPHER LIST FORMAT - -The cipher list consists of one or more I<cipher strings> separated by colons. -Commas or spaces are also acceptable separators but colons are normally used. - -The actual cipher string can take several different forms. - -It can consist of a single cipher suite such as B<RC4-SHA>. - -It can represent a list of cipher suites containing a certain algorithm, or -cipher suites of a certain type. For example B<SHA1> represents all ciphers -suites using the digest algorithm SHA1 and B<SSLv3> represents all SSL v3 -algorithms. - -Lists of cipher suites can be combined in a single cipher string using the -B<+> character. This is used as a logical B<and> operation. For example -B<SHA1+DES> represents all cipher suites containing the SHA1 B<and> the DES -algorithms. - -Each cipher string can be optionally preceded by the characters B<!>, -B<-> or B<+>. - -If B<!> is used then the ciphers are permanently deleted from the list. -The ciphers deleted can never reappear in the list even if they are -explicitly stated. - -If B<-> is used then the ciphers are deleted from the list, but some or -all of the ciphers can be added again by later options. - -If B<+> is used then the ciphers are moved to the end of the list. This -option doesn't add any new ciphers it just moves matching existing ones. - -If none of these characters is present then the string is just interpreted -as a list of ciphers to be appended to the current preference list. If the -list includes any ciphers already present they will be ignored: that is they -will not moved to the end of the list. - -Additionally the cipher string B<@STRENGTH> can be used at any point to sort -the current cipher list in order of encryption algorithm key length. - -=head1 CIPHER STRINGS - -The following is a list of all permitted cipher strings and their meanings. - -=over 4 - -=item B<DEFAULT> - -the default cipher list. This is determined at compile time and is normally -B<AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH>. This must be the first cipher string -specified. - -=item B<COMPLEMENTOFDEFAULT> - -the ciphers included in B<ALL>, but not enabled by default. Currently -this is B<ADH>. Note that this rule does not cover B<eNULL>, which is -not included by B<ALL> (use B<COMPLEMENTOFALL> if necessary). - -=item B<ALL> - -all ciphers suites except the B<eNULL> ciphers which must be explicitly enabled. - -=item B<COMPLEMENTOFALL> - -the cipher suites not enabled by B<ALL>, currently being B<eNULL>. - -=item B<HIGH> - -"high" encryption cipher suites. This currently means those with key lengths larger -than 128 bits, and some cipher suites with 128-bit keys. - -=item B<MEDIUM> - -"medium" encryption cipher suites, currently some of those using 128 bit encryption. - -=item B<LOW> - -"low" encryption cipher suites, currently those using 64 or 56 bit encryption algorithms -but excluding export cipher suites. - -=item B<EXP>, B<EXPORT> - -export encryption algorithms. Including 40 and 56 bits algorithms. - -=item B<EXPORT40> - -40 bit export encryption algorithms - -=item B<EXPORT56> - -56 bit export encryption algorithms. In OpenSSL 0.9.8c and later the set of -56 bit export ciphers is empty unless OpenSSL has been explicitly configured -with support for experimental ciphers. - -=item B<eNULL>, B<NULL> - -the "NULL" ciphers that is those offering no encryption. Because these offer no -encryption at all and are a security risk they are disabled unless explicitly -included. - -=item B<aNULL> - -the cipher suites offering no authentication. This is currently the anonymous -DH algorithms. These cipher suites are vulnerable to a "man in the middle" -attack and so their use is normally discouraged. - -=item B<kRSA>, B<RSA> - -cipher suites using RSA key exchange. - -=item B<kEDH> - -cipher suites using ephemeral DH key agreement. - -=item B<kDHr>, B<kDHd> - -cipher suites using DH key agreement and DH certificates signed by CAs with RSA -and DSS keys respectively. Not implemented. - -=item B<aRSA> - -cipher suites using RSA authentication, i.e. the certificates carry RSA keys. - -=item B<aDSS>, B<DSS> - -cipher suites using DSS authentication, i.e. the certificates carry DSS keys. - -=item B<aDH> - -cipher suites effectively using DH authentication, i.e. the certificates carry -DH keys. Not implemented. - -=item B<kFZA>, B<aFZA>, B<eFZA>, B<FZA> - -ciphers suites using FORTEZZA key exchange, authentication, encryption or all -FORTEZZA algorithms. Not implemented. - -=item B<TLSv1>, B<SSLv3>, B<SSLv2> - -TLS v1.0, SSL v3.0 or SSL v2.0 cipher suites respectively. - -=item B<DH> - -cipher suites using DH, including anonymous DH. - -=item B<ADH> - -anonymous DH cipher suites. - -=item B<AES> - -cipher suites using AES. - -=item B<CAMELLIA> - -cipher suites using Camellia. - -=item B<3DES> - -cipher suites using triple DES. - -=item B<DES> - -cipher suites using DES (not triple DES). - -=item B<RC4> - -cipher suites using RC4. - -=item B<RC2> - -cipher suites using RC2. - -=item B<IDEA> - -cipher suites using IDEA. - -=item B<SEED> - -cipher suites using SEED. - -=item B<MD5> - -cipher suites using MD5. - -=item B<SHA1>, B<SHA> - -cipher suites using SHA1. - -=back - -=head1 CIPHER SUITE NAMES - -The following lists give the SSL or TLS cipher suites names from the -relevant specification and their OpenSSL equivalents. It should be noted, -that several cipher suite names do not include the authentication used, -e.g. DES-CBC3-SHA. In these cases, RSA authentication is used. - -=head2 SSL v3.0 cipher suites. - - SSL_RSA_WITH_NULL_MD5 NULL-MD5 - SSL_RSA_WITH_NULL_SHA NULL-SHA - SSL_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 - SSL_RSA_WITH_RC4_128_MD5 RC4-MD5 - SSL_RSA_WITH_RC4_128_SHA RC4-SHA - SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 - SSL_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA - SSL_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA - SSL_RSA_WITH_DES_CBC_SHA DES-CBC-SHA - SSL_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA - - SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. - SSL_DH_DSS_WITH_DES_CBC_SHA Not implemented. - SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. - SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. - SSL_DH_RSA_WITH_DES_CBC_SHA Not implemented. - SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. - SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA - SSL_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA - SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA - SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA - SSL_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA - SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA - - SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 - SSL_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 - SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA - SSL_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA - SSL_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA - - SSL_FORTEZZA_KEA_WITH_NULL_SHA Not implemented. - SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA Not implemented. - SSL_FORTEZZA_KEA_WITH_RC4_128_SHA Not implemented. - -=head2 TLS v1.0 cipher suites. - - TLS_RSA_WITH_NULL_MD5 NULL-MD5 - TLS_RSA_WITH_NULL_SHA NULL-SHA - TLS_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 - TLS_RSA_WITH_RC4_128_MD5 RC4-MD5 - TLS_RSA_WITH_RC4_128_SHA RC4-SHA - TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 - TLS_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA - TLS_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA - TLS_RSA_WITH_DES_CBC_SHA DES-CBC-SHA - TLS_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA - - TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. - TLS_DH_DSS_WITH_DES_CBC_SHA Not implemented. - TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. - TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_DES_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. - TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA - TLS_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA - TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA - TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA - TLS_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA - TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA - - TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 - TLS_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 - TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA - TLS_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA - TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA - -=head2 AES ciphersuites from RFC3268, extending TLS v1.0 - - TLS_RSA_WITH_AES_128_CBC_SHA AES128-SHA - TLS_RSA_WITH_AES_256_CBC_SHA AES256-SHA - - TLS_DH_DSS_WITH_AES_128_CBC_SHA Not implemented. - TLS_DH_DSS_WITH_AES_256_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_AES_128_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_AES_256_CBC_SHA Not implemented. - - TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE-DSS-AES128-SHA - TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE-DSS-AES256-SHA - TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE-RSA-AES128-SHA - TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE-RSA-AES256-SHA - - TLS_DH_anon_WITH_AES_128_CBC_SHA ADH-AES128-SHA - TLS_DH_anon_WITH_AES_256_CBC_SHA ADH-AES256-SHA - -=head2 Camellia ciphersuites from RFC4132, extending TLS v1.0 - - TLS_RSA_WITH_CAMELLIA_128_CBC_SHA CAMELLIA128-SHA - TLS_RSA_WITH_CAMELLIA_256_CBC_SHA CAMELLIA256-SHA - - TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA Not implemented. - TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA Not implemented. - - TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA DHE-DSS-CAMELLIA128-SHA - TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA DHE-DSS-CAMELLIA256-SHA - TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA DHE-RSA-CAMELLIA128-SHA - TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA DHE-RSA-CAMELLIA256-SHA - - TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA ADH-CAMELLIA128-SHA - TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA ADH-CAMELLIA256-SHA - -=head2 SEED ciphersuites from RFC4162, extending TLS v1.0 - - TLS_RSA_WITH_SEED_CBC_SHA SEED-SHA - - TLS_DH_DSS_WITH_SEED_CBC_SHA Not implemented. - TLS_DH_RSA_WITH_SEED_CBC_SHA Not implemented. - - TLS_DHE_DSS_WITH_SEED_CBC_SHA DHE-DSS-SEED-SHA - TLS_DHE_RSA_WITH_SEED_CBC_SHA DHE-RSA-SEED-SHA - - TLS_DH_anon_WITH_SEED_CBC_SHA ADH-SEED-SHA - -=head2 Additional Export 1024 and other cipher suites - -Note: these ciphers can also be used in SSL v3. - - TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DES-CBC-SHA - TLS_RSA_EXPORT1024_WITH_RC4_56_SHA EXP1024-RC4-SHA - TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DHE-DSS-DES-CBC-SHA - TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA EXP1024-DHE-DSS-RC4-SHA - TLS_DHE_DSS_WITH_RC4_128_SHA DHE-DSS-RC4-SHA - -=head2 SSL v2.0 cipher suites. - - SSL_CK_RC4_128_WITH_MD5 RC4-MD5 - SSL_CK_RC4_128_EXPORT40_WITH_MD5 EXP-RC4-MD5 - SSL_CK_RC2_128_CBC_WITH_MD5 RC2-MD5 - SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 EXP-RC2-MD5 - SSL_CK_IDEA_128_CBC_WITH_MD5 IDEA-CBC-MD5 - SSL_CK_DES_64_CBC_WITH_MD5 DES-CBC-MD5 - SSL_CK_DES_192_EDE3_CBC_WITH_MD5 DES-CBC3-MD5 - -=head1 NOTES - -The non-ephemeral DH modes are currently unimplemented in OpenSSL -because there is no support for DH certificates. - -Some compiled versions of OpenSSL may not include all the ciphers -listed here because some ciphers were excluded at compile time. - -=head1 EXAMPLES - -Verbose listing of all OpenSSL ciphers including NULL ciphers: - - openssl ciphers -v 'ALL:eNULL' - -Include all ciphers except NULL and anonymous DH then sort by -strength: - - openssl ciphers -v 'ALL:!ADH:@STRENGTH' - -Include only 3DES ciphers and then place RSA ciphers last: - - openssl ciphers -v '3DES:+RSA' - -Include all RC4 ciphers but leave out those without authentication: - - openssl ciphers -v 'RC4:!COMPLEMENTOFDEFAULT' - -Include all chiphers with RSA authentication but leave out ciphers without -encryption. - - openssl ciphers -v 'RSA:!COMPLEMENTOFALL' - -=head1 SEE ALSO - -L<s_client(1)|s_client(1)>, L<s_server(1)|s_server(1)>, L<ssl(3)|ssl(3)> - -=head1 HISTORY - -The B<COMPLENTOFALL> and B<COMPLEMENTOFDEFAULT> selection options were -added in version 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/config.pod b/sys/src/ape/lib/openssl/doc/apps/config.pod deleted file mode 100644 index ace34b62b..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/config.pod +++ /dev/null @@ -1,279 +0,0 @@ - -=pod - -=for comment openssl_manual_section:5 - -=head1 NAME - -config - OpenSSL CONF library configuration files - -=head1 DESCRIPTION - -The OpenSSL CONF library can be used to read configuration files. -It is used for the OpenSSL master configuration file B<openssl.cnf> -and in a few other places like B<SPKAC> files and certificate extension -files for the B<x509> utility. OpenSSL applications can also use the -CONF library for their own purposes. - -A configuration file is divided into a number of sections. Each section -starts with a line B<[ section_name ]> and ends when a new section is -started or end of file is reached. A section name can consist of -alphanumeric characters and underscores. - -The first section of a configuration file is special and is referred -to as the B<default> section this is usually unnamed and is from the -start of file until the first named section. When a name is being looked up -it is first looked up in a named section (if any) and then the -default section. - -The environment is mapped onto a section called B<ENV>. - -Comments can be included by preceding them with the B<#> character - -Each section in a configuration file consists of a number of name and -value pairs of the form B<name=value> - -The B<name> string can contain any alphanumeric characters as well as -a few punctuation symbols such as B<.> B<,> B<;> and B<_>. - -The B<value> string consists of the string following the B<=> character -until end of line with any leading and trailing white space removed. - -The value string undergoes variable expansion. This can be done by -including the form B<$var> or B<${var}>: this will substitute the value -of the named variable in the current section. It is also possible to -substitute a value from another section using the syntax B<$section::name> -or B<${section::name}>. By using the form B<$ENV::name> environment -variables can be substituted. It is also possible to assign values to -environment variables by using the name B<ENV::name>, this will work -if the program looks up environment variables using the B<CONF> library -instead of calling B<getenv()> directly. - -It is possible to escape certain characters by using any kind of quote -or the B<\> character. By making the last character of a line a B<\> -a B<value> string can be spread across multiple lines. In addition -the sequences B<\n>, B<\r>, B<\b> and B<\t> are recognized. - -=head1 OPENSSL LIBRARY CONFIGURATION - -In OpenSSL 0.9.7 and later applications can automatically configure certain -aspects of OpenSSL using the master OpenSSL configuration file, or optionally -an alternative configuration file. The B<openssl> utility includes this -functionality: any sub command uses the master OpenSSL configuration file -unless an option is used in the sub command to use an alternative configuration -file. - -To enable library configuration the default section needs to contain an -appropriate line which points to the main configuration section. The default -name is B<openssl_conf> which is used by the B<openssl> utility. Other -applications may use an alternative name such as B<myapplicaton_conf>. - -The configuration section should consist of a set of name value pairs which -contain specific module configuration information. The B<name> represents -the name of the I<configuration module> the meaning of the B<value> is -module specific: it may, for example, represent a further configuration -section containing configuration module specific information. E.g. - - openssl_conf = openssl_init - - [openssl_init] - - oid_section = new_oids - engines = engine_section - - [new_oids] - - ... new oids here ... - - [engine_section] - - ... engine stuff here ... - -Currently there are two configuration modules. One for ASN1 objects another -for ENGINE configuration. - -=head2 ASN1 OBJECT CONFIGURATION MODULE - -This module has the name B<oid_section>. The value of this variable points -to a section containing name value pairs of OIDs: the name is the OID short -and long name, the value is the numerical form of the OID. Although some of -the B<openssl> utility sub commands already have their own ASN1 OBJECT section -functionality not all do. By using the ASN1 OBJECT configuration module -B<all> the B<openssl> utility sub commands can see the new objects as well -as any compliant applications. For example: - - [new_oids] - - some_new_oid = 1.2.3.4 - some_other_oid = 1.2.3.5 - -In OpenSSL 0.9.8 it is also possible to set the value to the long name followed -by a comma and the numerical OID form. For example: - - shortName = some object long name, 1.2.3.4 - -=head2 ENGINE CONFIGURATION MODULE - -This ENGINE configuration module has the name B<engines>. The value of this -variable points to a section containing further ENGINE configuration -information. - -The section pointed to by B<engines> is a table of engine names (though see -B<engine_id> below) and further sections containing configuration informations -specific to each ENGINE. - -Each ENGINE specific section is used to set default algorithms, load -dynamic, perform initialization and send ctrls. The actual operation performed -depends on the I<command> name which is the name of the name value pair. The -currently supported commands are listed below. - -For example: - - [engine_section] - - # Configure ENGINE named "foo" - foo = foo_section - # Configure ENGINE named "bar" - bar = bar_section - - [foo_section] - ... foo ENGINE specific commands ... - - [bar_section] - ... "bar" ENGINE specific commands ... - -The command B<engine_id> is used to give the ENGINE name. If used this -command must be first. For example: - - [engine_section] - # This would normally handle an ENGINE named "foo" - foo = foo_section - - [foo_section] - # Override default name and use "myfoo" instead. - engine_id = myfoo - -The command B<dynamic_path> loads and adds an ENGINE from the given path. It -is equivalent to sending the ctrls B<SO_PATH> with the path argument followed -by B<LIST_ADD> with value 2 and B<LOAD> to the dynamic ENGINE. If this is -not the required behaviour then alternative ctrls can be sent directly -to the dynamic ENGINE using ctrl commands. - -The command B<init> determines whether to initialize the ENGINE. If the value -is B<0> the ENGINE will not be initialized, if B<1> and attempt it made to -initialized the ENGINE immediately. If the B<init> command is not present -then an attempt will be made to initialize the ENGINE after all commands in -its section have been processed. - -The command B<default_algorithms> sets the default algorithms an ENGINE will -supply using the functions B<ENGINE_set_default_string()> - -If the name matches none of the above command names it is assumed to be a -ctrl command which is sent to the ENGINE. The value of the command is the -argument to the ctrl command. If the value is the string B<EMPTY> then no -value is sent to the command. - -For example: - - - [engine_section] - - # Configure ENGINE named "foo" - foo = foo_section - - [foo_section] - # Load engine from DSO - dynamic_path = /some/path/fooengine.so - # A foo specific ctrl. - some_ctrl = some_value - # Another ctrl that doesn't take a value. - other_ctrl = EMPTY - # Supply all default algorithms - default_algorithms = ALL - -=head1 NOTES - -If a configuration file attempts to expand a variable that doesn't exist -then an error is flagged and the file will not load. This can happen -if an attempt is made to expand an environment variable that doesn't -exist. For example in a previous version of OpenSSL the default OpenSSL -master configuration file used the value of B<HOME> which may not be -defined on non Unix systems and would cause an error. - -This can be worked around by including a B<default> section to provide -a default value: then if the environment lookup fails the default value -will be used instead. For this to work properly the default value must -be defined earlier in the configuration file than the expansion. See -the B<EXAMPLES> section for an example of how to do this. - -If the same variable exists in the same section then all but the last -value will be silently ignored. In certain circumstances such as with -DNs the same field may occur multiple times. This is usually worked -around by ignoring any characters before an initial B<.> e.g. - - 1.OU="My first OU" - 2.OU="My Second OU" - -=head1 EXAMPLES - -Here is a sample configuration file using some of the features -mentioned above. - - # This is the default section. - - HOME=/temp - RANDFILE= ${ENV::HOME}/.rnd - configdir=$ENV::HOME/config - - [ section_one ] - - # We are now in section one. - - # Quotes permit leading and trailing whitespace - any = " any variable name " - - other = A string that can \ - cover several lines \ - by including \\ characters - - message = Hello World\n - - [ section_two ] - - greeting = $section_one::message - -This next example shows how to expand environment variables safely. - -Suppose you want a variable called B<tmpfile> to refer to a -temporary filename. The directory it is placed in can determined by -the the B<TEMP> or B<TMP> environment variables but they may not be -set to any value at all. If you just include the environment variable -names and the variable doesn't exist then this will cause an error when -an attempt is made to load the configuration file. By making use of the -default section both values can be looked up with B<TEMP> taking -priority and B</tmp> used if neither is defined: - - TMP=/tmp - # The above value is used if TMP isn't in the environment - TEMP=$ENV::TMP - # The above value is used if TEMP isn't in the environment - tmpfile=${ENV::TEMP}/tmp.filename - -=head1 BUGS - -Currently there is no way to include characters using the octal B<\nnn> -form. Strings are all null terminated so nulls cannot form part of -the value. - -The escaping isn't quite right: if you want to use sequences like B<\n> -you can't use any quote escaping on the same line. - -Files are loaded in a single pass. This means that an variable expansion -will only work if the variables referenced are defined earlier in the -file. - -=head1 SEE ALSO - -L<x509(1)|x509(1)>, L<req(1)|req(1)>, L<ca(1)|ca(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/crl.pod b/sys/src/ape/lib/openssl/doc/apps/crl.pod deleted file mode 100644 index a40c873b9..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/crl.pod +++ /dev/null @@ -1,117 +0,0 @@ -=pod - -=head1 NAME - -crl - CRL utility - -=head1 SYNOPSIS - -B<openssl> B<crl> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-text>] -[B<-in filename>] -[B<-out filename>] -[B<-noout>] -[B<-hash>] -[B<-issuer>] -[B<-lastupdate>] -[B<-nextupdate>] -[B<-CAfile file>] -[B<-CApath dir>] - -=head1 DESCRIPTION - -The B<crl> command processes CRL files in DER or PEM format. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. B<DER> format is DER encoded CRL -structure. B<PEM> (the default) is a base64 encoded version of -the DER form with header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read from or standard input if this -option is not specified. - -=item B<-out filename> - -specifies the output filename to write to or standard output by -default. - -=item B<-text> - -print out the CRL in text form. - -=item B<-noout> - -don't output the encoded version of the CRL. - -=item B<-hash> - -output a hash of the issuer name. This can be use to lookup CRLs in -a directory by issuer name. - -=item B<-issuer> - -output the issuer name. - -=item B<-lastupdate> - -output the lastUpdate field. - -=item B<-nextupdate> - -output the nextUpdate field. - -=item B<-CAfile file> - -verify the signature on a CRL by looking up the issuing certificate in -B<file> - -=item B<-CApath dir> - -verify the signature on a CRL by looking up the issuing certificate in -B<dir>. This directory must be a standard certificate directory: that -is a hash of each subject name (using B<x509 -hash>) should be linked -to each certificate. - -=back - -=head1 NOTES - -The PEM CRL format uses the header and footer lines: - - -----BEGIN X509 CRL----- - -----END X509 CRL----- - -=head1 EXAMPLES - -Convert a CRL file from PEM to DER: - - openssl crl -in crl.pem -outform DER -out crl.der - -Output the text form of a DER encoded certificate: - - openssl crl -in crl.der -text -noout - -=head1 BUGS - -Ideally it should be possible to create a CRL using appropriate options -and files too. - -=head1 SEE ALSO - -L<crl2pkcs7(1)|crl2pkcs7(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/crl2pkcs7.pod b/sys/src/ape/lib/openssl/doc/apps/crl2pkcs7.pod deleted file mode 100644 index 3797bc0df..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/crl2pkcs7.pod +++ /dev/null @@ -1,91 +0,0 @@ -=pod - -=head1 NAME - -crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates. - -=head1 SYNOPSIS - -B<openssl> B<crl2pkcs7> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-out filename>] -[B<-certfile filename>] -[B<-nocrl>] - -=head1 DESCRIPTION - -The B<crl2pkcs7> command takes an optional CRL and one or more -certificates and converts them into a PKCS#7 degenerate "certificates -only" structure. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the CRL input format. B<DER> format is DER encoded CRL -structure.B<PEM> (the default) is a base64 encoded version of -the DER form with header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the PKCS#7 structure output format. B<DER> format is DER -encoded PKCS#7 structure.B<PEM> (the default) is a base64 encoded version of -the DER form with header and footer lines. - -=item B<-in filename> - -This specifies the input filename to read a CRL from or standard input if this -option is not specified. - -=item B<-out filename> - -specifies the output filename to write the PKCS#7 structure to or standard -output by default. - -=item B<-certfile filename> - -specifies a filename containing one or more certificates in B<PEM> format. -All certificates in the file will be added to the PKCS#7 structure. This -option can be used more than once to read certificates form multiple -files. - -=item B<-nocrl> - -normally a CRL is included in the output file. With this option no CRL is -included in the output file and a CRL is not read from the input file. - -=back - -=head1 EXAMPLES - -Create a PKCS#7 structure from a certificate and CRL: - - openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem - -Creates a PKCS#7 structure in DER format with no CRL from several -different certificates: - - openssl crl2pkcs7 -nocrl -certfile newcert.pem - -certfile demoCA/cacert.pem -outform DER -out p7.der - -=head1 NOTES - -The output file is a PKCS#7 signed data structure containing no signers and -just certificates and an optional CRL. - -This utility can be used to send certificates and CAs to Netscape as part of -the certificate enrollment process. This involves sending the DER encoded output -as MIME type application/x-x509-user-cert. - -The B<PEM> encoded form with the header and footer lines removed can be used to -install user certificates and CAs in MSIE using the Xenroll control. - -=head1 SEE ALSO - -L<pkcs7(1)|pkcs7(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/dgst.pod b/sys/src/ape/lib/openssl/doc/apps/dgst.pod deleted file mode 100644 index b0d198724..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/dgst.pod +++ /dev/null @@ -1,110 +0,0 @@ -=pod - -=head1 NAME - -dgst, md5, md4, md2, sha1, sha, mdc2, ripemd160 - message digests - -=head1 SYNOPSIS - -B<openssl> B<dgst> -[B<-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1>] -[B<-c>] -[B<-d>] -[B<-hex>] -[B<-binary>] -[B<-out filename>] -[B<-sign filename>] -[B<-passin arg>] -[B<-verify filename>] -[B<-prverify filename>] -[B<-signature filename>] -[B<file...>] - -[B<md5|md4|md2|sha1|sha|mdc2|ripemd160>] -[B<-c>] -[B<-d>] -[B<file...>] - -=head1 DESCRIPTION - -The digest functions output the message digest of a supplied file or files -in hexadecimal form. They can also be used for digital signing and verification. - -=head1 OPTIONS - -=over 4 - -=item B<-c> - -print out the digest in two digit groups separated by colons, only relevant if -B<hex> format output is used. - -=item B<-d> - -print out BIO debugging information. - -=item B<-hex> - -digest is to be output as a hex dump. This is the default case for a "normal" -digest as opposed to a digital signature. - -=item B<-binary> - -output the digest or signature in binary form. - -=item B<-out filename> - -filename to output to, or standard output by default. - -=item B<-sign filename> - -digitally sign the digest using the private key in "filename". - -=item B<-passin arg> - -the private key password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-verify filename> - -verify the signature using the the public key in "filename". -The output is either "Verification OK" or "Verification Failure". - -=item B<-prverify filename> - -verify the signature using the the private key in "filename". - -=item B<-signature filename> - -the actual signature to verify. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<file...> - -file or files to digest. If no files are specified then standard input is -used. - -=back - -=head1 NOTES - -The digest of choice for all new applications is SHA1. Other digests are -however still widely used. - -If you wish to sign or verify data using the DSA algorithm then the dss1 -digest must be used. - -A source of random numbers is required for certain signing algorithms, in -particular DSA. - -The signing and verify options should only be used if a single file is -being signed or verified. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/dhparam.pod b/sys/src/ape/lib/openssl/doc/apps/dhparam.pod deleted file mode 100644 index c31db95a4..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/dhparam.pod +++ /dev/null @@ -1,141 +0,0 @@ -=pod - -=head1 NAME - -dhparam - DH parameter manipulation and generation - -=head1 SYNOPSIS - -B<openssl dhparam> -[B<-inform DER|PEM>] -[B<-outform DER|PEM>] -[B<-in> I<filename>] -[B<-out> I<filename>] -[B<-dsaparam>] -[B<-noout>] -[B<-text>] -[B<-C>] -[B<-2>] -[B<-5>] -[B<-rand> I<file(s)>] -[B<-engine id>] -[I<numbits>] - -=head1 DESCRIPTION - -This command is used to manipulate DH parameter files. - -=head1 OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option uses an ASN1 DER encoded -form compatible with the PKCS#3 DHparameter structure. The PEM form is the -default format: it consists of the B<DER> format base64 encoded with -additional header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in> I<filename> - -This specifies the input filename to read parameters from or standard input if -this option is not specified. - -=item B<-out> I<filename> - -This specifies the output filename parameters to. Standard output is used -if this option is not present. The output filename should B<not> be the same -as the input filename. - -=item B<-dsaparam> - -If this option is used, DSA rather than DH parameters are read or created; -they are converted to DH format. Otherwise, "strong" primes (such -that (p-1)/2 is also prime) will be used for DH parameter generation. - -DH parameter generation with the B<-dsaparam> option is much faster, -and the recommended exponent length is shorter, which makes DH key -exchange more efficient. Beware that with such DSA-style DH -parameters, a fresh DH key should be created for each use to -avoid small-subgroup attacks that may be possible otherwise. - -=item B<-2>, B<-5> - -The generator to use, either 2 or 5. 2 is the default. If present then the -input file is ignored and parameters are generated instead. - -=item B<-rand> I<file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item I<numbits> - -this option specifies that a parameter set should be generated of size -I<numbits>. It must be the last option. If not present then a value of 512 -is used. If this option is present then the input file is ignored and -parameters are generated instead. - -=item B<-noout> - -this option inhibits the output of the encoded version of the parameters. - -=item B<-text> - -this option prints out the DH parameters in human readable form. - -=item B<-C> - -this option converts the parameters into C code. The parameters can then -be loaded by calling the B<get_dh>I<numbits>B<()> function. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 WARNINGS - -The program B<dhparam> combines the functionality of the programs B<dh> and -B<gendh> in previous versions of OpenSSL and SSLeay. The B<dh> and B<gendh> -programs are retained for now but may have different purposes in future -versions of OpenSSL. - -=head1 NOTES - -PEM format DH parameters use the header and footer lines: - - -----BEGIN DH PARAMETERS----- - -----END DH PARAMETERS----- - -OpenSSL currently only supports the older PKCS#3 DH, not the newer X9.42 -DH. - -This program manipulates DH parameters not keys. - -=head1 BUGS - -There should be a way to generate and manipulate DH keys. - -=head1 SEE ALSO - -L<dsaparam(1)|dsaparam(1)> - -=head1 HISTORY - -The B<dhparam> command was added in OpenSSL 0.9.5. -The B<-dsaparam> option was added in OpenSSL 0.9.6. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/dsa.pod b/sys/src/ape/lib/openssl/doc/apps/dsa.pod deleted file mode 100644 index ed06b8806..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/dsa.pod +++ /dev/null @@ -1,158 +0,0 @@ -=pod - -=head1 NAME - -dsa - DSA key processing - -=head1 SYNOPSIS - -B<openssl> B<dsa> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-passin arg>] -[B<-out filename>] -[B<-passout arg>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-text>] -[B<-noout>] -[B<-modulus>] -[B<-pubin>] -[B<-pubout>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<dsa> command processes DSA keys. They can be converted between various -forms and their components printed out. B<Note> This command uses the -traditional SSLeay compatible format for private key encryption: newer -applications should use the more secure PKCS#8 format using the B<pkcs8> - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option with a private key uses -an ASN1 DER encoded form of an ASN.1 SEQUENCE consisting of the values of -version (currently zero), p, q, g, the public and private key components -respectively as ASN.1 INTEGERs. When used with a public key it uses a -SubjectPublicKeyInfo structure: it is an error if the key is not DSA. - -The B<PEM> form is the default format: it consists of the B<DER> format base64 -encoded with additional header and footer lines. In the case of a private key -PKCS#8 format is also accepted. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a key from or standard input if this -option is not specified. If the key is encrypted a pass phrase will be -prompted for. - -=item B<-passin arg> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-out filename> - -This specifies the output filename to write a key to or standard output by -is not specified. If any encryption options are set then a pass phrase will be -prompted for. The output filename should B<not> be the same as the input -filename. - -=item B<-passout arg> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-des|-des3|-idea> - -These options encrypt the private key with the DES, triple DES, or the -IDEA ciphers respectively before outputting it. A pass phrase is prompted for. -If none of these options is specified the key is written in plain text. This -means that using the B<dsa> utility to read in an encrypted key with no -encryption option can be used to remove the pass phrase from a key, or by -setting the encryption options it can be use to add or change the pass phrase. -These options can only be used with PEM format output files. - -=item B<-text> - -prints out the public, private key components and parameters. - -=item B<-noout> - -this option prevents output of the encoded version of the key. - -=item B<-modulus> - -this option prints out the value of the public key component of the key. - -=item B<-pubin> - -by default a private key is read from the input file: with this option a -public key is read instead. - -=item B<-pubout> - -by default a private key is output. With this option a public -key will be output instead. This option is automatically set if the input is -a public key. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -The PEM private key format uses the header and footer lines: - - -----BEGIN DSA PRIVATE KEY----- - -----END DSA PRIVATE KEY----- - -The PEM public key format uses the header and footer lines: - - -----BEGIN PUBLIC KEY----- - -----END PUBLIC KEY----- - -=head1 EXAMPLES - -To remove the pass phrase on a DSA private key: - - openssl dsa -in key.pem -out keyout.pem - -To encrypt a private key using triple DES: - - openssl dsa -in key.pem -des3 -out keyout.pem - -To convert a private key from PEM to DER format: - - openssl dsa -in key.pem -outform DER -out keyout.der - -To print out the components of a private key to standard output: - - openssl dsa -in key.pem -text -noout - -To just output the public part of a private key: - - openssl dsa -in key.pem -pubout -out pubkey.pem - -=head1 SEE ALSO - -L<dsaparam(1)|dsaparam(1)>, L<gendsa(1)|gendsa(1)>, L<rsa(1)|rsa(1)>, -L<genrsa(1)|genrsa(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/dsaparam.pod b/sys/src/ape/lib/openssl/doc/apps/dsaparam.pod deleted file mode 100644 index b9b1b93b4..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/dsaparam.pod +++ /dev/null @@ -1,110 +0,0 @@ -=pod - -=head1 NAME - -dsaparam - DSA parameter manipulation and generation - -=head1 SYNOPSIS - -B<openssl dsaparam> -[B<-inform DER|PEM>] -[B<-outform DER|PEM>] -[B<-in filename>] -[B<-out filename>] -[B<-noout>] -[B<-text>] -[B<-C>] -[B<-rand file(s)>] -[B<-genkey>] -[B<-engine id>] -[B<numbits>] - -=head1 DESCRIPTION - -This command is used to manipulate or generate DSA parameter files. - -=head1 OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option uses an ASN1 DER encoded -form compatible with RFC2459 (PKIX) DSS-Parms that is a SEQUENCE consisting -of p, q and g respectively. The PEM form is the default format: it consists -of the B<DER> format base64 encoded with additional header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read parameters from or standard input if -this option is not specified. If the B<numbits> parameter is included then -this option will be ignored. - -=item B<-out filename> - -This specifies the output filename parameters to. Standard output is used -if this option is not present. The output filename should B<not> be the same -as the input filename. - -=item B<-noout> - -this option inhibits the output of the encoded version of the parameters. - -=item B<-text> - -this option prints out the DSA parameters in human readable form. - -=item B<-C> - -this option converts the parameters into C code. The parameters can then -be loaded by calling the B<get_dsaXXX()> function. - -=item B<-genkey> - -this option will generate a DSA either using the specified or generated -parameters. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<numbits> - -this option specifies that a parameter set should be generated of size -B<numbits>. It must be the last option. If this option is included then -the input file (if any) is ignored. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -PEM format DSA parameters use the header and footer lines: - - -----BEGIN DSA PARAMETERS----- - -----END DSA PARAMETERS----- - -DSA parameter generation is a slow process and as a result the same set of -DSA parameters is often used to generate several distinct keys. - -=head1 SEE ALSO - -L<gendsa(1)|gendsa(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, -L<rsa(1)|rsa(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/ec.pod b/sys/src/ape/lib/openssl/doc/apps/ec.pod deleted file mode 100644 index 1d4a36dbf..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/ec.pod +++ /dev/null @@ -1,190 +0,0 @@ -=pod - -=head1 NAME - -ec - EC key processing - -=head1 SYNOPSIS - -B<openssl> B<ec> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-passin arg>] -[B<-out filename>] -[B<-passout arg>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-text>] -[B<-noout>] -[B<-param_out>] -[B<-pubin>] -[B<-pubout>] -[B<-conv_form arg>] -[B<-param_enc arg>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<ec> command processes EC keys. They can be converted between various -forms and their components printed out. B<Note> OpenSSL uses the -private key format specified in 'SEC 1: Elliptic Curve Cryptography' -(http://www.secg.org/). To convert a OpenSSL EC private key into the -PKCS#8 private key format use the B<pkcs8> command. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option with a private key uses -an ASN.1 DER encoded SEC1 private key. When used with a public key it -uses the SubjectPublicKeyInfo structur as specified in RFC 3280. -The B<PEM> form is the default format: it consists of the B<DER> format base64 -encoded with additional header and footer lines. In the case of a private key -PKCS#8 format is also accepted. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a key from or standard input if this -option is not specified. If the key is encrypted a pass phrase will be -prompted for. - -=item B<-passin arg> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-out filename> - -This specifies the output filename to write a key to or standard output by -is not specified. If any encryption options are set then a pass phrase will be -prompted for. The output filename should B<not> be the same as the input -filename. - -=item B<-passout arg> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-des|-des3|-idea> - -These options encrypt the private key with the DES, triple DES, IDEA or -any other cipher supported by OpenSSL before outputting it. A pass phrase is -prompted for. -If none of these options is specified the key is written in plain text. This -means that using the B<ec> utility to read in an encrypted key with no -encryption option can be used to remove the pass phrase from a key, or by -setting the encryption options it can be use to add or change the pass phrase. -These options can only be used with PEM format output files. - -=item B<-text> - -prints out the public, private key components and parameters. - -=item B<-noout> - -this option prevents output of the encoded version of the key. - -=item B<-modulus> - -this option prints out the value of the public key component of the key. - -=item B<-pubin> - -by default a private key is read from the input file: with this option a -public key is read instead. - -=item B<-pubout> - -by default a private key is output. With this option a public -key will be output instead. This option is automatically set if the input is -a public key. - -=item B<-conv_form> - -This specifies how the points on the elliptic curve are converted -into octet strings. Possible values are: B<compressed> (the default -value), B<uncompressed> and B<hybrid>. For more information regarding -the point conversion forms please read the X9.62 standard. -B<Note> Due to patent issues the B<compressed> option is disabled -by default for binary curves and can be enabled by defining -the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. - -=item B<-param_enc arg> - -This specifies how the elliptic curve parameters are encoded. -Possible value are: B<named_curve>, i.e. the ec parameters are -specified by a OID, or B<explicit> where the ec parameters are -explicitly given (see RFC 3279 for the definition of the -EC parameters structures). The default value is B<named_curve>. -B<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279, -is currently not implemented in OpenSSL. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -The PEM private key format uses the header and footer lines: - - -----BEGIN EC PRIVATE KEY----- - -----END EC PRIVATE KEY----- - -The PEM public key format uses the header and footer lines: - - -----BEGIN PUBLIC KEY----- - -----END PUBLIC KEY----- - -=head1 EXAMPLES - -To encrypt a private key using triple DES: - - openssl ec -in key.pem -des3 -out keyout.pem - -To convert a private key from PEM to DER format: - - openssl ec -in key.pem -outform DER -out keyout.der - -To print out the components of a private key to standard output: - - openssl ec -in key.pem -text -noout - -To just output the public part of a private key: - - openssl ec -in key.pem -pubout -out pubkey.pem - -To change the parameters encoding to B<explicit>: - - openssl ec -in key.pem -param_enc explicit -out keyout.pem - -To change the point conversion form to B<compressed>: - - openssl ec -in key.pem -conv_form compressed -out keyout.pem - -=head1 SEE ALSO - -L<ecparam(1)|ecparam(1)>, L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)> - -=head1 HISTORY - -The ec command was first introduced in OpenSSL 0.9.8. - -=head1 AUTHOR - -Nils Larsch for the OpenSSL project (http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/ecparam.pod b/sys/src/ape/lib/openssl/doc/apps/ecparam.pod deleted file mode 100644 index 1a12105da..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/ecparam.pod +++ /dev/null @@ -1,179 +0,0 @@ -=pod - -=head1 NAME - -ecparam - EC parameter manipulation and generation - -=head1 SYNOPSIS - -B<openssl ecparam> -[B<-inform DER|PEM>] -[B<-outform DER|PEM>] -[B<-in filename>] -[B<-out filename>] -[B<-noout>] -[B<-text>] -[B<-C>] -[B<-check>] -[B<-name arg>] -[B<-list_curve>] -[B<-conv_form arg>] -[B<-param_enc arg>] -[B<-no_seed>] -[B<-rand file(s)>] -[B<-genkey>] -[B<-engine id>] - -=head1 DESCRIPTION - -This command is used to manipulate or generate EC parameter files. - -=head1 OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option uses an ASN.1 DER encoded -form compatible with RFC 3279 EcpkParameters. The PEM form is the default -format: it consists of the B<DER> format base64 encoded with additional -header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read parameters from or standard input if -this option is not specified. - -=item B<-out filename> - -This specifies the output filename parameters to. Standard output is used -if this option is not present. The output filename should B<not> be the same -as the input filename. - -=item B<-noout> - -This option inhibits the output of the encoded version of the parameters. - -=item B<-text> - -This option prints out the EC parameters in human readable form. - -=item B<-C> - -This option converts the EC parameters into C code. The parameters can then -be loaded by calling the B<get_ec_group_XXX()> function. - -=item B<-check> - -Validate the elliptic curve parameters. - -=item B<-name arg> - -Use the EC parameters with the specified 'short' name. Use B<-list_curves> -to get a list of all currently implemented EC parameters. - -=item B<-list_curves> - -If this options is specified B<ecparam> will print out a list of all -currently implemented EC parameters names and exit. - -=item B<-conv_form> - -This specifies how the points on the elliptic curve are converted -into octet strings. Possible values are: B<compressed> (the default -value), B<uncompressed> and B<hybrid>. For more information regarding -the point conversion forms please read the X9.62 standard. -B<Note> Due to patent issues the B<compressed> option is disabled -by default for binary curves and can be enabled by defining -the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. - -=item B<-param_enc arg> - -This specifies how the elliptic curve parameters are encoded. -Possible value are: B<named_curve>, i.e. the ec parameters are -specified by a OID, or B<explicit> where the ec parameters are -explicitly given (see RFC 3279 for the definition of the -EC parameters structures). The default value is B<named_curve>. -B<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279, -is currently not implemented in OpenSSL. - -=item B<-no_seed> - -This option inhibits that the 'seed' for the parameter generation -is included in the ECParameters structure (see RFC 3279). - -=item B<-genkey> - -This option will generate a EC private key using the specified parameters. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -PEM format EC parameters use the header and footer lines: - - -----BEGIN EC PARAMETERS----- - -----END EC PARAMETERS----- - -OpenSSL is currently not able to generate new groups and therefore -B<ecparam> can only create EC parameters from known (named) curves. - -=head1 EXAMPLES - -To create EC parameters with the group 'prime192v1': - - openssl ecparam -out ec_param.pem -name prime192v1 - -To create EC parameters with explicit parameters: - - openssl ecparam -out ec_param.pem -name prime192v1 -param_enc explicit - -To validate given EC parameters: - - openssl ecparam -in ec_param.pem -check - -To create EC parameters and a private key: - - openssl ecparam -out ec_key.pem -name prime192v1 -genkey - -To change the point encoding to 'compressed': - - openssl ecparam -in ec_in.pem -out ec_out.pem -conv_form compressed - -To print out the EC parameters to standard output: - - openssl ecparam -in ec_param.pem -noout -text - -=head1 SEE ALSO - -L<ec(1)|ec(1)>, L<dsaparam(1)|dsaparam(1)> - -=head1 HISTORY - -The ecparam command was first introduced in OpenSSL 0.9.8. - -=head1 AUTHOR - -Nils Larsch for the OpenSSL project (http://www.openssl.org) - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/enc.pod b/sys/src/ape/lib/openssl/doc/apps/enc.pod deleted file mode 100644 index 4391c9336..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/enc.pod +++ /dev/null @@ -1,279 +0,0 @@ -=pod - -=head1 NAME - -enc - symmetric cipher routines - -=head1 SYNOPSIS - -B<openssl enc -ciphername> -[B<-in filename>] -[B<-out filename>] -[B<-pass arg>] -[B<-e>] -[B<-d>] -[B<-a>] -[B<-A>] -[B<-k password>] -[B<-kfile filename>] -[B<-K key>] -[B<-iv IV>] -[B<-p>] -[B<-P>] -[B<-bufsize number>] -[B<-nopad>] -[B<-debug>] - -=head1 DESCRIPTION - -The symmetric cipher commands allow data to be encrypted or decrypted -using various block and stream ciphers using keys based on passwords -or explicitly provided. Base64 encoding or decoding can also be performed -either by itself or in addition to the encryption or decryption. - -=head1 OPTIONS - -=over 4 - -=item B<-in filename> - -the input filename, standard input by default. - -=item B<-out filename> - -the output filename, standard output by default. - -=item B<-pass arg> - -the password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-salt> - -use a salt in the key derivation routines. This option should B<ALWAYS> -be used unless compatibility with previous versions of OpenSSL or SSLeay -is required. This option is only present on OpenSSL versions 0.9.5 or -above. - -=item B<-nosalt> - -don't use a salt in the key derivation routines. This is the default for -compatibility with previous versions of OpenSSL and SSLeay. - -=item B<-e> - -encrypt the input data: this is the default. - -=item B<-d> - -decrypt the input data. - -=item B<-a> - -base64 process the data. This means that if encryption is taking place -the data is base64 encoded after encryption. If decryption is set then -the input data is base64 decoded before being decrypted. - -=item B<-A> - -if the B<-a> option is set then base64 process the data on one line. - -=item B<-k password> - -the password to derive the key from. This is for compatibility with previous -versions of OpenSSL. Superseded by the B<-pass> argument. - -=item B<-kfile filename> - -read the password to derive the key from the first line of B<filename>. -This is for compatibility with previous versions of OpenSSL. Superseded by -the B<-pass> argument. - -=item B<-S salt> - -the actual salt to use: this must be represented as a string comprised only -of hex digits. - -=item B<-K key> - -the actual key to use: this must be represented as a string comprised only -of hex digits. If only the key is specified, the IV must additionally specified -using the B<-iv> option. When both a key and a password are specified, the -key given with the B<-K> option will be used and the IV generated from the -password will be taken. It probably does not make much sense to specify -both key and password. - -=item B<-iv IV> - -the actual IV to use: this must be represented as a string comprised only -of hex digits. When only the key is specified using the B<-K> option, the -IV must explicitly be defined. When a password is being specified using -one of the other options, the IV is generated from this password. - -=item B<-p> - -print out the key and IV used. - -=item B<-P> - -print out the key and IV used then immediately exit: don't do any encryption -or decryption. - -=item B<-bufsize number> - -set the buffer size for I/O - -=item B<-nopad> - -disable standard block padding - -=item B<-debug> - -debug the BIOs used for I/O. - -=back - -=head1 NOTES - -The program can be called either as B<openssl ciphername> or -B<openssl enc -ciphername>. - -A password will be prompted for to derive the key and IV if necessary. - -The B<-salt> option should B<ALWAYS> be used if the key is being derived -from a password unless you want compatibility with previous versions of -OpenSSL and SSLeay. - -Without the B<-salt> option it is possible to perform efficient dictionary -attacks on the password and to attack stream cipher encrypted data. The reason -for this is that without the salt the same password always generates the same -encryption key. When the salt is being used the first eight bytes of the -encrypted data are reserved for the salt: it is generated at random when -encrypting a file and read from the encrypted file when it is decrypted. - -Some of the ciphers do not have large keys and others have security -implications if not used correctly. A beginner is advised to just use -a strong block cipher in CBC mode such as bf or des3. - -All the block ciphers normally use PKCS#5 padding also known as standard block -padding: this allows a rudimentary integrity or password check to be -performed. However since the chance of random data passing the test is -better than 1 in 256 it isn't a very good test. - -If padding is disabled then the input data must be a multiple of the cipher -block length. - -All RC2 ciphers have the same key and effective key length. - -Blowfish and RC5 algorithms use a 128 bit key. - -=head1 SUPPORTED CIPHERS - - base64 Base 64 - - bf-cbc Blowfish in CBC mode - bf Alias for bf-cbc - bf-cfb Blowfish in CFB mode - bf-ecb Blowfish in ECB mode - bf-ofb Blowfish in OFB mode - - cast-cbc CAST in CBC mode - cast Alias for cast-cbc - cast5-cbc CAST5 in CBC mode - cast5-cfb CAST5 in CFB mode - cast5-ecb CAST5 in ECB mode - cast5-ofb CAST5 in OFB mode - - des-cbc DES in CBC mode - des Alias for des-cbc - des-cfb DES in CBC mode - des-ofb DES in OFB mode - des-ecb DES in ECB mode - - des-ede-cbc Two key triple DES EDE in CBC mode - des-ede Two key triple DES EDE in ECB mode - des-ede-cfb Two key triple DES EDE in CFB mode - des-ede-ofb Two key triple DES EDE in OFB mode - - des-ede3-cbc Three key triple DES EDE in CBC mode - des-ede3 Three key triple DES EDE in ECB mode - des3 Alias for des-ede3-cbc - des-ede3-cfb Three key triple DES EDE CFB mode - des-ede3-ofb Three key triple DES EDE in OFB mode - - desx DESX algorithm. - - idea-cbc IDEA algorithm in CBC mode - idea same as idea-cbc - idea-cfb IDEA in CFB mode - idea-ecb IDEA in ECB mode - idea-ofb IDEA in OFB mode - - rc2-cbc 128 bit RC2 in CBC mode - rc2 Alias for rc2-cbc - rc2-cfb 128 bit RC2 in CFB mode - rc2-ecb 128 bit RC2 in ECB mode - rc2-ofb 128 bit RC2 in OFB mode - rc2-64-cbc 64 bit RC2 in CBC mode - rc2-40-cbc 40 bit RC2 in CBC mode - - rc4 128 bit RC4 - rc4-64 64 bit RC4 - rc4-40 40 bit RC4 - - rc5-cbc RC5 cipher in CBC mode - rc5 Alias for rc5-cbc - rc5-cfb RC5 cipher in CFB mode - rc5-ecb RC5 cipher in ECB mode - rc5-ofb RC5 cipher in OFB mode - - aes-[128|192|256]-cbc 128/192/256 bit AES in CBC mode - aes-[128|192|256] Alias for aes-[128|192|256]-cbc - aes-[128|192|256]-cfb 128/192/256 bit AES in 128 bit CFB mode - aes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode - aes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode - aes-[128|192|256]-ecb 128/192/256 bit AES in ECB mode - aes-[128|192|256]-ofb 128/192/256 bit AES in OFB mode - -=head1 EXAMPLES - -Just base64 encode a binary file: - - openssl base64 -in file.bin -out file.b64 - -Decode the same file - - openssl base64 -d -in file.b64 -out file.bin - -Encrypt a file using triple DES in CBC mode using a prompted password: - - openssl des3 -salt -in file.txt -out file.des3 - -Decrypt a file using a supplied password: - - openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword - -Encrypt a file then base64 encode it (so it can be sent via mail for example) -using Blowfish in CBC mode: - - openssl bf -a -salt -in file.txt -out file.bf - -Base64 decode a file then decrypt it: - - openssl bf -d -salt -a -in file.bf -out file.txt - -Decrypt some data using a supplied 40 bit RC4 key: - - openssl rc4-40 -in file.rc4 -out file.txt -K 0102030405 - -=head1 BUGS - -The B<-A> option when used with large files doesn't work properly. - -There should be an option to allow an iteration count to be included. - -The B<enc> program only supports a fixed number of algorithms with -certain parameters. So if, for example, you want to use RC2 with a -76 bit key or RC4 with an 84 bit key you can't use this program. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/errstr.pod b/sys/src/ape/lib/openssl/doc/apps/errstr.pod deleted file mode 100644 index b3c6ccfc9..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/errstr.pod +++ /dev/null @@ -1,39 +0,0 @@ -=pod - -=head1 NAME - -errstr - lookup error codes - -=head1 SYNOPSIS - -B<openssl errstr error_code> - -=head1 DESCRIPTION - -Sometimes an application will not load error message and only -numerical forms will be available. The B<errstr> utility can be used to -display the meaning of the hex code. The hex code is the hex digits after the -second colon. - -=head1 EXAMPLE - -The error code: - - 27594:error:2006D080:lib(32):func(109):reason(128):bss_file.c:107: - -can be displayed with: - - openssl errstr 2006D080 - -to produce the error message: - - error:2006D080:BIO routines:BIO_new_file:no such file - -=head1 SEE ALSO - -L<err(3)|err(3)>, -L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, -L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> - - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/gendsa.pod b/sys/src/ape/lib/openssl/doc/apps/gendsa.pod deleted file mode 100644 index 2c56cc788..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/gendsa.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -gendsa - generate a DSA private key from a set of parameters - -=head1 SYNOPSIS - -B<openssl> B<gendsa> -[B<-out filename>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-rand file(s)>] -[B<-engine id>] -[B<paramfile>] - -=head1 DESCRIPTION - -The B<gendsa> command generates a DSA private key from a DSA parameter file -(which will be typically generated by the B<openssl dsaparam> command). - -=head1 OPTIONS - -=over 4 - -=item B<-des|-des3|-idea> - -These options encrypt the private key with the DES, triple DES, or the -IDEA ciphers respectively before outputting it. A pass phrase is prompted for. -If none of these options is specified no encryption is used. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<paramfile> - -This option specifies the DSA parameter file to use. The parameters in this -file determine the size of the private key. DSA parameters can be generated -and examined using the B<openssl dsaparam> command. - -=back - -=head1 NOTES - -DSA key generation is little more than random number generation so it is -much quicker that RSA key generation for example. - -=head1 SEE ALSO - -L<dsaparam(1)|dsaparam(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, -L<rsa(1)|rsa(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/genrsa.pod b/sys/src/ape/lib/openssl/doc/apps/genrsa.pod deleted file mode 100644 index 25af4d147..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/genrsa.pod +++ /dev/null @@ -1,96 +0,0 @@ -=pod - -=head1 NAME - -genrsa - generate an RSA private key - -=head1 SYNOPSIS - -B<openssl> B<genrsa> -[B<-out filename>] -[B<-passout arg>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-f4>] -[B<-3>] -[B<-rand file(s)>] -[B<-engine id>] -[B<numbits>] - -=head1 DESCRIPTION - -The B<genrsa> command generates an RSA private key. - -=head1 OPTIONS - -=over 4 - -=item B<-out filename> - -the output filename. If this argument is not specified then standard output is -used. - -=item B<-passout arg> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-des|-des3|-idea> - -These options encrypt the private key with the DES, triple DES, or the -IDEA ciphers respectively before outputting it. If none of these options is -specified no encryption is used. If encryption is used a pass phrase is prompted -for if it is not supplied via the B<-passout> argument. - -=item B<-F4|-3> - -the public exponent to use, either 65537 or 3. The default is 65537. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<numbits> - -the size of the private key to generate in bits. This must be the last option -specified. The default is 512. - -=back - -=head1 NOTES - -RSA private key generation essentially involves the generation of two prime -numbers. When generating a private key various symbols will be output to -indicate the progress of the generation. A B<.> represents each number which -has passed an initial sieve test, B<+> means a number has passed a single -round of the Miller-Rabin primality test. A newline means that the number has -passed all the prime tests (the actual number depends on the key size). - -Because key generation is a random process the time taken to generate a key -may vary somewhat. - -=head1 BUGS - -A quirk of the prime generation algorithm is that it cannot generate small -primes. Therefore the number of bits should not be less that 64. For typical -private keys this will not matter because for security reasons they will -be much larger (typically 1024 bits). - -=head1 SEE ALSO - -L<gendsa(1)|gendsa(1)> - -=cut - diff --git a/sys/src/ape/lib/openssl/doc/apps/nseq.pod b/sys/src/ape/lib/openssl/doc/apps/nseq.pod deleted file mode 100644 index 989c3108f..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/nseq.pod +++ /dev/null @@ -1,70 +0,0 @@ -=pod - -=head1 NAME - -nseq - create or examine a netscape certificate sequence - -=head1 SYNOPSIS - -B<openssl> B<nseq> -[B<-in filename>] -[B<-out filename>] -[B<-toseq>] - -=head1 DESCRIPTION - -The B<nseq> command takes a file containing a Netscape certificate -sequence and prints out the certificates contained in it or takes a -file of certificates and converts it into a Netscape certificate -sequence. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-in filename> - -This specifies the input filename to read or standard input if this -option is not specified. - -=item B<-out filename> - -specifies the output filename or standard output by default. - -=item B<-toseq> - -normally a Netscape certificate sequence will be input and the output -is the certificates contained in it. With the B<-toseq> option the -situation is reversed: a Netscape certificate sequence is created from -a file of certificates. - -=back - -=head1 EXAMPLES - -Output the certificates in a Netscape certificate sequence - - openssl nseq -in nseq.pem -out certs.pem - -Create a Netscape certificate sequence - - openssl nseq -in certs.pem -toseq -out nseq.pem - -=head1 NOTES - -The B<PEM> encoded form uses the same headers and footers as a certificate: - - -----BEGIN CERTIFICATE----- - -----END CERTIFICATE----- - -A Netscape certificate sequence is a Netscape specific form that can be sent -to browsers as an alternative to the standard PKCS#7 format when several -certificates are sent to the browser: for example during certificate enrollment. -It is used by Netscape certificate server for example. - -=head1 BUGS - -This program needs a few more options: like allowing DER or PEM input and -output files and allowing multiple certificate files to be used. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/ocsp.pod b/sys/src/ape/lib/openssl/doc/apps/ocsp.pod deleted file mode 100644 index 4f266058e..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/ocsp.pod +++ /dev/null @@ -1,365 +0,0 @@ -=pod - -=head1 NAME - -ocsp - Online Certificate Status Protocol utility - -=head1 SYNOPSIS - -B<openssl> B<ocsp> -[B<-out file>] -[B<-issuer file>] -[B<-cert file>] -[B<-serial n>] -[B<-signer file>] -[B<-signkey file>] -[B<-sign_other file>] -[B<-no_certs>] -[B<-req_text>] -[B<-resp_text>] -[B<-text>] -[B<-reqout file>] -[B<-respout file>] -[B<-reqin file>] -[B<-respin file>] -[B<-nonce>] -[B<-no_nonce>] -[B<-url URL>] -[B<-host host:n>] -[B<-path>] -[B<-CApath dir>] -[B<-CAfile file>] -[B<-VAfile file>] -[B<-validity_period n>] -[B<-status_age n>] -[B<-noverify>] -[B<-verify_other file>] -[B<-trust_other>] -[B<-no_intern>] -[B<-no_signature_verify>] -[B<-no_cert_verify>] -[B<-no_chain>] -[B<-no_cert_checks>] -[B<-port num>] -[B<-index file>] -[B<-CA file>] -[B<-rsigner file>] -[B<-rkey file>] -[B<-rother file>] -[B<-resp_no_certs>] -[B<-nmin n>] -[B<-ndays n>] -[B<-resp_key_id>] -[B<-nrequest n>] - -=head1 DESCRIPTION - -The Online Certificate Status Protocol (OCSP) enables applications to -determine the (revocation) state of an identified certificate (RFC 2560). - -The B<ocsp> command performs many common OCSP tasks. It can be used -to print out requests and responses, create requests and send queries -to an OCSP responder and behave like a mini OCSP server itself. - -=head1 OCSP CLIENT OPTIONS - -=over 4 - -=item B<-out filename> - -specify output filename, default is standard output. - -=item B<-issuer filename> - -This specifies the current issuer certificate. This option can be used -multiple times. The certificate specified in B<filename> must be in -PEM format. - -=item B<-cert filename> - -Add the certificate B<filename> to the request. The issuer certificate -is taken from the previous B<issuer> option, or an error occurs if no -issuer certificate is specified. - -=item B<-serial num> - -Same as the B<cert> option except the certificate with serial number -B<num> is added to the request. The serial number is interpreted as a -decimal integer unless preceded by B<0x>. Negative integers can also -be specified by preceding the value by a B<-> sign. - -=item B<-signer filename>, B<-signkey filename> - -Sign the OCSP request using the certificate specified in the B<signer> -option and the private key specified by the B<signkey> option. If -the B<signkey> option is not present then the private key is read -from the same file as the certificate. If neither option is specified then -the OCSP request is not signed. - -=item B<-sign_other filename> - -Additional certificates to include in the signed request. - -=item B<-nonce>, B<-no_nonce> - -Add an OCSP nonce extension to a request or disable OCSP nonce addition. -Normally if an OCSP request is input using the B<respin> option no -nonce is added: using the B<nonce> option will force addition of a nonce. -If an OCSP request is being created (using B<cert> and B<serial> options) -a nonce is automatically added specifying B<no_nonce> overrides this. - -=item B<-req_text>, B<-resp_text>, B<-text> - -print out the text form of the OCSP request, response or both respectively. - -=item B<-reqout file>, B<-respout file> - -write out the DER encoded certificate request or response to B<file>. - -=item B<-reqin file>, B<-respin file> - -read OCSP request or response file from B<file>. These option are ignored -if OCSP request or response creation is implied by other options (for example -with B<serial>, B<cert> and B<host> options). - -=item B<-url responder_url> - -specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can be specified. - -=item B<-host hostname:port>, B<-path pathname> - -if the B<host> option is present then the OCSP request is sent to the host -B<hostname> on port B<port>. B<path> specifies the HTTP path name to use -or "/" by default. - -=item B<-CAfile file>, B<-CApath pathname> - -file or pathname containing trusted CA certificates. These are used to verify -the signature on the OCSP response. - -=item B<-verify_other file> - -file containing additional certificates to search when attempting to locate -the OCSP response signing certificate. Some responders omit the actual signer's -certificate from the response: this option can be used to supply the necessary -certificate in such cases. - -=item B<-trust_other> - -the certificates specified by the B<-verify_certs> option should be explicitly -trusted and no additional checks will be performed on them. This is useful -when the complete responder certificate chain is not available or trusting a -root CA is not appropriate. - -=item B<-VAfile file> - -file containing explicitly trusted responder certificates. Equivalent to the -B<-verify_certs> and B<-trust_other> options. - -=item B<-noverify> - -don't attempt to verify the OCSP response signature or the nonce values. This -option will normally only be used for debugging since it disables all verification -of the responders certificate. - -=item B<-no_intern> - -ignore certificates contained in the OCSP response when searching for the -signers certificate. With this option the signers certificate must be specified -with either the B<-verify_certs> or B<-VAfile> options. - -=item B<-no_signature_verify> - -don't check the signature on the OCSP response. Since this option tolerates invalid -signatures on OCSP responses it will normally only be used for testing purposes. - -=item B<-no_cert_verify> - -don't verify the OCSP response signers certificate at all. Since this option allows -the OCSP response to be signed by any certificate it should only be used for -testing purposes. - -=item B<-no_chain> - -do not use certificates in the response as additional untrusted CA -certificates. - -=item B<-no_cert_checks> - -don't perform any additional checks on the OCSP response signers certificate. -That is do not make any checks to see if the signers certificate is authorised -to provide the necessary status information: as a result this option should -only be used for testing purposes. - -=item B<-validity_period nsec>, B<-status_age age> - -these options specify the range of times, in seconds, which will be tolerated -in an OCSP response. Each certificate status response includes a B<notBefore> time and -an optional B<notAfter> time. The current time should fall between these two values, but -the interval between the two times may be only a few seconds. In practice the OCSP -responder and clients clocks may not be precisely synchronised and so such a check -may fail. To avoid this the B<-validity_period> option can be used to specify an -acceptable error range in seconds, the default value is 5 minutes. - -If the B<notAfter> time is omitted from a response then this means that new status -information is immediately available. In this case the age of the B<notBefore> field -is checked to see it is not older than B<age> seconds old. By default this additional -check is not performed. - -=back - -=head1 OCSP SERVER OPTIONS - -=over 4 - -=item B<-index indexfile> - -B<indexfile> is a text index file in B<ca> format containing certificate revocation -information. - -If the B<index> option is specified the B<ocsp> utility is in responder mode, otherwise -it is in client mode. The request(s) the responder processes can be either specified on -the command line (using B<issuer> and B<serial> options), supplied in a file (using the -B<respin> option) or via external OCSP clients (if B<port> or B<url> is specified). - -If the B<index> option is present then the B<CA> and B<rsigner> options must also be -present. - -=item B<-CA file> - -CA certificate corresponding to the revocation information in B<indexfile>. - -=item B<-rsigner file> - -The certificate to sign OCSP responses with. - -=item B<-rother file> - -Additional certificates to include in the OCSP response. - -=item B<-resp_no_certs> - -Don't include any certificates in the OCSP response. - -=item B<-resp_key_id> - -Identify the signer certificate using the key ID, default is to use the subject name. - -=item B<-rkey file> - -The private key to sign OCSP responses with: if not present the file specified in the -B<rsigner> option is used. - -=item B<-port portnum> - -Port to listen for OCSP requests on. The port may also be specified using the B<url> -option. - -=item B<-nrequest number> - -The OCSP server will exit after receiving B<number> requests, default unlimited. - -=item B<-nmin minutes>, B<-ndays days> - -Number of minutes or days when fresh revocation information is available: used in the -B<nextUpdate> field. If neither option is present then the B<nextUpdate> field is -omitted meaning fresh revocation information is immediately available. - -=back - -=head1 OCSP Response verification. - -OCSP Response follows the rules specified in RFC2560. - -Initially the OCSP responder certificate is located and the signature on -the OCSP request checked using the responder certificate's public key. - -Then a normal certificate verify is performed on the OCSP responder certificate -building up a certificate chain in the process. The locations of the trusted -certificates used to build the chain can be specified by the B<CAfile> -and B<CApath> options or they will be looked for in the standard OpenSSL -certificates directory. - -If the initial verify fails then the OCSP verify process halts with an -error. - -Otherwise the issuing CA certificate in the request is compared to the OCSP -responder certificate: if there is a match then the OCSP verify succeeds. - -Otherwise the OCSP responder certificate's CA is checked against the issuing -CA certificate in the request. If there is a match and the OCSPSigning -extended key usage is present in the OCSP responder certificate then the -OCSP verify succeeds. - -Otherwise the root CA of the OCSP responders CA is checked to see if it -is trusted for OCSP signing. If it is the OCSP verify succeeds. - -If none of these checks is successful then the OCSP verify fails. - -What this effectively means if that if the OCSP responder certificate is -authorised directly by the CA it is issuing revocation information about -(and it is correctly configured) then verification will succeed. - -If the OCSP responder is a "global responder" which can give details about -multiple CAs and has its own separate certificate chain then its root -CA can be trusted for OCSP signing. For example: - - openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem - -Alternatively the responder certificate itself can be explicitly trusted -with the B<-VAfile> option. - -=head1 NOTES - -As noted, most of the verify options are for testing or debugging purposes. -Normally only the B<-CApath>, B<-CAfile> and (if the responder is a 'global -VA') B<-VAfile> options need to be used. - -The OCSP server is only useful for test and demonstration purposes: it is -not really usable as a full OCSP responder. It contains only a very -simple HTTP request handling and can only handle the POST form of OCSP -queries. It also handles requests serially meaning it cannot respond to -new requests until it has processed the current one. The text index file -format of revocation is also inefficient for large quantities of revocation -data. - -It is possible to run the B<ocsp> application in responder mode via a CGI -script using the B<respin> and B<respout> options. - -=head1 EXAMPLES - -Create an OCSP request and write it to a file: - - openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der - -Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save the -response to a file and print it out in text form - - openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \ - -url http://ocsp.myhost.com/ -resp_text -respout resp.der - -Read in an OCSP response and print out text form: - - openssl ocsp -respin resp.der -text - -OCSP server on port 8888 using a standard B<ca> configuration, and a separate -responder certificate. All requests and responses are printed to a file. - - openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem - -text -out log.txt - -As above but exit after processing one request: - - openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem - -nrequest 1 - -Query status information using internally generated request: - - openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem - -issuer demoCA/cacert.pem -serial 1 - -Query status information using request read from a file, write response to a -second file. - - openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem - -reqin req.der -respout resp.der diff --git a/sys/src/ape/lib/openssl/doc/apps/openssl.pod b/sys/src/ape/lib/openssl/doc/apps/openssl.pod deleted file mode 100644 index 964cdf0f0..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/openssl.pod +++ /dev/null @@ -1,361 +0,0 @@ - -=pod - -=head1 NAME - -openssl - OpenSSL command line tool - -=head1 SYNOPSIS - -B<openssl> -I<command> -[ I<command_opts> ] -[ I<command_args> ] - -B<openssl> [ B<list-standard-commands> | B<list-message-digest-commands> | B<list-cipher-commands> ] - -B<openssl> B<no->I<XXX> [ I<arbitrary options> ] - -=head1 DESCRIPTION - -OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL -v2/v3) and Transport Layer Security (TLS v1) network protocols and related -cryptography standards required by them. - -The B<openssl> program is a command line tool for using the various -cryptography functions of OpenSSL's B<crypto> library from the shell. -It can be used for - - o Creation of RSA, DH and DSA key parameters - o Creation of X.509 certificates, CSRs and CRLs - o Calculation of Message Digests - o Encryption and Decryption with Ciphers - o SSL/TLS Client and Server Tests - o Handling of S/MIME signed or encrypted mail - -=head1 COMMAND SUMMARY - -The B<openssl> program provides a rich variety of commands (I<command> in the -SYNOPSIS above), each of which often has a wealth of options and arguments -(I<command_opts> and I<command_args> in the SYNOPSIS). - -The pseudo-commands B<list-standard-commands>, B<list-message-digest-commands>, -and B<list-cipher-commands> output a list (one entry per line) of the names -of all standard commands, message digest commands, or cipher commands, -respectively, that are available in the present B<openssl> utility. - -The pseudo-command B<no->I<XXX> tests whether a command of the -specified name is available. If no command named I<XXX> exists, it -returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1 -and prints I<XXX>. In both cases, the output goes to B<stdout> and -nothing is printed to B<stderr>. Additional command line arguments -are always ignored. Since for each cipher there is a command of the -same name, this provides an easy way for shell scripts to test for the -availability of ciphers in the B<openssl> program. (B<no->I<XXX> is -not able to detect pseudo-commands such as B<quit>, -B<list->I<...>B<-commands>, or B<no->I<XXX> itself.) - -=head2 STANDARD COMMANDS - -=over 10 - -=item L<B<asn1parse>|asn1parse(1)> - -Parse an ASN.1 sequence. - -=item L<B<ca>|ca(1)> - -Certificate Authority (CA) Management. - -=item L<B<ciphers>|ciphers(1)> - -Cipher Suite Description Determination. - -=item L<B<crl>|crl(1)> - -Certificate Revocation List (CRL) Management. - -=item L<B<crl2pkcs7>|crl2pkcs7(1)> - -CRL to PKCS#7 Conversion. - -=item L<B<dgst>|dgst(1)> - -Message Digest Calculation. - -=item B<dh> - -Diffie-Hellman Parameter Management. -Obsoleted by L<B<dhparam>|dhparam(1)>. - -=item L<B<dsa>|dsa(1)> - -DSA Data Management. - -=item L<B<dsaparam>|dsaparam(1)> - -DSA Parameter Generation. - -=item L<B<enc>|enc(1)> - -Encoding with Ciphers. - -=item L<B<errstr>|errstr(1)> - -Error Number to Error String Conversion. - -=item L<B<dhparam>|dhparam(1)> - -Generation and Management of Diffie-Hellman Parameters. - -=item B<gendh> - -Generation of Diffie-Hellman Parameters. -Obsoleted by L<B<dhparam>|dhparam(1)>. - -=item L<B<gendsa>|gendsa(1)> - -Generation of DSA Parameters. - -=item L<B<genrsa>|genrsa(1)> - -Generation of RSA Parameters. - -=item L<B<ocsp>|ocsp(1)> - -Online Certificate Status Protocol utility. - -=item L<B<passwd>|passwd(1)> - -Generation of hashed passwords. - -=item L<B<pkcs12>|pkcs12(1)> - -PKCS#12 Data Management. - -=item L<B<pkcs7>|pkcs7(1)> - -PKCS#7 Data Management. - -=item L<B<rand>|rand(1)> - -Generate pseudo-random bytes. - -=item L<B<req>|req(1)> - -X.509 Certificate Signing Request (CSR) Management. - -=item L<B<rsa>|rsa(1)> - -RSA Data Management. - -=item L<B<rsautl>|rsautl(1)> - -RSA utility for signing, verification, encryption, and decryption. - -=item L<B<s_client>|s_client(1)> - -This implements a generic SSL/TLS client which can establish a transparent -connection to a remote server speaking SSL/TLS. It's intended for testing -purposes only and provides only rudimentary interface functionality but -internally uses mostly all functionality of the OpenSSL B<ssl> library. - -=item L<B<s_server>|s_server(1)> - -This implements a generic SSL/TLS server which accepts connections from remote -clients speaking SSL/TLS. It's intended for testing purposes only and provides -only rudimentary interface functionality but internally uses mostly all -functionality of the OpenSSL B<ssl> library. It provides both an own command -line oriented protocol for testing SSL functions and a simple HTTP response -facility to emulate an SSL/TLS-aware webserver. - -=item L<B<s_time>|s_time(1)> - -SSL Connection Timer. - -=item L<B<sess_id>|sess_id(1)> - -SSL Session Data Management. - -=item L<B<smime>|smime(1)> - -S/MIME mail processing. - -=item L<B<speed>|speed(1)> - -Algorithm Speed Measurement. - -=item L<B<verify>|verify(1)> - -X.509 Certificate Verification. - -=item L<B<version>|version(1)> - -OpenSSL Version Information. - -=item L<B<x509>|x509(1)> - -X.509 Certificate Data Management. - -=back - -=head2 MESSAGE DIGEST COMMANDS - -=over 10 - -=item B<md2> - -MD2 Digest - -=item B<md5> - -MD5 Digest - -=item B<mdc2> - -MDC2 Digest - -=item B<rmd160> - -RMD-160 Digest - -=item B<sha> - -SHA Digest - -=item B<sha1> - -SHA-1 Digest - -=item B<sha224> - -SHA-224 Digest - -=item B<sha256> - -SHA-256 Digest - -=item B<sha384> - -SHA-384 Digest - -=item B<sha512> - -SHA-512 Digest - -=back - -=head2 ENCODING AND CIPHER COMMANDS - -=over 10 - -=item B<base64> - -Base64 Encoding - -=item B<bf bf-cbc bf-cfb bf-ecb bf-ofb> - -Blowfish Cipher - -=item B<cast cast-cbc> - -CAST Cipher - -=item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb> - -CAST5 Cipher - -=item B<des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ofb> - -DES Cipher - -=item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb> - -Triple-DES Cipher - -=item B<idea idea-cbc idea-cfb idea-ecb idea-ofb> - -IDEA Cipher - -=item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb> - -RC2 Cipher - -=item B<rc4> - -RC4 Cipher - -=item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb> - -RC5 Cipher - -=back - -=head1 PASS PHRASE ARGUMENTS - -Several commands accept password arguments, typically using B<-passin> -and B<-passout> for input and output passwords respectively. These allow -the password to be obtained from a variety of sources. Both of these -options take a single argument whose format is described below. If no -password argument is given and a password is required then the user is -prompted to enter one: this will typically be read from the current -terminal with echoing turned off. - -=over 10 - -=item B<pass:password> - -the actual password is B<password>. Since the password is visible -to utilities (like 'ps' under Unix) this form should only be used -where security is not important. - -=item B<env:var> - -obtain the password from the environment variable B<var>. Since -the environment of other processes is visible on certain platforms -(e.g. ps under certain Unix OSes) this option should be used with caution. - -=item B<file:pathname> - -the first line of B<pathname> is the password. If the same B<pathname> -argument is supplied to B<-passin> and B<-passout> arguments then the first -line will be used for the input password and the next line for the output -password. B<pathname> need not refer to a regular file: it could for example -refer to a device or named pipe. - -=item B<fd:number> - -read the password from the file descriptor B<number>. This can be used to -send the data via a pipe for example. - -=item B<stdin> - -read the password from standard input. - -=back - -=head1 SEE ALSO - -L<asn1parse(1)|asn1parse(1)>, L<ca(1)|ca(1)>, L<config(5)|config(5)>, -L<crl(1)|crl(1)>, L<crl2pkcs7(1)|crl2pkcs7(1)>, L<dgst(1)|dgst(1)>, -L<dhparam(1)|dhparam(1)>, L<dsa(1)|dsa(1)>, L<dsaparam(1)|dsaparam(1)>, -L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>, -L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>, -L<passwd(1)|passwd(1)>, -L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>, -L<rand(1)|rand(1)>, L<req(1)|req(1)>, L<rsa(1)|rsa(1)>, -L<rsautl(1)|rsautl(1)>, L<s_client(1)|s_client(1)>, -L<s_server(1)|s_server(1)>, L<s_time(1)|s_time(1)>, -L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>, -L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>, -L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)> - -=head1 HISTORY - -The openssl(1) document appeared in OpenSSL 0.9.2. -The B<list->I<XXX>B<-commands> pseudo-commands were added in OpenSSL 0.9.3; -the B<no->I<XXX> pseudo-commands were added in OpenSSL 0.9.5a. -For notes on the availability of other commands, see their individual -manual pages. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/passwd.pod b/sys/src/ape/lib/openssl/doc/apps/passwd.pod deleted file mode 100644 index f44982549..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/passwd.pod +++ /dev/null @@ -1,82 +0,0 @@ -=pod - -=head1 NAME - -passwd - compute password hashes - -=head1 SYNOPSIS - -B<openssl passwd> -[B<-crypt>] -[B<-1>] -[B<-apr1>] -[B<-salt> I<string>] -[B<-in> I<file>] -[B<-stdin>] -[B<-noverify>] -[B<-quiet>] -[B<-table>] -{I<password>} - -=head1 DESCRIPTION - -The B<passwd> command computes the hash of a password typed at -run-time or the hash of each password in a list. The password list is -taken from the named file for option B<-in file>, from stdin for -option B<-stdin>, or from the command line, or from the terminal otherwise. -The Unix standard algorithm B<crypt> and the MD5-based BSD password -algorithm B<1> and its Apache variant B<apr1> are available. - -=head1 OPTIONS - -=over 4 - -=item B<-crypt> - -Use the B<crypt> algorithm (default). - -=item B<-1> - -Use the MD5 based BSD password algorithm B<1>. - -=item B<-apr1> - -Use the B<apr1> algorithm (Apache variant of the BSD algorithm). - -=item B<-salt> I<string> - -Use the specified salt. -When reading a password from the terminal, this implies B<-noverify>. - -=item B<-in> I<file> - -Read passwords from I<file>. - -=item B<-stdin> - -Read passwords from B<stdin>. - -=item B<-noverify> - -Don't verify when reading a password from the terminal. - -=item B<-quiet> - -Don't output warnings when passwords given at the command line are truncated. - -=item B<-table> - -In the output list, prepend the cleartext password and a TAB character -to each password hash. - -=back - -=head1 EXAMPLES - -B<openssl passwd -crypt -salt xx password> prints B<xxj31ZMTZzkVA>. - -B<openssl passwd -1 -salt xxxxxxxx password> prints B<$1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a.>. - -B<openssl passwd -apr1 -salt xxxxxxxx password> prints B<$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0>. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/pkcs12.pod b/sys/src/ape/lib/openssl/doc/apps/pkcs12.pod deleted file mode 100644 index 7d8414629..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/pkcs12.pod +++ /dev/null @@ -1,330 +0,0 @@ - -=pod - -=head1 NAME - -pkcs12 - PKCS#12 file utility - -=head1 SYNOPSIS - -B<openssl> B<pkcs12> -[B<-export>] -[B<-chain>] -[B<-inkey filename>] -[B<-certfile filename>] -[B<-name name>] -[B<-caname name>] -[B<-in filename>] -[B<-out filename>] -[B<-noout>] -[B<-nomacver>] -[B<-nocerts>] -[B<-clcerts>] -[B<-cacerts>] -[B<-nokeys>] -[B<-info>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-nodes>] -[B<-noiter>] -[B<-maciter>] -[B<-twopass>] -[B<-descert>] -[B<-certpbe>] -[B<-keypbe>] -[B<-keyex>] -[B<-keysig>] -[B<-password arg>] -[B<-passin arg>] -[B<-passout arg>] -[B<-rand file(s)>] - -=head1 DESCRIPTION - -The B<pkcs12> command allows PKCS#12 files (sometimes referred to as -PFX files) to be created and parsed. PKCS#12 files are used by several -programs including Netscape, MSIE and MS Outlook. - -=head1 COMMAND OPTIONS - -There are a lot of options the meaning of some depends of whether a PKCS#12 file -is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12 -file can be created by using the B<-export> option (see below). - -=head1 PARSING OPTIONS - -=over 4 - -=item B<-in filename> - -This specifies filename of the PKCS#12 file to be parsed. Standard input is used -by default. - -=item B<-out filename> - -The filename to write certificates and private keys to, standard output by default. -They are all written in PEM format. - -=item B<-pass arg>, B<-passin arg> - -the PKCS#12 file (i.e. input file) password source. For more information about the -format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in -L<openssl(1)|openssl(1)>. - -=item B<-passout arg> - -pass phrase source to encrypt any outputed private keys with. For more information -about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in -L<openssl(1)|openssl(1)>. - -=item B<-noout> - -this option inhibits output of the keys and certificates to the output file version -of the PKCS#12 file. - -=item B<-clcerts> - -only output client certificates (not CA certificates). - -=item B<-cacerts> - -only output CA certificates (not client certificates). - -=item B<-nocerts> - -no certificates at all will be output. - -=item B<-nokeys> - -no private keys will be output. - -=item B<-info> - -output additional information about the PKCS#12 file structure, algorithms used and -iteration counts. - -=item B<-des> - -use DES to encrypt private keys before outputting. - -=item B<-des3> - -use triple DES to encrypt private keys before outputting, this is the default. - -=item B<-idea> - -use IDEA to encrypt private keys before outputting. - -=item B<-nodes> - -don't encrypt the private keys at all. - -=item B<-nomacver> - -don't attempt to verify the integrity MAC before reading the file. - -=item B<-twopass> - -prompt for separate integrity and encryption passwords: most software -always assumes these are the same so this option will render such -PKCS#12 files unreadable. - -=back - -=head1 FILE CREATION OPTIONS - -=over 4 - -=item B<-export> - -This option specifies that a PKCS#12 file will be created rather than -parsed. - -=item B<-out filename> - -This specifies filename to write the PKCS#12 file to. Standard output is used -by default. - -=item B<-in filename> - -The filename to read certificates and private keys from, standard input by default. -They must all be in PEM format. The order doesn't matter but one private key and -its corresponding certificate should be present. If additional certificates are -present they will also be included in the PKCS#12 file. - -=item B<-inkey filename> - -file to read private key from. If not present then a private key must be present -in the input file. - -=item B<-name friendlyname> - -This specifies the "friendly name" for the certificate and private key. This name -is typically displayed in list boxes by software importing the file. - -=item B<-certfile filename> - -A filename to read additional certificates from. - -=item B<-caname friendlyname> - -This specifies the "friendly name" for other certificates. This option may be -used multiple times to specify names for all certificates in the order they -appear. Netscape ignores friendly names on other certificates whereas MSIE -displays them. - -=item B<-pass arg>, B<-passout arg> - -the PKCS#12 file (i.e. output file) password source. For more information about -the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in -L<openssl(1)|openssl(1)>. - -=item B<-passin password> - -pass phrase source to decrypt any input private keys with. For more information -about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in -L<openssl(1)|openssl(1)>. - -=item B<-chain> - -if this option is present then an attempt is made to include the entire -certificate chain of the user certificate. The standard CA store is used -for this search. If the search fails it is considered a fatal error. - -=item B<-descert> - -encrypt the certificate using triple DES, this may render the PKCS#12 -file unreadable by some "export grade" software. By default the private -key is encrypted using triple DES and the certificate using 40 bit RC2. - -=item B<-keypbe alg>, B<-certpbe alg> - -these options allow the algorithm used to encrypt the private key and -certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms -can be selected it is advisable only to use PKCS#12 algorithms. See the list -in the B<NOTES> section for more information. - -=item B<-keyex|-keysig> - -specifies that the private key is to be used for key exchange or just signing. -This option is only interpreted by MSIE and similar MS software. Normally -"export grade" software will only allow 512 bit RSA keys to be used for -encryption purposes but arbitrary length keys for signing. The B<-keysig> -option marks the key for signing only. Signing only keys can be used for -S/MIME signing, authenticode (ActiveX control signing) and SSL client -authentication, however due to a bug only MSIE 5.0 and later support -the use of signing only keys for SSL client authentication. - -=item B<-nomaciter>, B<-noiter> - -these options affect the iteration counts on the MAC and key algorithms. -Unless you wish to produce files compatible with MSIE 4.0 you should leave -these options alone. - -To discourage attacks by using large dictionaries of common passwords the -algorithm that derives keys from passwords can have an iteration count applied -to it: this causes a certain part of the algorithm to be repeated and slows it -down. The MAC is used to check the file integrity but since it will normally -have the same password as the keys and certificates it could also be attacked. -By default both MAC and encryption iteration counts are set to 2048, using -these options the MAC and encryption iteration counts can be set to 1, since -this reduces the file security you should not use these options unless you -really have to. Most software supports both MAC and key iteration counts. -MSIE 4.0 doesn't support MAC iteration counts so it needs the B<-nomaciter> -option. - -=item B<-maciter> - -This option is included for compatibility with previous versions, it used -to be needed to use MAC iterations counts but they are now used by default. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=back - -=head1 NOTES - -Although there are a large number of options most of them are very rarely -used. For PKCS#12 file parsing only B<-in> and B<-out> need to be used -for PKCS#12 file creation B<-export> and B<-name> are also used. - -If none of the B<-clcerts>, B<-cacerts> or B<-nocerts> options are present -then all certificates will be output in the order they appear in the input -PKCS#12 files. There is no guarantee that the first certificate present is -the one corresponding to the private key. Certain software which requires -a private key and certificate and assumes the first certificate in the -file is the one corresponding to the private key: this may not always -be the case. Using the B<-clcerts> option will solve this problem by only -outputting the certificate corresponding to the private key. If the CA -certificates are required then they can be output to a separate file using -the B<-nokeys -cacerts> options to just output CA certificates. - -The B<-keypbe> and B<-certpbe> algorithms allow the precise encryption -algorithms for private keys and certificates to be specified. Normally -the defaults are fine but occasionally software can't handle triple DES -encrypted private keys, then the option B<-keypbe PBE-SHA1-RC2-40> can -be used to reduce the private key encryption to 40 bit RC2. A complete -description of all algorithms is contained in the B<pkcs8> manual page. - -=head1 EXAMPLES - -Parse a PKCS#12 file and output it to a file: - - openssl pkcs12 -in file.p12 -out file.pem - -Output only client certificates to a file: - - openssl pkcs12 -in file.p12 -clcerts -out file.pem - -Don't encrypt the private key: - - openssl pkcs12 -in file.p12 -out file.pem -nodes - -Print some info about a PKCS#12 file: - - openssl pkcs12 -in file.p12 -info -noout - -Create a PKCS#12 file: - - openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" - -Include some extra certificates: - - openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" \ - -certfile othercerts.pem - -=head1 BUGS - -Some would argue that the PKCS#12 standard is one big bug :-) - -Versions of OpenSSL before 0.9.6a had a bug in the PKCS#12 key generation -routines. Under rare circumstances this could produce a PKCS#12 file encrypted -with an invalid key. As a result some PKCS#12 files which triggered this bug -from other implementations (MSIE or Netscape) could not be decrypted -by OpenSSL and similarly OpenSSL could produce PKCS#12 files which could -not be decrypted by other implementations. The chances of producing such -a file are relatively small: less than 1 in 256. - -A side effect of fixing this bug is that any old invalidly encrypted PKCS#12 -files cannot no longer be parsed by the fixed version. Under such circumstances -the B<pkcs12> utility will report that the MAC is OK but fail with a decryption -error when extracting private keys. - -This problem can be resolved by extracting the private keys and certificates -from the PKCS#12 file using an older version of OpenSSL and recreating the PKCS#12 -file from the keys and certificates using a newer version of OpenSSL. For example: - - old-openssl -in bad.p12 -out keycerts.pem - openssl -in keycerts.pem -export -name "My PKCS#12 file" -out fixed.p12 - -=head1 SEE ALSO - -L<pkcs8(1)|pkcs8(1)> - diff --git a/sys/src/ape/lib/openssl/doc/apps/pkcs7.pod b/sys/src/ape/lib/openssl/doc/apps/pkcs7.pod deleted file mode 100644 index a0a636328..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/pkcs7.pod +++ /dev/null @@ -1,105 +0,0 @@ -=pod - -=head1 NAME - -pkcs7 - PKCS#7 utility - -=head1 SYNOPSIS - -B<openssl> B<pkcs7> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-out filename>] -[B<-print_certs>] -[B<-text>] -[B<-noout>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<pkcs7> command processes PKCS#7 files in DER or PEM format. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. B<DER> format is DER encoded PKCS#7 -v1.5 structure.B<PEM> (the default) is a base64 encoded version of -the DER form with header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read from or standard input if this -option is not specified. - -=item B<-out filename> - -specifies the output filename to write to or standard output by -default. - -=item B<-print_certs> - -prints out any certificates or CRLs contained in the file. They are -preceded by their subject and issuer names in one line format. - -=item B<-text> - -prints out certificates details in full rather than just subject and -issuer names. - -=item B<-noout> - -don't output the encoded version of the PKCS#7 structure (or certificates -is B<-print_certs> is set). - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 EXAMPLES - -Convert a PKCS#7 file from PEM to DER: - - openssl pkcs7 -in file.pem -outform DER -out file.der - -Output all certificates in a file: - - openssl pkcs7 -in file.pem -print_certs -out certs.pem - -=head1 NOTES - -The PEM PKCS#7 format uses the header and footer lines: - - -----BEGIN PKCS7----- - -----END PKCS7----- - -For compatibility with some CAs it will also accept: - - -----BEGIN CERTIFICATE----- - -----END CERTIFICATE----- - -=head1 RESTRICTIONS - -There is no option to print out all the fields of a PKCS#7 file. - -This PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC2315 they -cannot currently parse, for example, the new CMS as described in RFC2630. - -=head1 SEE ALSO - -L<crl2pkcs7(1)|crl2pkcs7(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/pkcs8.pod b/sys/src/ape/lib/openssl/doc/apps/pkcs8.pod deleted file mode 100644 index 68ecd65b1..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/pkcs8.pod +++ /dev/null @@ -1,243 +0,0 @@ -=pod - -=head1 NAME - -pkcs8 - PKCS#8 format private key conversion tool - -=head1 SYNOPSIS - -B<openssl> B<pkcs8> -[B<-topk8>] -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-passin arg>] -[B<-out filename>] -[B<-passout arg>] -[B<-noiter>] -[B<-nocrypt>] -[B<-nooct>] -[B<-embed>] -[B<-nsdb>] -[B<-v2 alg>] -[B<-v1 alg>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<pkcs8> command processes private keys in PKCS#8 format. It can handle -both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo -format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-topk8> - -Normally a PKCS#8 private key is expected on input and a traditional format -private key will be written. With the B<-topk8> option the situation is -reversed: it reads a traditional format private key and writes a PKCS#8 -format key. - -=item B<-inform DER|PEM> - -This specifies the input format. If a PKCS#8 format key is expected on input -then either a B<DER> or B<PEM> encoded version of a PKCS#8 key will be -expected. Otherwise the B<DER> or B<PEM> format of the traditional format -private key is used. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a key from or standard input if this -option is not specified. If the key is encrypted a pass phrase will be -prompted for. - -=item B<-passin arg> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-out filename> - -This specifies the output filename to write a key to or standard output by -default. If any encryption options are set then a pass phrase will be -prompted for. The output filename should B<not> be the same as the input -filename. - -=item B<-passout arg> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-nocrypt> - -PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo -structures using an appropriate password based encryption algorithm. With -this option an unencrypted PrivateKeyInfo structure is expected or output. -This option does not encrypt private keys at all and should only be used -when absolutely necessary. Certain software such as some versions of Java -code signing software used unencrypted private keys. - -=item B<-nooct> - -This option generates RSA private keys in a broken format that some software -uses. Specifically the private key should be enclosed in a OCTET STRING -but some software just includes the structure itself without the -surrounding OCTET STRING. - -=item B<-embed> - -This option generates DSA keys in a broken format. The DSA parameters are -embedded inside the PrivateKey structure. In this form the OCTET STRING -contains an ASN1 SEQUENCE consisting of two structures: a SEQUENCE containing -the parameters and an ASN1 INTEGER containing the private key. - -=item B<-nsdb> - -This option generates DSA keys in a broken format compatible with Netscape -private key databases. The PrivateKey contains a SEQUENCE consisting of -the public and private keys respectively. - -=item B<-v2 alg> - -This option enables the use of PKCS#5 v2.0 algorithms. Normally PKCS#8 -private keys are encrypted with the password based encryption algorithm -called B<pbeWithMD5AndDES-CBC> this uses 56 bit DES encryption but it -was the strongest encryption algorithm supported in PKCS#5 v1.5. Using -the B<-v2> option PKCS#5 v2.0 algorithms are used which can use any -encryption algorithm such as 168 bit triple DES or 128 bit RC2 however -not many implementations support PKCS#5 v2.0 yet. If you are just using -private keys with OpenSSL then this doesn't matter. - -The B<alg> argument is the encryption algorithm to use, valid values include -B<des>, B<des3> and B<rc2>. It is recommended that B<des3> is used. - -=item B<-v1 alg> - -This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. A complete -list of possible algorithms is included below. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -The encrypted form of a PEM encode PKCS#8 files uses the following -headers and footers: - - -----BEGIN ENCRYPTED PRIVATE KEY----- - -----END ENCRYPTED PRIVATE KEY----- - -The unencrypted form uses: - - -----BEGIN PRIVATE KEY----- - -----END PRIVATE KEY----- - -Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration -counts are more secure that those encrypted using the traditional -SSLeay compatible formats. So if additional security is considered -important the keys should be converted. - -The default encryption is only 56 bits because this is the encryption -that most current implementations of PKCS#8 will support. - -Some software may use PKCS#12 password based encryption algorithms -with PKCS#8 format private keys: these are handled automatically -but there is no option to produce them. - -It is possible to write out DER encoded encrypted private keys in -PKCS#8 format because the encryption details are included at an ASN1 -level whereas the traditional format includes them at a PEM level. - -=head1 PKCS#5 v1.5 and PKCS#12 algorithms. - -Various algorithms can be used with the B<-v1> command line option, -including PKCS#5 v1.5 and PKCS#12. These are described in more detail -below. - -=over 4 - -=item B<PBE-MD2-DES PBE-MD5-DES> - -These algorithms were included in the original PKCS#5 v1.5 specification. -They only offer 56 bits of protection since they both use DES. - -=item B<PBE-SHA1-RC2-64 PBE-MD2-RC2-64 PBE-MD5-RC2-64 PBE-SHA1-DES> - -These algorithms are not mentioned in the original PKCS#5 v1.5 specification -but they use the same key derivation algorithm and are supported by some -software. They are mentioned in PKCS#5 v2.0. They use either 64 bit RC2 or -56 bit DES. - -=item B<PBE-SHA1-RC4-128 PBE-SHA1-RC4-40 PBE-SHA1-3DES PBE-SHA1-2DES PBE-SHA1-RC2-128 PBE-SHA1-RC2-40> - -These algorithms use the PKCS#12 password based encryption algorithm and -allow strong encryption algorithms like triple DES or 128 bit RC2 to be used. - -=back - -=head1 EXAMPLES - -Convert a private from traditional to PKCS#5 v2.0 format using triple -DES: - - openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem - -Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm -(DES): - - openssl pkcs8 -in key.pem -topk8 -out enckey.pem - -Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm -(3DES): - - openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES - -Read a DER unencrypted PKCS#8 format private key: - - openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem - -Convert a private key from any PKCS#8 format to traditional format: - - openssl pkcs8 -in pk8.pem -out key.pem - -=head1 STANDARDS - -Test vectors from this PKCS#5 v2.0 implementation were posted to the -pkcs-tng mailing list using triple DES, DES and RC2 with high iteration -counts, several people confirmed that they could decrypt the private -keys produced and Therefore it can be assumed that the PKCS#5 v2.0 -implementation is reasonably accurate at least as far as these -algorithms are concerned. - -The format of PKCS#8 DSA (and other) private keys is not well documented: -it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default DSA -PKCS#8 private key format complies with this standard. - -=head1 BUGS - -There should be an option that prints out the encryption algorithm -in use and other details such as the iteration count. - -PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private -key format for OpenSSL: for compatibility several of the utilities use -the old format at present. - -=head1 SEE ALSO - -L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)>, -L<gendsa(1)|gendsa(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/rand.pod b/sys/src/ape/lib/openssl/doc/apps/rand.pod deleted file mode 100644 index 75745ca00..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/rand.pod +++ /dev/null @@ -1,50 +0,0 @@ -=pod - -=head1 NAME - -rand - generate pseudo-random bytes - -=head1 SYNOPSIS - -B<openssl rand> -[B<-out> I<file>] -[B<-rand> I<file(s)>] -[B<-base64>] -I<num> - -=head1 DESCRIPTION - -The B<rand> command outputs I<num> pseudo-random bytes after seeding -the random number generator once. As in other B<openssl> command -line tools, PRNG seeding uses the file I<$HOME/>B<.rnd> or B<.rnd> -in addition to the files given in the B<-rand> option. A new -I<$HOME>/B<.rnd> or B<.rnd> file will be written back if enough -seeding was obtained from these sources. - -=head1 OPTIONS - -=over 4 - -=item B<-out> I<file> - -Write to I<file> instead of standard output. - -=item B<-rand> I<file(s)> - -Use specified file or files or EGD socket (see L<RAND_egd(3)|RAND_egd(3)>) -for seeding the random number generator. -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<-base64> - -Perform base64 encoding on the output. - -=back - -=head1 SEE ALSO - -L<RAND_bytes(3)|RAND_bytes(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/req.pod b/sys/src/ape/lib/openssl/doc/apps/req.pod deleted file mode 100644 index 82b565c9d..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/req.pod +++ /dev/null @@ -1,611 +0,0 @@ - -=pod - -=head1 NAME - -req - PKCS#10 certificate request and certificate generating utility. - -=head1 SYNOPSIS - -B<openssl> B<req> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-passin arg>] -[B<-out filename>] -[B<-passout arg>] -[B<-text>] -[B<-pubkey>] -[B<-noout>] -[B<-verify>] -[B<-modulus>] -[B<-new>] -[B<-rand file(s)>] -[B<-newkey rsa:bits>] -[B<-newkey dsa:file>] -[B<-nodes>] -[B<-key filename>] -[B<-keyform PEM|DER>] -[B<-keyout filename>] -[B<-[md5|sha1|md2|mdc2]>] -[B<-config filename>] -[B<-subj arg>] -[B<-multivalue-rdn>] -[B<-x509>] -[B<-days n>] -[B<-set_serial n>] -[B<-asn1-kludge>] -[B<-newhdr>] -[B<-extensions section>] -[B<-reqexts section>] -[B<-utf8>] -[B<-nameopt>] -[B<-batch>] -[B<-verbose>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<req> command primarily creates and processes certificate requests -in PKCS#10 format. It can additionally create self signed certificates -for use as root CAs for example. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option uses an ASN1 DER encoded -form compatible with the PKCS#10. The B<PEM> form is the default format: it -consists of the B<DER> format base64 encoded with additional header and -footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a request from or standard input -if this option is not specified. A request is only read if the creation -options (B<-new> and B<-newkey>) are not specified. - -=item B<-passin arg> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-out filename> - -This specifies the output filename to write to or standard output by -default. - -=item B<-passout arg> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-text> - -prints out the certificate request in text form. - -=item B<-pubkey> - -outputs the public key. - -=item B<-noout> - -this option prevents output of the encoded version of the request. - -=item B<-modulus> - -this option prints out the value of the modulus of the public key -contained in the request. - -=item B<-verify> - -verifies the signature on the request. - -=item B<-new> - -this option generates a new certificate request. It will prompt -the user for the relevant field values. The actual fields -prompted for and their maximum and minimum sizes are specified -in the configuration file and any requested extensions. - -If the B<-key> option is not used it will generate a new RSA private -key using information specified in the configuration file. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<-newkey arg> - -this option creates a new certificate request and a new private -key. The argument takes one of two forms. B<rsa:nbits>, where -B<nbits> is the number of bits, generates an RSA key B<nbits> -in size. B<dsa:filename> generates a DSA key using the parameters -in the file B<filename>. - -=item B<-key filename> - -This specifies the file to read the private key from. It also -accepts PKCS#8 format private keys for PEM format files. - -=item B<-keyform PEM|DER> - -the format of the private key file specified in the B<-key> -argument. PEM is the default. - -=item B<-keyout filename> - -this gives the filename to write the newly created private key to. -If this option is not specified then the filename present in the -configuration file is used. - -=item B<-nodes> - -if this option is specified then if a private key is created it -will not be encrypted. - -=item B<-[md5|sha1|md2|mdc2]> - -this specifies the message digest to sign the request with. This -overrides the digest algorithm specified in the configuration file. -This option is ignored for DSA requests: they always use SHA1. - -=item B<-config filename> - -this allows an alternative configuration file to be specified, -this overrides the compile time filename or any specified in -the B<OPENSSL_CONF> environment variable. - -=item B<-subj arg> - -sets subject name for new request or supersedes the subject name -when processing a request. -The arg must be formatted as I</type0=value0/type1=value1/type2=...>, -characters may be escaped by \ (backslash), no spaces are skipped. - -=item B<-multivalue-rdn> - -this option causes the -subj argument to be interpreted with full -support for multivalued RDNs. Example: - -I</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe> - -If -multi-rdn is not used then the UID value is I<123456+CN=John Doe>. - -=item B<-x509> - -this option outputs a self signed certificate instead of a certificate -request. This is typically used to generate a test certificate or -a self signed root CA. The extensions added to the certificate -(if any) are specified in the configuration file. Unless specified -using the B<set_serial> option B<0> will be used for the serial -number. - -=item B<-days n> - -when the B<-x509> option is being used this specifies the number of -days to certify the certificate for. The default is 30 days. - -=item B<-set_serial n> - -serial number to use when outputting a self signed certificate. This -may be specified as a decimal value or a hex value if preceded by B<0x>. -It is possible to use negative serial numbers but this is not recommended. - -=item B<-extensions section> - -=item B<-reqexts section> - -these options specify alternative sections to include certificate -extensions (if the B<-x509> option is present) or certificate -request extensions. This allows several different sections to -be used in the same configuration file to specify requests for -a variety of purposes. - -=item B<-utf8> - -this option causes field values to be interpreted as UTF8 strings, by -default they are interpreted as ASCII. This means that the field -values, whether prompted from a terminal or obtained from a -configuration file, must be valid UTF8 strings. - -=item B<-nameopt option> - -option which determines how the subject or issuer names are displayed. The -B<option> argument can be a single option or multiple options separated by -commas. Alternatively the B<-nameopt> switch may be used more than once to -set multiple options. See the L<x509(1)|x509(1)> manual page for details. - -=item B<-asn1-kludge> - -by default the B<req> command outputs certificate requests containing -no attributes in the correct PKCS#10 format. However certain CAs will only -accept requests containing no attributes in an invalid form: this -option produces this invalid format. - -More precisely the B<Attributes> in a PKCS#10 certificate request -are defined as a B<SET OF Attribute>. They are B<not OPTIONAL> so -if no attributes are present then they should be encoded as an -empty B<SET OF>. The invalid form does not include the empty -B<SET OF> whereas the correct form does. - -It should be noted that very few CAs still require the use of this option. - -=item B<-newhdr> - -Adds the word B<NEW> to the PEM file header and footer lines on the outputed -request. Some software (Netscape certificate server) and some CAs need this. - -=item B<-batch> - -non-interactive mode. - -=item B<-verbose> - -print extra details about the operations being performed. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 CONFIGURATION FILE FORMAT - -The configuration options are specified in the B<req> section of -the configuration file. As with all configuration files if no -value is specified in the specific section (i.e. B<req>) then -the initial unnamed or B<default> section is searched too. - -The options available are described in detail below. - -=over 4 - -=item B<input_password output_password> - -The passwords for the input private key file (if present) and -the output private key file (if one will be created). The -command line options B<passin> and B<passout> override the -configuration file values. - -=item B<default_bits> - -This specifies the default key size in bits. If not specified then -512 is used. It is used if the B<-new> option is used. It can be -overridden by using the B<-newkey> option. - -=item B<default_keyfile> - -This is the default filename to write a private key to. If not -specified the key is written to standard output. This can be -overridden by the B<-keyout> option. - -=item B<oid_file> - -This specifies a file containing additional B<OBJECT IDENTIFIERS>. -Each line of the file should consist of the numerical form of the -object identifier followed by white space then the short name followed -by white space and finally the long name. - -=item B<oid_section> - -This specifies a section in the configuration file containing extra -object identifiers. Each line should consist of the short name of the -object identifier followed by B<=> and the numerical form. The short -and long names are the same when this option is used. - -=item B<RANDFILE> - -This specifies a filename in which random number seed information is -placed and read from, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -It is used for private key generation. - -=item B<encrypt_key> - -If this is set to B<no> then if a private key is generated it is -B<not> encrypted. This is equivalent to the B<-nodes> command line -option. For compatibility B<encrypt_rsa_key> is an equivalent option. - -=item B<default_md> - -This option specifies the digest algorithm to use. Possible values -include B<md5 sha1 mdc2>. If not present then MD5 is used. This -option can be overridden on the command line. - -=item B<string_mask> - -This option masks out the use of certain string types in certain -fields. Most users will not need to change this option. - -It can be set to several values B<default> which is also the default -option uses PrintableStrings, T61Strings and BMPStrings if the -B<pkix> value is used then only PrintableStrings and BMPStrings will -be used. This follows the PKIX recommendation in RFC2459. If the -B<utf8only> option is used then only UTF8Strings will be used: this -is the PKIX recommendation in RFC2459 after 2003. Finally the B<nombstr> -option just uses PrintableStrings and T61Strings: certain software has -problems with BMPStrings and UTF8Strings: in particular Netscape. - -=item B<req_extensions> - -this specifies the configuration file section containing a list of -extensions to add to the certificate request. It can be overridden -by the B<-reqexts> command line switch. - -=item B<x509_extensions> - -this specifies the configuration file section containing a list of -extensions to add to certificate generated when the B<-x509> switch -is used. It can be overridden by the B<-extensions> command line switch. - -=item B<prompt> - -if set to the value B<no> this disables prompting of certificate fields -and just takes values from the config file directly. It also changes the -expected format of the B<distinguished_name> and B<attributes> sections. - -=item B<utf8> - -if set to the value B<yes> then field values to be interpreted as UTF8 -strings, by default they are interpreted as ASCII. This means that -the field values, whether prompted from a terminal or obtained from a -configuration file, must be valid UTF8 strings. - -=item B<attributes> - -this specifies the section containing any request attributes: its format -is the same as B<distinguished_name>. Typically these may contain the -challengePassword or unstructuredName types. They are currently ignored -by OpenSSL's request signing utilities but some CAs might want them. - -=item B<distinguished_name> - -This specifies the section containing the distinguished name fields to -prompt for when generating a certificate or certificate request. The format -is described in the next section. - -=back - -=head1 DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT - -There are two separate formats for the distinguished name and attribute -sections. If the B<prompt> option is set to B<no> then these sections -just consist of field names and values: for example, - - CN=My Name - OU=My Organization - emailAddress=someone@somewhere.org - -This allows external programs (e.g. GUI based) to generate a template file -with all the field names and values and just pass it to B<req>. An example -of this kind of configuration file is contained in the B<EXAMPLES> section. - -Alternatively if the B<prompt> option is absent or not set to B<no> then the -file contains field prompting information. It consists of lines of the form: - - fieldName="prompt" - fieldName_default="default field value" - fieldName_min= 2 - fieldName_max= 4 - -"fieldName" is the field name being used, for example commonName (or CN). -The "prompt" string is used to ask the user to enter the relevant -details. If the user enters nothing then the default value is used if no -default value is present then the field is omitted. A field can -still be omitted if a default value is present if the user just -enters the '.' character. - -The number of characters entered must be between the fieldName_min and -fieldName_max limits: there may be additional restrictions based -on the field being used (for example countryName can only ever be -two characters long and must fit in a PrintableString). - -Some fields (such as organizationName) can be used more than once -in a DN. This presents a problem because configuration files will -not recognize the same name occurring twice. To avoid this problem -if the fieldName contains some characters followed by a full stop -they will be ignored. So for example a second organizationName can -be input by calling it "1.organizationName". - -The actual permitted field names are any object identifier short or -long names. These are compiled into OpenSSL and include the usual -values such as commonName, countryName, localityName, organizationName, -organizationUnitName, stateOrProvinceName. Additionally emailAddress -is include as well as name, surname, givenName initials and dnQualifier. - -Additional object identifiers can be defined with the B<oid_file> or -B<oid_section> options in the configuration file. Any additional fields -will be treated as though they were a DirectoryString. - - -=head1 EXAMPLES - -Examine and verify certificate request: - - openssl req -in req.pem -text -verify -noout - -Create a private key and then generate a certificate request from it: - - openssl genrsa -out key.pem 1024 - openssl req -new -key key.pem -out req.pem - -The same but just using req: - - openssl req -newkey rsa:1024 -keyout key.pem -out req.pem - -Generate a self signed root certificate: - - openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem - -Example of a file pointed to by the B<oid_file> option: - - 1.2.3.4 shortName A longer Name - 1.2.3.6 otherName Other longer Name - -Example of a section pointed to by B<oid_section> making use of variable -expansion: - - testoid1=1.2.3.5 - testoid2=${testoid1}.6 - -Sample configuration file prompting for field values: - - [ req ] - default_bits = 1024 - default_keyfile = privkey.pem - distinguished_name = req_distinguished_name - attributes = req_attributes - x509_extensions = v3_ca - - dirstring_type = nobmp - - [ req_distinguished_name ] - countryName = Country Name (2 letter code) - countryName_default = AU - countryName_min = 2 - countryName_max = 2 - - localityName = Locality Name (eg, city) - - organizationalUnitName = Organizational Unit Name (eg, section) - - commonName = Common Name (eg, YOUR name) - commonName_max = 64 - - emailAddress = Email Address - emailAddress_max = 40 - - [ req_attributes ] - challengePassword = A challenge password - challengePassword_min = 4 - challengePassword_max = 20 - - [ v3_ca ] - - subjectKeyIdentifier=hash - authorityKeyIdentifier=keyid:always,issuer:always - basicConstraints = CA:true - -Sample configuration containing all field values: - - - RANDFILE = $ENV::HOME/.rnd - - [ req ] - default_bits = 1024 - default_keyfile = keyfile.pem - distinguished_name = req_distinguished_name - attributes = req_attributes - prompt = no - output_password = mypass - - [ req_distinguished_name ] - C = GB - ST = Test State or Province - L = Test Locality - O = Organization Name - OU = Organizational Unit Name - CN = Common Name - emailAddress = test@email.address - - [ req_attributes ] - challengePassword = A challenge password - - -=head1 NOTES - -The header and footer lines in the B<PEM> format are normally: - - -----BEGIN CERTIFICATE REQUEST----- - -----END CERTIFICATE REQUEST----- - -some software (some versions of Netscape certificate server) instead needs: - - -----BEGIN NEW CERTIFICATE REQUEST----- - -----END NEW CERTIFICATE REQUEST----- - -which is produced with the B<-newhdr> option but is otherwise compatible. -Either form is accepted transparently on input. - -The certificate requests generated by B<Xenroll> with MSIE have extensions -added. It includes the B<keyUsage> extension which determines the type of -key (signature only or general purpose) and any additional OIDs entered -by the script in an extendedKeyUsage extension. - -=head1 DIAGNOSTICS - -The following messages are frequently asked about: - - Using configuration from /some/path/openssl.cnf - Unable to load config info - -This is followed some time later by... - - unable to find 'distinguished_name' in config - problems making Certificate Request - -The first error message is the clue: it can't find the configuration -file! Certain operations (like examining a certificate request) don't -need a configuration file so its use isn't enforced. Generation of -certificates or requests however does need a configuration file. This -could be regarded as a bug. - -Another puzzling message is this: - - Attributes: - a0:00 - -this is displayed when no attributes are present and the request includes -the correct empty B<SET OF> structure (the DER encoding of which is 0xa0 -0x00). If you just see: - - Attributes: - -then the B<SET OF> is missing and the encoding is technically invalid (but -it is tolerated). See the description of the command line option B<-asn1-kludge> -for more information. - -=head1 ENVIRONMENT VARIABLES - -The variable B<OPENSSL_CONF> if defined allows an alternative configuration -file location to be specified, it will be overridden by the B<-config> command -line switch if it is present. For compatibility reasons the B<SSLEAY_CONF> -environment variable serves the same purpose but its use is discouraged. - -=head1 BUGS - -OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively -treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour. -This can cause problems if you need characters that aren't available in -PrintableStrings and you don't want to or can't use BMPStrings. - -As a consequence of the T61String handling the only correct way to represent -accented characters in OpenSSL is to use a BMPString: unfortunately Netscape -currently chokes on these. If you have to use accented characters with Netscape -and MSIE then you currently need to use the invalid T61String form. - -The current prompting is not very friendly. It doesn't allow you to confirm what -you've just entered. Other things like extensions in certificate requests are -statically defined in the configuration file. Some of these: like an email -address in subjectAltName should be input by the user. - -=head1 SEE ALSO - -L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>, -L<gendsa(1)|gendsa(1)>, L<config(5)|config(5)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/rsa.pod b/sys/src/ape/lib/openssl/doc/apps/rsa.pod deleted file mode 100644 index 4d7640995..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/rsa.pod +++ /dev/null @@ -1,189 +0,0 @@ - -=pod - -=head1 NAME - -rsa - RSA key processing tool - -=head1 SYNOPSIS - -B<openssl> B<rsa> -[B<-inform PEM|NET|DER>] -[B<-outform PEM|NET|DER>] -[B<-in filename>] -[B<-passin arg>] -[B<-out filename>] -[B<-passout arg>] -[B<-sgckey>] -[B<-des>] -[B<-des3>] -[B<-idea>] -[B<-text>] -[B<-noout>] -[B<-modulus>] -[B<-check>] -[B<-pubin>] -[B<-pubout>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<rsa> command processes RSA keys. They can be converted between various -forms and their components printed out. B<Note> this command uses the -traditional SSLeay compatible format for private key encryption: newer -applications should use the more secure PKCS#8 format using the B<pkcs8> -utility. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-inform DER|NET|PEM> - -This specifies the input format. The B<DER> option uses an ASN1 DER encoded -form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. -The B<PEM> form is the default format: it consists of the B<DER> format base64 -encoded with additional header and footer lines. On input PKCS#8 format private -keys are also accepted. The B<NET> form is a format is described in the B<NOTES> -section. - -=item B<-outform DER|NET|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a key from or standard input if this -option is not specified. If the key is encrypted a pass phrase will be -prompted for. - -=item B<-passin arg> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-out filename> - -This specifies the output filename to write a key to or standard output if this -option is not specified. If any encryption options are set then a pass phrase -will be prompted for. The output filename should B<not> be the same as the input -filename. - -=item B<-passout password> - -the output file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-sgckey> - -use the modified NET algorithm used with some versions of Microsoft IIS and SGC -keys. - -=item B<-des|-des3|-idea> - -These options encrypt the private key with the DES, triple DES, or the -IDEA ciphers respectively before outputting it. A pass phrase is prompted for. -If none of these options is specified the key is written in plain text. This -means that using the B<rsa> utility to read in an encrypted key with no -encryption option can be used to remove the pass phrase from a key, or by -setting the encryption options it can be use to add or change the pass phrase. -These options can only be used with PEM format output files. - -=item B<-text> - -prints out the various public or private key components in -plain text in addition to the encoded version. - -=item B<-noout> - -this option prevents output of the encoded version of the key. - -=item B<-modulus> - -this option prints out the value of the modulus of the key. - -=item B<-check> - -this option checks the consistency of an RSA private key. - -=item B<-pubin> - -by default a private key is read from the input file: with this -option a public key is read instead. - -=item B<-pubout> - -by default a private key is output: with this option a public -key will be output instead. This option is automatically set if -the input is a public key. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 NOTES - -The PEM private key format uses the header and footer lines: - - -----BEGIN RSA PRIVATE KEY----- - -----END RSA PRIVATE KEY----- - -The PEM public key format uses the header and footer lines: - - -----BEGIN PUBLIC KEY----- - -----END PUBLIC KEY----- - -The B<NET> form is a format compatible with older Netscape servers -and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. -It is not very secure and so should only be used when necessary. - -Some newer version of IIS have additional data in the exported .key -files. To use these with the utility, view the file with a binary editor -and look for the string "private-key", then trace back to the byte -sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). Copy all the data -from this point onwards to another file and use that as the input -to the B<rsa> utility with the B<-inform NET> option. If you get -an error after entering the password try the B<-sgckey> option. - -=head1 EXAMPLES - -To remove the pass phrase on an RSA private key: - - openssl rsa -in key.pem -out keyout.pem - -To encrypt a private key using triple DES: - - openssl rsa -in key.pem -des3 -out keyout.pem - -To convert a private key from PEM to DER format: - - openssl rsa -in key.pem -outform DER -out keyout.der - -To print out the components of a private key to standard output: - - openssl rsa -in key.pem -text -noout - -To just output the public part of a private key: - - openssl rsa -in key.pem -pubout -out pubkey.pem - -=head1 BUGS - -The command line password arguments don't currently work with -B<NET> format. - -There should be an option that automatically handles .key files, -without having to manually edit them. - -=head1 SEE ALSO - -L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, -L<gendsa(1)|gendsa(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/rsautl.pod b/sys/src/ape/lib/openssl/doc/apps/rsautl.pod deleted file mode 100644 index 1a498c2f6..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/rsautl.pod +++ /dev/null @@ -1,183 +0,0 @@ -=pod - -=head1 NAME - -rsautl - RSA utility - -=head1 SYNOPSIS - -B<openssl> B<rsautl> -[B<-in file>] -[B<-out file>] -[B<-inkey file>] -[B<-pubin>] -[B<-certin>] -[B<-sign>] -[B<-verify>] -[B<-encrypt>] -[B<-decrypt>] -[B<-pkcs>] -[B<-ssl>] -[B<-raw>] -[B<-hexdump>] -[B<-asn1parse>] - -=head1 DESCRIPTION - -The B<rsautl> command can be used to sign, verify, encrypt and decrypt -data using the RSA algorithm. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-in filename> - -This specifies the input filename to read data from or standard input -if this option is not specified. - -=item B<-out filename> - -specifies the output filename to write to or standard output by -default. - -=item B<-inkey file> - -the input key file, by default it should be an RSA private key. - -=item B<-pubin> - -the input file is an RSA public key. - -=item B<-certin> - -the input is a certificate containing an RSA public key. - -=item B<-sign> - -sign the input data and output the signed result. This requires -and RSA private key. - -=item B<-verify> - -verify the input data and output the recovered data. - -=item B<-encrypt> - -encrypt the input data using an RSA public key. - -=item B<-decrypt> - -decrypt the input data using an RSA private key. - -=item B<-pkcs, -oaep, -ssl, -raw> - -the padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, -special padding used in SSL v2 backwards compatible handshakes, -or no padding, respectively. -For signatures, only B<-pkcs> and B<-raw> can be used. - -=item B<-hexdump> - -hex dump the output data. - -=item B<-asn1parse> - -asn1parse the output data, this is useful when combined with the -B<-verify> option. - -=back - -=head1 NOTES - -B<rsautl> because it uses the RSA algorithm directly can only be -used to sign or verify small pieces of data. - -=head1 EXAMPLES - -Sign some data using a private key: - - openssl rsautl -sign -in file -inkey key.pem -out sig - -Recover the signed data - - openssl rsautl -verify -in sig -inkey key.pem - -Examine the raw signed data: - - openssl rsautl -verify -in file -inkey key.pem -raw -hexdump - - 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world - -The PKCS#1 block formatting is evident from this. If this was done using -encrypt and decrypt the block would have been of type 2 (the second byte) -and random padding data visible instead of the 0xff bytes. - -It is possible to analyse the signature of certificates using this -utility in conjunction with B<asn1parse>. Consider the self signed -example in certs/pca-cert.pem . Running B<asn1parse> as follows yields: - - openssl asn1parse -in pca-cert.pem - - 0:d=0 hl=4 l= 742 cons: SEQUENCE - 4:d=1 hl=4 l= 591 cons: SEQUENCE - 8:d=2 hl=2 l= 3 cons: cont [ 0 ] - 10:d=3 hl=2 l= 1 prim: INTEGER :02 - 13:d=2 hl=2 l= 1 prim: INTEGER :00 - 16:d=2 hl=2 l= 13 cons: SEQUENCE - 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption - 29:d=3 hl=2 l= 0 prim: NULL - 31:d=2 hl=2 l= 92 cons: SEQUENCE - 33:d=3 hl=2 l= 11 cons: SET - 35:d=4 hl=2 l= 9 cons: SEQUENCE - 37:d=5 hl=2 l= 3 prim: OBJECT :countryName - 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU - .... - 599:d=1 hl=2 l= 13 cons: SEQUENCE - 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption - 612:d=2 hl=2 l= 0 prim: NULL - 614:d=1 hl=3 l= 129 prim: BIT STRING - - -The final BIT STRING contains the actual signature. It can be extracted with: - - openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614 - -The certificate public key can be extracted with: - - openssl x509 -in test/testx509.pem -pubkey -noout >pubkey.pem - -The signature can be analysed with: - - openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin - - 0:d=0 hl=2 l= 32 cons: SEQUENCE - 2:d=1 hl=2 l= 12 cons: SEQUENCE - 4:d=2 hl=2 l= 8 prim: OBJECT :md5 - 14:d=2 hl=2 l= 0 prim: NULL - 16:d=1 hl=2 l= 16 prim: OCTET STRING - 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%.. - -This is the parsed version of an ASN1 DigestInfo structure. It can be seen that -the digest used was md5. The actual part of the certificate that was signed can -be extracted with: - - openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4 - -and its digest computed with: - - openssl md5 -c tbs - MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5 - -which it can be seen agrees with the recovered value above. - -=head1 SEE ALSO - -L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)> diff --git a/sys/src/ape/lib/openssl/doc/apps/s_client.pod b/sys/src/ape/lib/openssl/doc/apps/s_client.pod deleted file mode 100644 index c44d357cf..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/s_client.pod +++ /dev/null @@ -1,297 +0,0 @@ - -=pod - -=head1 NAME - -s_client - SSL/TLS client program - -=head1 SYNOPSIS - -B<openssl> B<s_client> -[B<-connect host:port>] -[B<-verify depth>] -[B<-cert filename>] -[B<-certform DER|PEM>] -[B<-key filename>] -[B<-keyform DER|PEM>] -[B<-pass arg>] -[B<-CApath directory>] -[B<-CAfile filename>] -[B<-reconnect>] -[B<-pause>] -[B<-showcerts>] -[B<-debug>] -[B<-msg>] -[B<-nbio_test>] -[B<-state>] -[B<-nbio>] -[B<-crlf>] -[B<-ign_eof>] -[B<-quiet>] -[B<-ssl2>] -[B<-ssl3>] -[B<-tls1>] -[B<-no_ssl2>] -[B<-no_ssl3>] -[B<-no_tls1>] -[B<-bugs>] -[B<-cipher cipherlist>] -[B<-starttls protocol>] -[B<-engine id>] -[B<-tlsextdebug>] -[B<-no_ticket>] -[B<-sess_out filename>] -[B<-sess_in filename>] -[B<-rand file(s)>] - -=head1 DESCRIPTION - -The B<s_client> command implements a generic SSL/TLS client which connects -to a remote host using SSL/TLS. It is a I<very> useful diagnostic tool for -SSL servers. - -=head1 OPTIONS - -=over 4 - -=item B<-connect host:port> - -This specifies the host and optional port to connect to. If not specified -then an attempt is made to connect to the local host on port 4433. - -=item B<-cert certname> - -The certificate to use, if one is requested by the server. The default is -not to use a certificate. - -=item B<-certform format> - -The certificate format to use: DER or PEM. PEM is the default. - -=item B<-key keyfile> - -The private key to use. If not specified then the certificate file will -be used. - -=item B<-keyform format> - -The private format to use: DER or PEM. PEM is the default. - -=item B<-pass arg> - -the private key password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-verify depth> - -The verify depth to use. This specifies the maximum length of the -server certificate chain and turns on server certificate verification. -Currently the verify operation continues after errors so all the problems -with a certificate chain can be seen. As a side effect the connection -will never fail due to a server certificate verify failure. - -=item B<-CApath directory> - -The directory to use for server certificate verification. This directory -must be in "hash format", see B<verify> for more information. These are -also used when building the client certificate chain. - -=item B<-CAfile file> - -A file containing trusted certificates to use during server authentication -and to use when attempting to build the client certificate chain. - -=item B<-reconnect> - -reconnects to the same server 5 times using the same session ID, this can -be used as a test that session caching is working. - -=item B<-pause> - -pauses 1 second between each read and write call. - -=item B<-showcerts> - -display the whole server certificate chain: normally only the server -certificate itself is displayed. - -=item B<-prexit> - -print session information when the program exits. This will always attempt -to print out information even if the connection fails. Normally information -will only be printed out once if the connection succeeds. This option is useful -because the cipher in use may be renegotiated or the connection may fail -because a client certificate is required or is requested only after an -attempt is made to access a certain URL. Note: the output produced by this -option is not always accurate because a connection might never have been -established. - -=item B<-state> - -prints out the SSL session states. - -=item B<-debug> - -print extensive debugging information including a hex dump of all traffic. - -=item B<-msg> - -show all protocol messages with hex dump. - -=item B<-nbio_test> - -tests non-blocking I/O - -=item B<-nbio> - -turns on non-blocking I/O - -=item B<-crlf> - -this option translated a line feed from the terminal into CR+LF as required -by some servers. - -=item B<-ign_eof> - -inhibit shutting down the connection when end of file is reached in the -input. - -=item B<-quiet> - -inhibit printing of session and certificate information. This implicitly -turns on B<-ign_eof> as well. - -=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> - -these options disable the use of certain SSL or TLS protocols. By default -the initial handshake uses a method which should be compatible with all -servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. - -Unfortunately there are a lot of ancient and broken servers in use which -cannot handle this technique and will fail to connect. Some servers only -work if TLS is turned off with the B<-no_tls> option others will only -support SSL v2 and may need the B<-ssl2> option. - -=item B<-bugs> - -there are several known bug in SSL and TLS implementations. Adding this -option enables various workarounds. - -=item B<-cipher cipherlist> - -this allows the cipher list sent by the client to be modified. Although -the server determines which cipher suite is used it should take the first -supported cipher in the list sent by the client. See the B<ciphers> -command for more information. - -=item B<-starttls protocol> - -send the protocol-specific message(s) to switch to TLS for communication. -B<protocol> is a keyword for the intended protocol. Currently, the only -supported keywords are "smtp", "pop3", "imap", and "ftp". - -=item B<-tlsextdebug> - -print out a hex dump of any TLS extensions received from the server. Note: this -option is only available if extension support is explicitly enabled at compile -time - -=item B<-no_ticket> - -disable RFC4507bis session ticket support. Note: this option is only available -if extension support is explicitly enabled at compile time - -=item B<-sess_out filename> - -output SSL session to B<filename> - -=item B<-sess_in sess.pem> - -load SSL session from B<filename>. The client will attempt to resume a -connection from this session. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<s_client> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=back - -=head1 CONNECTED COMMANDS - -If a connection is established with an SSL server then any data received -from the server is displayed and any key presses will be sent to the -server. When used interactively (which means neither B<-quiet> nor B<-ign_eof> -have been given), the session will be renegotiated if the line begins with an -B<R>, and if the line begins with a B<Q> or if end of file is reached, the -connection will be closed down. - -=head1 NOTES - -B<s_client> can be used to debug SSL servers. To connect to an SSL HTTP -server the command: - - openssl s_client -connect servername:443 - -would typically be used (https uses port 443). If the connection succeeds -then an HTTP command can be given such as "GET /" to retrieve a web page. - -If the handshake fails then there are several possible causes, if it is -nothing obvious like no client certificate then the B<-bugs>, B<-ssl2>, -B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> options can be tried -in case it is a buggy server. In particular you should play with these -options B<before> submitting a bug report to an OpenSSL mailing list. - -A frequent problem when attempting to get client certificates working -is that a web client complains it has no certificates or gives an empty -list to choose from. This is normally because the server is not sending -the clients certificate authority in its "acceptable CA list" when it -requests a certificate. By using B<s_client> the CA list can be viewed -and checked. However some servers only request client authentication -after a specific URL is requested. To obtain the list in this case it -is necessary to use the B<-prexit> option and send an HTTP request -for an appropriate page. - -If a certificate is specified on the command line using the B<-cert> -option it will not be used unless the server specifically requests -a client certificate. Therefor merely including a client certificate -on the command line is no guarantee that the certificate works. - -If there are problems verifying a server certificate then the -B<-showcerts> option can be used to show the whole chain. - -Since the SSLv23 client hello cannot include compression methods or extensions -these will only be supported if its use is disabled, for example by using the -B<-no_sslv2> option. - -TLS extensions are only supported in OpenSSL 0.9.8 if they are explictly -enabled at compile time using for example the B<enable-tlsext> switch. - -=head1 BUGS - -Because this program has a lot of options and also because some of -the techniques used are rather old, the C source of s_client is rather -hard to read and not a model of how things should be done. A typical -SSL client program would be much simpler. - -The B<-verify> option should really exit if the server verification -fails. - -The B<-prexit> option is a bit of a hack. We should really report -information whenever a session is renegotiated. - -=head1 SEE ALSO - -L<sess_id(1)|sess_id(1)>, L<s_server(1)|s_server(1)>, L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/s_server.pod b/sys/src/ape/lib/openssl/doc/apps/s_server.pod deleted file mode 100644 index 57c2adfb9..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/s_server.pod +++ /dev/null @@ -1,340 +0,0 @@ - -=pod - -=head1 NAME - -s_server - SSL/TLS server program - -=head1 SYNOPSIS - -B<openssl> B<s_server> -[B<-accept port>] -[B<-context id>] -[B<-verify depth>] -[B<-Verify depth>] -[B<-cert filename>] -[B<-certform DER|PEM>] -[B<-key keyfile>] -[B<-keyform DER|PEM>] -[B<-pass arg>] -[B<-dcert filename>] -[B<-dcertform DER|PEM>] -[B<-dkey keyfile>] -[B<-dkeyform DER|PEM>] -[B<-dpass arg>] -[B<-dhparam filename>] -[B<-nbio>] -[B<-nbio_test>] -[B<-crlf>] -[B<-debug>] -[B<-msg>] -[B<-state>] -[B<-CApath directory>] -[B<-CAfile filename>] -[B<-nocert>] -[B<-cipher cipherlist>] -[B<-quiet>] -[B<-no_tmp_rsa>] -[B<-ssl2>] -[B<-ssl3>] -[B<-tls1>] -[B<-no_ssl2>] -[B<-no_ssl3>] -[B<-no_tls1>] -[B<-no_dhe>] -[B<-bugs>] -[B<-hack>] -[B<-www>] -[B<-WWW>] -[B<-HTTP>] -[B<-engine id>] -[B<-tlsextdebug>] -[B<-no_ticket>] -[B<-id_prefix arg>] -[B<-rand file(s)>] - -=head1 DESCRIPTION - -The B<s_server> command implements a generic SSL/TLS server which listens -for connections on a given port using SSL/TLS. - -=head1 OPTIONS - -=over 4 - -=item B<-accept port> - -the TCP port to listen on for connections. If not specified 4433 is used. - -=item B<-context id> - -sets the SSL context id. It can be given any string value. If this option -is not present a default value will be used. - -=item B<-cert certname> - -The certificate to use, most servers cipher suites require the use of a -certificate and some require a certificate with a certain public key type: -for example the DSS cipher suites require a certificate containing a DSS -(DSA) key. If not specified then the filename "server.pem" will be used. - -=item B<-certform format> - -The certificate format to use: DER or PEM. PEM is the default. - -=item B<-key keyfile> - -The private key to use. If not specified then the certificate file will -be used. - -=item B<-keyform format> - -The private format to use: DER or PEM. PEM is the default. - -=item B<-pass arg> - -the private key password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-dcert filename>, B<-dkey keyname> - -specify an additional certificate and private key, these behave in the -same manner as the B<-cert> and B<-key> options except there is no default -if they are not specified (no additional certificate and key is used). As -noted above some cipher suites require a certificate containing a key of -a certain type. Some cipher suites need a certificate carrying an RSA key -and some a DSS (DSA) key. By using RSA and DSS certificates and keys -a server can support clients which only support RSA or DSS cipher suites -by using an appropriate certificate. - -=item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg> - -addtional certificate and private key format and passphrase respectively. - -=item B<-nocert> - -if this option is set then no certificate is used. This restricts the -cipher suites available to the anonymous ones (currently just anonymous -DH). - -=item B<-dhparam filename> - -the DH parameter file to use. The ephemeral DH cipher suites generate keys -using a set of DH parameters. If not specified then an attempt is made to -load the parameters from the server certificate file. If this fails then -a static set of parameters hard coded into the s_server program will be used. - -=item B<-no_dhe> - -if this option is set then no DH parameters will be loaded effectively -disabling the ephemeral DH cipher suites. - -=item B<-no_tmp_rsa> - -certain export cipher suites sometimes use a temporary RSA key, this option -disables temporary RSA key generation. - -=item B<-verify depth>, B<-Verify depth> - -The verify depth to use. This specifies the maximum length of the -client certificate chain and makes the server request a certificate from -the client. With the B<-verify> option a certificate is requested but the -client does not have to send one, with the B<-Verify> option the client -must supply a certificate or an error occurs. - -=item B<-CApath directory> - -The directory to use for client certificate verification. This directory -must be in "hash format", see B<verify> for more information. These are -also used when building the server certificate chain. - -=item B<-CAfile file> - -A file containing trusted certificates to use during client authentication -and to use when attempting to build the server certificate chain. The list -is also used in the list of acceptable client CAs passed to the client when -a certificate is requested. - -=item B<-state> - -prints out the SSL session states. - -=item B<-debug> - -print extensive debugging information including a hex dump of all traffic. - -=item B<-msg> - -show all protocol messages with hex dump. - -=item B<-nbio_test> - -tests non blocking I/O - -=item B<-nbio> - -turns on non blocking I/O - -=item B<-crlf> - -this option translated a line feed from the terminal into CR+LF. - -=item B<-quiet> - -inhibit printing of session and certificate information. - -=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> - -these options disable the use of certain SSL or TLS protocols. By default -the initial handshake uses a method which should be compatible with all -servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. - -=item B<-bugs> - -there are several known bug in SSL and TLS implementations. Adding this -option enables various workarounds. - -=item B<-hack> - -this option enables a further workaround for some some early Netscape -SSL code (?). - -=item B<-cipher cipherlist> - -this allows the cipher list used by the server to be modified. When -the client sends a list of supported ciphers the first client cipher -also included in the server list is used. Because the client specifies -the preference order, the order of the server cipherlist irrelevant. See -the B<ciphers> command for more information. - -=item B<-tlsextdebug> - -print out a hex dump of any TLS extensions received from the server. - -=item B<-no_ticket> - -disable RFC4507bis session ticket support. - -=item B<-www> - -sends a status message back to the client when it connects. This includes -lots of information about the ciphers used and various session parameters. -The output is in HTML format so this option will normally be used with a -web browser. - -=item B<-WWW> - -emulates a simple web server. Pages will be resolved relative to the -current directory, for example if the URL https://myhost/page.html is -requested the file ./page.html will be loaded. - -=item B<-HTTP> - -emulates a simple web server. Pages will be resolved relative to the -current directory, for example if the URL https://myhost/page.html is -requested the file ./page.html will be loaded. The files loaded are -assumed to contain a complete and correct HTTP response (lines that -are part of the HTTP response line and headers must end with CRLF). - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<s_server> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<-id_prefix arg> - -generate SSL/TLS session IDs prefixed by B<arg>. This is mostly useful -for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple -servers, when each of which might be generating a unique range of session -IDs (eg. with a certain prefix). - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=back - -=head1 CONNECTED COMMANDS - -If a connection request is established with an SSL client and neither the -B<-www> nor the B<-WWW> option has been used then normally any data received -from the client is displayed and any key presses will be sent to the client. - -Certain single letter commands are also recognized which perform special -operations: these are listed below. - -=over 4 - -=item B<q> - -end the current SSL connection but still accept new connections. - -=item B<Q> - -end the current SSL connection and exit. - -=item B<r> - -renegotiate the SSL session. - -=item B<R> - -renegotiate the SSL session and request a client certificate. - -=item B<P> - -send some plain text down the underlying TCP connection: this should -cause the client to disconnect due to a protocol violation. - -=item B<S> - -print out some session cache status information. - -=back - -=head1 NOTES - -B<s_server> can be used to debug SSL clients. To accept connections from -a web browser the command: - - openssl s_server -accept 443 -www - -can be used for example. - -Most web browsers (in particular Netscape and MSIE) only support RSA cipher -suites, so they cannot connect to servers which don't use a certificate -carrying an RSA key or a version of OpenSSL with RSA disabled. - -Although specifying an empty list of CAs when requesting a client certificate -is strictly speaking a protocol violation, some SSL clients interpret this to -mean any CA is acceptable. This is useful for debugging purposes. - -The session parameters can printed out using the B<sess_id> program. - -TLS extensions are only supported in OpenSSL 0.9.8 if they are explictly -enabled at compile time using for example the B<enable-tlsext> switch. - -=head1 BUGS - -Because this program has a lot of options and also because some of -the techniques used are rather old, the C source of s_server is rather -hard to read and not a model of how things should be done. A typical -SSL server program would be much simpler. - -The output of common ciphers is wrong: it just gives the list of ciphers that -OpenSSL recognizes and the client supports. - -There should be a way for the B<s_server> program to print out details of any -unknown cipher suites a client says it supports. - -=head1 SEE ALSO - -L<sess_id(1)|sess_id(1)>, L<s_client(1)|s_client(1)>, L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/s_time.pod b/sys/src/ape/lib/openssl/doc/apps/s_time.pod deleted file mode 100644 index 5a38aa2e0..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/s_time.pod +++ /dev/null @@ -1,173 +0,0 @@ - -=pod - -=head1 NAME - -s_time - SSL/TLS performance timing program - -=head1 SYNOPSIS - -B<openssl> B<s_time> -[B<-connect host:port>] -[B<-www page>] -[B<-cert filename>] -[B<-key filename>] -[B<-CApath directory>] -[B<-CAfile filename>] -[B<-reuse>] -[B<-new>] -[B<-verify depth>] -[B<-nbio>] -[B<-time seconds>] -[B<-ssl2>] -[B<-ssl3>] -[B<-bugs>] -[B<-cipher cipherlist>] - -=head1 DESCRIPTION - -The B<s_client> command implements a generic SSL/TLS client which connects to a -remote host using SSL/TLS. It can request a page from the server and includes -the time to transfer the payload data in its timing measurements. It measures -the number of connections within a given timeframe, the amount of data -transferred (if any), and calculates the average time spent for one connection. - -=head1 OPTIONS - -=over 4 - -=item B<-connect host:port> - -This specifies the host and optional port to connect to. - -=item B<-www page> - -This specifies the page to GET from the server. A value of '/' gets the -index.htm[l] page. If this parameter is not specified, then B<s_time> will only -perform the handshake to establish SSL connections but not transfer any -payload data. - -=item B<-cert certname> - -The certificate to use, if one is requested by the server. The default is -not to use a certificate. The file is in PEM format. - -=item B<-key keyfile> - -The private key to use. If not specified then the certificate file will -be used. The file is in PEM format. - -=item B<-verify depth> - -The verify depth to use. This specifies the maximum length of the -server certificate chain and turns on server certificate verification. -Currently the verify operation continues after errors so all the problems -with a certificate chain can be seen. As a side effect the connection -will never fail due to a server certificate verify failure. - -=item B<-CApath directory> - -The directory to use for server certificate verification. This directory -must be in "hash format", see B<verify> for more information. These are -also used when building the client certificate chain. - -=item B<-CAfile file> - -A file containing trusted certificates to use during server authentication -and to use when attempting to build the client certificate chain. - -=item B<-new> - -performs the timing test using a new session ID for each connection. -If neither B<-new> nor B<-reuse> are specified, they are both on by default -and executed in sequence. - -=item B<-reuse> - -performs the timing test using the same session ID; this can be used as a test -that session caching is working. If neither B<-new> nor B<-reuse> are -specified, they are both on by default and executed in sequence. - -=item B<-nbio> - -turns on non-blocking I/O. - -=item B<-ssl2>, B<-ssl3> - -these options disable the use of certain SSL or TLS protocols. By default -the initial handshake uses a method which should be compatible with all -servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. -The timing program is not as rich in options to turn protocols on and off as -the L<s_client(1)|s_client(1)> program and may not connect to all servers. - -Unfortunately there are a lot of ancient and broken servers in use which -cannot handle this technique and will fail to connect. Some servers only -work if TLS is turned off with the B<-ssl3> option; others -will only support SSL v2 and may need the B<-ssl2> option. - -=item B<-bugs> - -there are several known bug in SSL and TLS implementations. Adding this -option enables various workarounds. - -=item B<-cipher cipherlist> - -this allows the cipher list sent by the client to be modified. Although -the server determines which cipher suite is used it should take the first -supported cipher in the list sent by the client. -See the L<ciphers(1)|ciphers(1)> command for more information. - -=item B<-time length> - -specifies how long (in seconds) B<s_time> should establish connections and -optionally transfer payload data from a server. Server and client performance -and the link speed determine how many connections B<s_time> can establish. - -=back - -=head1 NOTES - -B<s_client> can be used to measure the performance of an SSL connection. -To connect to an SSL HTTP server and get the default page the command - - openssl s_time -connect servername:443 -www / -CApath yourdir -CAfile yourfile.pem -cipher commoncipher [-ssl3] - -would typically be used (https uses port 443). 'commoncipher' is a cipher to -which both client and server can agree, see the L<ciphers(1)|ciphers(1)> command -for details. - -If the handshake fails then there are several possible causes, if it is -nothing obvious like no client certificate then the B<-bugs>, B<-ssl2>, -B<-ssl3> options can be tried -in case it is a buggy server. In particular you should play with these -options B<before> submitting a bug report to an OpenSSL mailing list. - -A frequent problem when attempting to get client certificates working -is that a web client complains it has no certificates or gives an empty -list to choose from. This is normally because the server is not sending -the clients certificate authority in its "acceptable CA list" when it -requests a certificate. By using L<s_client(1)|s_client(1)> the CA list can be -viewed and checked. However some servers only request client authentication -after a specific URL is requested. To obtain the list in this case it -is necessary to use the B<-prexit> option of L<s_client(1)|s_client(1)> and -send an HTTP request for an appropriate page. - -If a certificate is specified on the command line using the B<-cert> -option it will not be used unless the server specifically requests -a client certificate. Therefor merely including a client certificate -on the command line is no guarantee that the certificate works. - -=head1 BUGS - -Because this program does not have all the options of the -L<s_client(1)|s_client(1)> program to turn protocols on and off, you may not be -able to measure the performance of all protocols with all servers. - -The B<-verify> option should really exit if the server verification -fails. - -=head1 SEE ALSO - -L<s_client(1)|s_client(1)>, L<s_server(1)|s_server(1)>, L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/sess_id.pod b/sys/src/ape/lib/openssl/doc/apps/sess_id.pod deleted file mode 100644 index 9988d2cd3..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/sess_id.pod +++ /dev/null @@ -1,151 +0,0 @@ - -=pod - -=head1 NAME - -sess_id - SSL/TLS session handling utility - -=head1 SYNOPSIS - -B<openssl> B<sess_id> -[B<-inform PEM|DER>] -[B<-outform PEM|DER>] -[B<-in filename>] -[B<-out filename>] -[B<-text>] -[B<-noout>] -[B<-context ID>] - -=head1 DESCRIPTION - -The B<sess_id> process the encoded version of the SSL session structure -and optionally prints out SSL session details (for example the SSL session -master key) in human readable format. Since this is a diagnostic tool that -needs some knowledge of the SSL protocol to use properly, most users will -not need to use it. - -=over 4 - -=item B<-inform DER|PEM> - -This specifies the input format. The B<DER> option uses an ASN1 DER encoded -format containing session details. The precise format can vary from one version -to the next. The B<PEM> form is the default format: it consists of the B<DER> -format base64 encoded with additional header and footer lines. - -=item B<-outform DER|PEM> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read session information from or standard -input by default. - -=item B<-out filename> - -This specifies the output filename to write session information to or standard -output if this option is not specified. - -=item B<-text> - -prints out the various public or private key components in -plain text in addition to the encoded version. - -=item B<-cert> - -if a certificate is present in the session it will be output using this option, -if the B<-text> option is also present then it will be printed out in text form. - -=item B<-noout> - -this option prevents output of the encoded version of the session. - -=item B<-context ID> - -this option can set the session id so the output session information uses the -supplied ID. The ID can be any string of characters. This option wont normally -be used. - -=back - -=head1 OUTPUT - -Typical output: - - SSL-Session: - Protocol : TLSv1 - Cipher : 0016 - Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED - Session-ID-ctx: 01000000 - Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD - Key-Arg : None - Start Time: 948459261 - Timeout : 300 (sec) - Verify return code 0 (ok) - -Theses are described below in more detail. - -=over 4 - -=item B<Protocol> - -this is the protocol in use TLSv1, SSLv3 or SSLv2. - -=item B<Cipher> - -the cipher used this is the actual raw SSL or TLS cipher code, see the SSL -or TLS specifications for more information. - -=item B<Session-ID> - -the SSL session ID in hex format. - -=item B<Session-ID-ctx> - -the session ID context in hex format. - -=item B<Master-Key> - -this is the SSL session master key. - -=item B<Key-Arg> - -the key argument, this is only used in SSL v2. - -=item B<Start Time> - -this is the session start time represented as an integer in standard Unix format. - -=item B<Timeout> - -the timeout in seconds. - -=item B<Verify return code> - -this is the return code when an SSL client certificate is verified. - -=back - -=head1 NOTES - -The PEM encoded session format uses the header and footer lines: - - -----BEGIN SSL SESSION PARAMETERS----- - -----END SSL SESSION PARAMETERS----- - -Since the SSL session output contains the master key it is possible to read the contents -of an encrypted session using this information. Therefore appropriate security precautions -should be taken if the information is being output by a "real" application. This is -however strongly discouraged and should only be used for debugging purposes. - -=head1 BUGS - -The cipher and start time should be printed out in human readable form. - -=head1 SEE ALSO - -L<ciphers(1)|ciphers(1)>, L<s_server(1)|s_server(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/smime.pod b/sys/src/ape/lib/openssl/doc/apps/smime.pod deleted file mode 100644 index caf2d2689..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/smime.pod +++ /dev/null @@ -1,385 +0,0 @@ -=pod - -=head1 NAME - -smime - S/MIME utility - -=head1 SYNOPSIS - -B<openssl> B<smime> -[B<-encrypt>] -[B<-decrypt>] -[B<-sign>] -[B<-verify>] -[B<-pk7out>] -[B<-des>] -[B<-des3>] -[B<-rc2-40>] -[B<-rc2-64>] -[B<-rc2-128>] -[B<-aes128>] -[B<-aes192>] -[B<-aes256>] -[B<-camellia128>] -[B<-camellia192>] -[B<-camellia256>] -[B<-in file>] -[B<-certfile file>] -[B<-signer file>] -[B<-recip file>] -[B<-inform SMIME|PEM|DER>] -[B<-passin arg>] -[B<-inkey file>] -[B<-out file>] -[B<-outform SMIME|PEM|DER>] -[B<-content file>] -[B<-to addr>] -[B<-from ad>] -[B<-subject s>] -[B<-text>] -[B<-rand file(s)>] -[cert.pem]... - -=head1 DESCRIPTION - -The B<smime> command handles S/MIME mail. It can encrypt, decrypt, sign and -verify S/MIME messages. - -=head1 COMMAND OPTIONS - -There are five operation options that set the type of operation to be performed. -The meaning of the other options varies according to the operation type. - -=over 4 - -=item B<-encrypt> - -encrypt mail for the given recipient certificates. Input file is the message -to be encrypted. The output file is the encrypted mail in MIME format. - -=item B<-decrypt> - -decrypt mail using the supplied certificate and private key. Expects an -encrypted mail message in MIME format for the input file. The decrypted mail -is written to the output file. - -=item B<-sign> - -sign mail using the supplied certificate and private key. Input file is -the message to be signed. The signed message in MIME format is written -to the output file. - -=item B<-verify> - -verify signed mail. Expects a signed mail message on input and outputs -the signed data. Both clear text and opaque signing is supported. - -=item B<-pk7out> - -takes an input message and writes out a PEM encoded PKCS#7 structure. - -=item B<-in filename> - -the input message to be encrypted or signed or the MIME message to -be decrypted or verified. - -=item B<-inform SMIME|PEM|DER> - -this specifies the input format for the PKCS#7 structure. The default -is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER> -format change this to expect PEM and DER format PKCS#7 structures -instead. This currently only affects the input format of the PKCS#7 -structure, if no PKCS#7 structure is being input (for example with -B<-encrypt> or B<-sign>) this option has no effect. - -=item B<-out filename> - -the message text that has been decrypted or verified or the output MIME -format message that has been signed or verified. - -=item B<-outform SMIME|PEM|DER> - -this specifies the output format for the PKCS#7 structure. The default -is B<SMIME> which write an S/MIME format message. B<PEM> and B<DER> -format change this to write PEM and DER format PKCS#7 structures -instead. This currently only affects the output format of the PKCS#7 -structure, if no PKCS#7 structure is being output (for example with -B<-verify> or B<-decrypt>) this option has no effect. - -=item B<-content filename> - -This specifies a file containing the detached content, this is only -useful with the B<-verify> command. This is only usable if the PKCS#7 -structure is using the detached signature form where the content is -not included. This option will override any content if the input format -is S/MIME and it uses the multipart/signed MIME content type. - -=item B<-text> - -this option adds plain text (text/plain) MIME headers to the supplied -message if encrypting or signing. If decrypting or verifying it strips -off text headers: if the decrypted or verified message is not of MIME -type text/plain then an error occurs. - -=item B<-CAfile file> - -a file containing trusted CA certificates, only used with B<-verify>. - -=item B<-CApath dir> - -a directory containing trusted CA certificates, only used with -B<-verify>. This directory must be a standard certificate directory: that -is a hash of each subject name (using B<x509 -hash>) should be linked -to each certificate. - -=item B<-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -camellia128 -camellia192 -camellia256> - -the encryption algorithm to use. DES (56 bits), triple DES (168 bits), -40, 64 or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Camellia respectively. If not -specified 40 bit RC2 is used. Only used with B<-encrypt>. - -=item B<-nointern> - -when verifying a message normally certificates (if any) included in -the message are searched for the signing certificate. With this option -only the certificates specified in the B<-certfile> option are used. -The supplied certificates can still be used as untrusted CAs however. - -=item B<-noverify> - -do not verify the signers certificate of a signed message. - -=item B<-nochain> - -do not do chain verification of signers certificates: that is don't -use the certificates in the signed message as untrusted CAs. - -=item B<-nosigs> - -don't try to verify the signatures on the message. - -=item B<-nocerts> - -when signing a message the signer's certificate is normally included -with this option it is excluded. This will reduce the size of the -signed message but the verifier must have a copy of the signers certificate -available locally (passed using the B<-certfile> option for example). - -=item B<-noattr> - -normally when a message is signed a set of attributes are included which -include the signing time and supported symmetric algorithms. With this -option they are not included. - -=item B<-binary> - -normally the input message is converted to "canonical" format which is -effectively using CR and LF as end of line: as required by the S/MIME -specification. When this option is present no translation occurs. This -is useful when handling binary data which may not be in MIME format. - -=item B<-nodetach> - -when signing a message use opaque signing: this form is more resistant -to translation by mail relays but it cannot be read by mail agents that -do not support S/MIME. Without this option cleartext signing with -the MIME type multipart/signed is used. - -=item B<-certfile file> - -allows additional certificates to be specified. When signing these will -be included with the message. When verifying these will be searched for -the signers certificates. The certificates should be in PEM format. - -=item B<-signer file> - -the signers certificate when signing a message. If a message is -being verified then the signers certificates will be written to this -file if the verification was successful. - -=item B<-recip file> - -the recipients certificate when decrypting a message. This certificate -must match one of the recipients of the message or an error occurs. - -=item B<-inkey file> - -the private key to use when signing or decrypting. This must match the -corresponding certificate. If this option is not specified then the -private key must be included in the certificate file specified with -the B<-recip> or B<-signer> file. - -=item B<-passin arg> - -the private key password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-rand file(s)> - -a file or files containing random data used to seed the random number -generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). -Multiple files can be specified separated by a OS-dependent character. -The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for -all others. - -=item B<cert.pem...> - -one or more certificates of message recipients: used when encrypting -a message. - -=item B<-to, -from, -subject> - -the relevant mail headers. These are included outside the signed -portion of a message so they may be included manually. If signing -then many S/MIME mail clients check the signers certificate's email -address matches that specified in the From: address. - -=back - -=head1 NOTES - -The MIME message must be sent without any blank lines between the -headers and the output. Some mail programs will automatically add -a blank line. Piping the mail directly to sendmail is one way to -achieve the correct format. - -The supplied message to be signed or encrypted must include the -necessary MIME headers or many S/MIME clients wont display it -properly (if at all). You can use the B<-text> option to automatically -add plain text headers. - -A "signed and encrypted" message is one where a signed message is -then encrypted. This can be produced by encrypting an already signed -message: see the examples section. - -This version of the program only allows one signer per message but it -will verify multiple signers on received messages. Some S/MIME clients -choke if a message contains multiple signers. It is possible to sign -messages "in parallel" by signing an already signed message. - -The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME -clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7 -encrypted data is used for other purposes. - -=head1 EXIT CODES - -=over 4 - -=item 0 - -the operation was completely successfully. - -=item 1 - -an error occurred parsing the command options. - -=item 2 - -one of the input files could not be read. - -=item 3 - -an error occurred creating the PKCS#7 file or when reading the MIME -message. - -=item 4 - -an error occurred decrypting or verifying the message. - -=item 5 - -the message was verified correctly but an error occurred writing out -the signers certificates. - -=back - -=head1 EXAMPLES - -Create a cleartext signed message: - - openssl smime -sign -in message.txt -text -out mail.msg \ - -signer mycert.pem - -Create and opaque signed message - - openssl smime -sign -in message.txt -text -out mail.msg -nodetach \ - -signer mycert.pem - -Create a signed message, include some additional certificates and -read the private key from another file: - - openssl smime -sign -in in.txt -text -out mail.msg \ - -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem - -Send a signed message under Unix directly to sendmail, including headers: - - openssl smime -sign -in in.txt -text -signer mycert.pem \ - -from steve@openssl.org -to someone@somewhere \ - -subject "Signed message" | sendmail someone@somewhere - -Verify a message and extract the signer's certificate if successful: - - openssl smime -verify -in mail.msg -signer user.pem -out signedtext.txt - -Send encrypted mail using triple DES: - - openssl smime -encrypt -in in.txt -from steve@openssl.org \ - -to someone@somewhere -subject "Encrypted message" \ - -des3 user.pem -out mail.msg - -Sign and encrypt mail: - - openssl smime -sign -in ml.txt -signer my.pem -text \ - | openssl smime -encrypt -out mail.msg \ - -from steve@openssl.org -to someone@somewhere \ - -subject "Signed and Encrypted message" -des3 user.pem - -Note: the encryption command does not include the B<-text> option because the message -being encrypted already has MIME headers. - -Decrypt mail: - - openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem - -The output from Netscape form signing is a PKCS#7 structure with the -detached signature format. You can use this program to verify the -signature by line wrapping the base64 encoded structure and surrounding -it with: - - -----BEGIN PKCS7----- - -----END PKCS7----- - -and using the command, - - openssl smime -verify -inform PEM -in signature.pem -content content.txt - -alternatively you can base64 decode the signature and use - - openssl smime -verify -inform DER -in signature.der -content content.txt - -Create an encrypted message using 128 bit Camellia: - - openssl smime -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem - -=head1 BUGS - -The MIME parser isn't very clever: it seems to handle most messages that I've thrown -at it but it may choke on others. - -The code currently will only write out the signer's certificate to a file: if the -signer has a separate encryption certificate this must be manually extracted. There -should be some heuristic that determines the correct encryption certificate. - -Ideally a database should be maintained of a certificates for each email address. - -The code doesn't currently take note of the permitted symmetric encryption -algorithms as supplied in the SMIMECapabilities signed attribute. this means the -user has to manually include the correct encryption algorithm. It should store -the list of permitted ciphers in a database and only use those. - -No revocation checking is done on the signer's certificate. - -The current code can only handle S/MIME v2 messages, the more complex S/MIME v3 -structures may cause parsing errors. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/speed.pod b/sys/src/ape/lib/openssl/doc/apps/speed.pod deleted file mode 100644 index 0dcdba873..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/speed.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -speed - test library performance - -=head1 SYNOPSIS - -B<openssl speed> -[B<-engine id>] -[B<md2>] -[B<mdc2>] -[B<md5>] -[B<hmac>] -[B<sha1>] -[B<rmd160>] -[B<idea-cbc>] -[B<rc2-cbc>] -[B<rc5-cbc>] -[B<bf-cbc>] -[B<des-cbc>] -[B<des-ede3>] -[B<rc4>] -[B<rsa512>] -[B<rsa1024>] -[B<rsa2048>] -[B<rsa4096>] -[B<dsa512>] -[B<dsa1024>] -[B<dsa2048>] -[B<idea>] -[B<rc2>] -[B<des>] -[B<rsa>] -[B<blowfish>] - -=head1 DESCRIPTION - -This command is used to test the performance of cryptographic algorithms. - -=head1 OPTIONS - -=over 4 - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<speed> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=item B<[zero or more test algorithms]> - -If any options are given, B<speed> tests those algorithms, otherwise all of -the above are tested. - -=back - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/spkac.pod b/sys/src/ape/lib/openssl/doc/apps/spkac.pod deleted file mode 100644 index c3f1ff9c6..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/spkac.pod +++ /dev/null @@ -1,133 +0,0 @@ -=pod - -=head1 NAME - -spkac - SPKAC printing and generating utility - -=head1 SYNOPSIS - -B<openssl> B<spkac> -[B<-in filename>] -[B<-out filename>] -[B<-key keyfile>] -[B<-passin arg>] -[B<-challenge string>] -[B<-pubkey>] -[B<-spkac spkacname>] -[B<-spksect section>] -[B<-noout>] -[B<-verify>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<spkac> command processes Netscape signed public key and challenge -(SPKAC) files. It can print out their contents, verify the signature and -produce its own SPKACs from a supplied private key. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-in filename> - -This specifies the input filename to read from or standard input if this -option is not specified. Ignored if the B<-key> option is used. - -=item B<-out filename> - -specifies the output filename to write to or standard output by -default. - -=item B<-key keyfile> - -create an SPKAC file using the private key in B<keyfile>. The -B<-in>, B<-noout>, B<-spksect> and B<-verify> options are ignored if -present. - -=item B<-passin password> - -the input file password source. For more information about the format of B<arg> -see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. - -=item B<-challenge string> - -specifies the challenge string if an SPKAC is being created. - -=item B<-spkac spkacname> - -allows an alternative name form the variable containing the -SPKAC. The default is "SPKAC". This option affects both -generated and input SPKAC files. - -=item B<-spksect section> - -allows an alternative name form the section containing the -SPKAC. The default is the default section. - -=item B<-noout> - -don't output the text version of the SPKAC (not used if an -SPKAC is being created). - -=item B<-pubkey> - -output the public key of an SPKAC (not used if an SPKAC is -being created). - -=item B<-verify> - -verifies the digital signature on the supplied SPKAC. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head1 EXAMPLES - -Print out the contents of an SPKAC: - - openssl spkac -in spkac.cnf - -Verify the signature of an SPKAC: - - openssl spkac -in spkac.cnf -noout -verify - -Create an SPKAC using the challenge string "hello": - - openssl spkac -key key.pem -challenge hello -out spkac.cnf - -Example of an SPKAC, (long lines split up for clarity): - - SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1cCoq2Wa3Ixs47uI7F\ - PVwHVIPDx5yso105Y6zpozam135a8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03u\ - PFoQIDAQABFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJh1bEIYuc\ - 2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnDdq+NQ3F+X4deMx9AaEglZtULwV\ - 4= - -=head1 NOTES - -A created SPKAC with suitable DN components appended can be fed into -the B<ca> utility. - -SPKACs are typically generated by Netscape when a form is submitted -containing the B<KEYGEN> tag as part of the certificate enrollment -process. - -The challenge string permits a primitive form of proof of possession -of private key. By checking the SPKAC signature and a random challenge -string some guarantee is given that the user knows the private key -corresponding to the public key being certified. This is important in -some applications. Without this it is possible for a previous SPKAC -to be used in a "replay attack". - -=head1 SEE ALSO - -L<ca(1)|ca(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/verify.pod b/sys/src/ape/lib/openssl/doc/apps/verify.pod deleted file mode 100644 index ea5c29c15..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/verify.pod +++ /dev/null @@ -1,328 +0,0 @@ -=pod - -=head1 NAME - -verify - Utility to verify certificates. - -=head1 SYNOPSIS - -B<openssl> B<verify> -[B<-CApath directory>] -[B<-CAfile file>] -[B<-purpose purpose>] -[B<-untrusted file>] -[B<-help>] -[B<-issuer_checks>] -[B<-verbose>] -[B<->] -[certificates] - - -=head1 DESCRIPTION - -The B<verify> command verifies certificate chains. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-CApath directory> - -A directory of trusted certificates. The certificates should have names -of the form: hash.0 or have symbolic links to them of this -form ("hash" is the hashed certificate subject name: see the B<-hash> option -of the B<x509> utility). Under Unix the B<c_rehash> script will automatically -create symbolic links to a directory of certificates. - -=item B<-CAfile file> - -A file of trusted certificates. The file should contain multiple certificates -in PEM format concatenated together. - -=item B<-untrusted file> - -A file of untrusted certificates. The file should contain multiple certificates - -=item B<-purpose purpose> - -the intended use for the certificate. Without this option no chain verification -will be done. Currently accepted uses are B<sslclient>, B<sslserver>, -B<nssslserver>, B<smimesign>, B<smimeencrypt>. See the B<VERIFY OPERATION> -section for more information. - -=item B<-help> - -prints out a usage message. - -=item B<-verbose> - -print extra information about the operations being performed. - -=item B<-issuer_checks> - -print out diagnostics relating to searches for the issuer certificate -of the current certificate. This shows why each candidate issuer -certificate was rejected. However the presence of rejection messages -does not itself imply that anything is wrong: during the normal -verify process several rejections may take place. - -=item B<-> - -marks the last option. All arguments following this are assumed to be -certificate files. This is useful if the first certificate filename begins -with a B<->. - -=item B<certificates> - -one or more certificates to verify. If no certificate filenames are included -then an attempt is made to read a certificate from standard input. They should -all be in PEM format. - - -=back - -=head1 VERIFY OPERATION - -The B<verify> program uses the same functions as the internal SSL and S/MIME -verification, therefore this description applies to these verify operations -too. - -There is one crucial difference between the verify operations performed -by the B<verify> program: wherever possible an attempt is made to continue -after an error whereas normally the verify operation would halt on the -first error. This allows all the problems with a certificate chain to be -determined. - -The verify operation consists of a number of separate steps. - -Firstly a certificate chain is built up starting from the supplied certificate -and ending in the root CA. It is an error if the whole chain cannot be built -up. The chain is built up by looking up the issuers certificate of the current -certificate. If a certificate is found which is its own issuer it is assumed -to be the root CA. - -The process of 'looking up the issuers certificate' itself involves a number -of steps. In versions of OpenSSL before 0.9.5a the first certificate whose -subject name matched the issuer of the current certificate was assumed to be -the issuers certificate. In OpenSSL 0.9.6 and later all certificates -whose subject name matches the issuer name of the current certificate are -subject to further tests. The relevant authority key identifier components -of the current certificate (if present) must match the subject key identifier -(if present) and issuer and serial number of the candidate issuer, in addition -the keyUsage extension of the candidate issuer (if present) must permit -certificate signing. - -The lookup first looks in the list of untrusted certificates and if no match -is found the remaining lookups are from the trusted certificates. The root CA -is always looked up in the trusted certificate list: if the certificate to -verify is a root certificate then an exact match must be found in the trusted -list. - -The second operation is to check every untrusted certificate's extensions for -consistency with the supplied purpose. If the B<-purpose> option is not included -then no checks are done. The supplied or "leaf" certificate must have extensions -compatible with the supplied purpose and all other certificates must also be valid -CA certificates. The precise extensions required are described in more detail in -the B<CERTIFICATE EXTENSIONS> section of the B<x509> utility. - -The third operation is to check the trust settings on the root CA. The root -CA should be trusted for the supplied purpose. For compatibility with previous -versions of SSLeay and OpenSSL a certificate with no trust settings is considered -to be valid for all purposes. - -The final operation is to check the validity of the certificate chain. The validity -period is checked against the current system time and the notBefore and notAfter -dates in the certificate. The certificate signatures are also checked at this -point. - -If all operations complete successfully then certificate is considered valid. If -any operation fails then the certificate is not valid. - -=head1 DIAGNOSTICS - -When a verify operation fails the output messages can be somewhat cryptic. The -general form of the error message is: - - server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) - error 24 at 1 depth lookup:invalid CA certificate - -The first line contains the name of the certificate being verified followed by -the subject name of the certificate. The second line contains the error number -and the depth. The depth is number of the certificate being verified when a -problem was detected starting with zero for the certificate being verified itself -then 1 for the CA that signed the certificate and so on. Finally a text version -of the error number is presented. - -An exhaustive list of the error codes and messages is shown below, this also -includes the name of the error code as defined in the header file x509_vfy.h -Some of the error codes are defined but never returned: these are described -as "unused". - -=over 4 - -=item B<0 X509_V_OK: ok> - -the operation was successful. - -=item B<2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate> - -the issuer certificate could not be found: this occurs if the issuer certificate -of an untrusted certificate cannot be found. - -=item B<3 X509_V_ERR_UNABLE_TO_GET_CRL unable to get certificate CRL> - -the CRL of a certificate could not be found. Unused. - -=item B<4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature> - -the certificate signature could not be decrypted. This means that the actual signature value -could not be determined rather than it not matching the expected value, this is only -meaningful for RSA keys. - -=item B<5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature> - -the CRL signature could not be decrypted: this means that the actual signature value -could not be determined rather than it not matching the expected value. Unused. - -=item B<6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key> - -the public key in the certificate SubjectPublicKeyInfo could not be read. - -=item B<7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure> - -the signature of the certificate is invalid. - -=item B<8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure> - -the signature of the certificate is invalid. Unused. - -=item B<9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid> - -the certificate is not yet valid: the notBefore date is after the current time. - -=item B<10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired> - -the certificate has expired: that is the notAfter date is before the current time. - -=item B<11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> - -the CRL is not yet valid. Unused. - -=item B<12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> - -the CRL has expired. Unused. - -=item B<13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field> - -the certificate notBefore field contains an invalid time. - -=item B<14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field> - -the certificate notAfter field contains an invalid time. - -=item B<15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field> - -the CRL lastUpdate field contains an invalid time. Unused. - -=item B<16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field> - -the CRL nextUpdate field contains an invalid time. Unused. - -=item B<17 X509_V_ERR_OUT_OF_MEM: out of memory> - -an error occurred trying to allocate memory. This should never happen. - -=item B<18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate> - -the passed certificate is self signed and the same certificate cannot be found in the list of -trusted certificates. - -=item B<19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain> - -the certificate chain could be built up using the untrusted certificates but the root could not -be found locally. - -=item B<20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate> - -the issuer certificate of a locally looked up certificate could not be found. This normally means -the list of trusted certificates is not complete. - -=item B<21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate> - -no signatures could be verified because the chain contains only one certificate and it is not -self signed. - -=item B<22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long> - -the certificate chain length is greater than the supplied maximum depth. Unused. - -=item B<23 X509_V_ERR_CERT_REVOKED: certificate revoked> - -the certificate has been revoked. Unused. - -=item B<24 X509_V_ERR_INVALID_CA: invalid CA certificate> - -a CA certificate is invalid. Either it is not a CA or its extensions are not consistent -with the supplied purpose. - -=item B<25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded> - -the basicConstraints pathlength parameter has been exceeded. - -=item B<26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose> - -the supplied certificate cannot be used for the specified purpose. - -=item B<27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted> - -the root CA is not marked as trusted for the specified purpose. - -=item B<28 X509_V_ERR_CERT_REJECTED: certificate rejected> - -the root CA is marked to reject the specified purpose. - -=item B<29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch> - -the current candidate issuer certificate was rejected because its subject name -did not match the issuer name of the current certificate. Only displayed when -the B<-issuer_checks> option is set. - -=item B<30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch> - -the current candidate issuer certificate was rejected because its subject key -identifier was present and did not match the authority key identifier current -certificate. Only displayed when the B<-issuer_checks> option is set. - -=item B<31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch> - -the current candidate issuer certificate was rejected because its issuer name -and serial number was present and did not match the authority key identifier -of the current certificate. Only displayed when the B<-issuer_checks> option is set. - -=item B<32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing> - -the current candidate issuer certificate was rejected because its keyUsage extension -does not permit certificate signing. - -=item B<50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> - -an application specific error. Unused. - -=back - -=head1 BUGS - -Although the issuer checks are a considerably improvement over the old technique they still -suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that -trusted certificates with matching subject name must either appear in a file (as specified by the -B<-CAfile> option) or a directory (as specified by B<-CApath>. If they occur in both then only -the certificates in the file will be recognised. - -Previous versions of OpenSSL assume certificates with matching subject name are identical and -mishandled them. - -=head1 SEE ALSO - -L<x509(1)|x509(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/version.pod b/sys/src/ape/lib/openssl/doc/apps/version.pod deleted file mode 100644 index e00324c44..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/version.pod +++ /dev/null @@ -1,64 +0,0 @@ -=pod - -=head1 NAME - -version - print OpenSSL version information - -=head1 SYNOPSIS - -B<openssl version> -[B<-a>] -[B<-v>] -[B<-b>] -[B<-o>] -[B<-f>] -[B<-p>] - -=head1 DESCRIPTION - -This command is used to print out version information about OpenSSL. - -=head1 OPTIONS - -=over 4 - -=item B<-a> - -all information, this is the same as setting all the other flags. - -=item B<-v> - -the current OpenSSL version. - -=item B<-b> - -the date the current version of OpenSSL was built. - -=item B<-o> - -option information: various options set when the library was built. - -=item B<-c> - -compilation flags. - -=item B<-p> - -platform setting. - -=item B<-d> - -OPENSSLDIR setting. - -=back - -=head1 NOTES - -The output of B<openssl version -a> would typically be used when sending -in a bug report. - -=head1 HISTORY - -The B<-d> option was added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/x509.pod b/sys/src/ape/lib/openssl/doc/apps/x509.pod deleted file mode 100644 index a925da41f..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/x509.pod +++ /dev/null @@ -1,832 +0,0 @@ - -=pod - -=head1 NAME - -x509 - Certificate display and signing utility - -=head1 SYNOPSIS - -B<openssl> B<x509> -[B<-inform DER|PEM|NET>] -[B<-outform DER|PEM|NET>] -[B<-keyform DER|PEM>] -[B<-CAform DER|PEM>] -[B<-CAkeyform DER|PEM>] -[B<-in filename>] -[B<-out filename>] -[B<-serial>] -[B<-hash>] -[B<-subject_hash>] -[B<-issuer_hash>] -[B<-subject>] -[B<-issuer>] -[B<-nameopt option>] -[B<-email>] -[B<-startdate>] -[B<-enddate>] -[B<-purpose>] -[B<-dates>] -[B<-modulus>] -[B<-fingerprint>] -[B<-alias>] -[B<-noout>] -[B<-trustout>] -[B<-clrtrust>] -[B<-clrreject>] -[B<-addtrust arg>] -[B<-addreject arg>] -[B<-setalias arg>] -[B<-days arg>] -[B<-set_serial n>] -[B<-signkey filename>] -[B<-x509toreq>] -[B<-req>] -[B<-CA filename>] -[B<-CAkey filename>] -[B<-CAcreateserial>] -[B<-CAserial filename>] -[B<-text>] -[B<-C>] -[B<-md2|-md5|-sha1|-mdc2>] -[B<-clrext>] -[B<-extfile filename>] -[B<-extensions section>] -[B<-engine id>] - -=head1 DESCRIPTION - -The B<x509> command is a multi purpose certificate utility. It can be -used to display certificate information, convert certificates to -various forms, sign certificate requests like a "mini CA" or edit -certificate trust settings. - -Since there are a large number of options they will split up into -various sections. - -=head1 OPTIONS - -=head2 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS - -=over 4 - -=item B<-inform DER|PEM|NET> - -This specifies the input format normally the command will expect an X509 -certificate but this can change if other options such as B<-req> are -present. The DER format is the DER encoding of the certificate and PEM -is the base64 encoding of the DER encoding with header and footer lines -added. The NET option is an obscure Netscape server format that is now -obsolete. - -=item B<-outform DER|PEM|NET> - -This specifies the output format, the options have the same meaning as the -B<-inform> option. - -=item B<-in filename> - -This specifies the input filename to read a certificate from or standard input -if this option is not specified. - -=item B<-out filename> - -This specifies the output filename to write to or standard output by -default. - -=item B<-md2|-md5|-sha1|-mdc2> - -the digest to use. This affects any signing or display option that uses a message -digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options. If not -specified then SHA1 is used. If the key being used to sign with is a DSA key -then this option has no effect: SHA1 is always used with DSA keys. - -=item B<-engine id> - -specifying an engine (by it's unique B<id> string) will cause B<req> -to attempt to obtain a functional reference to the specified engine, -thus initialising it if needed. The engine will then be set as the default -for all available algorithms. - -=back - -=head2 DISPLAY OPTIONS - -Note: the B<-alias> and B<-purpose> options are also display options -but are described in the B<TRUST SETTINGS> section. - -=over 4 - -=item B<-text> - -prints out the certificate in text form. Full details are output including the -public key, signature algorithms, issuer and subject names, serial number -any extensions present and any trust settings. - -=item B<-certopt option> - -customise the output format used with B<-text>. The B<option> argument can be -a single option or multiple options separated by commas. The B<-certopt> switch -may be also be used more than once to set multiple options. See the B<TEXT OPTIONS> -section for more information. - -=item B<-noout> - -this option prevents output of the encoded version of the request. - -=item B<-modulus> - -this option prints out the value of the modulus of the public key -contained in the certificate. - -=item B<-serial> - -outputs the certificate serial number. - -=item B<-subject_hash> - -outputs the "hash" of the certificate subject name. This is used in OpenSSL to -form an index to allow certificates in a directory to be looked up by subject -name. - -=item B<-issuer_hash> - -outputs the "hash" of the certificate issuer name. - -=item B<-hash> - -synonym for "-hash" for backward compatibility reasons. - -=item B<-subject> - -outputs the subject name. - -=item B<-issuer> - -outputs the issuer name. - -=item B<-nameopt option> - -option which determines how the subject or issuer names are displayed. The -B<option> argument can be a single option or multiple options separated by -commas. Alternatively the B<-nameopt> switch may be used more than once to -set multiple options. See the B<NAME OPTIONS> section for more information. - -=item B<-email> - -outputs the email address(es) if any. - -=item B<-startdate> - -prints out the start date of the certificate, that is the notBefore date. - -=item B<-enddate> - -prints out the expiry date of the certificate, that is the notAfter date. - -=item B<-dates> - -prints out the start and expiry dates of a certificate. - -=item B<-fingerprint> - -prints out the digest of the DER encoded version of the whole certificate -(see digest options). - -=item B<-C> - -this outputs the certificate in the form of a C source file. - -=back - -=head2 TRUST SETTINGS - -Please note these options are currently experimental and may well change. - -A B<trusted certificate> is an ordinary certificate which has several -additional pieces of information attached to it such as the permitted -and prohibited uses of the certificate and an "alias". - -Normally when a certificate is being verified at least one certificate -must be "trusted". By default a trusted certificate must be stored -locally and must be a root CA: any certificate chain ending in this CA -is then usable for any purpose. - -Trust settings currently are only used with a root CA. They allow a finer -control over the purposes the root CA can be used for. For example a CA -may be trusted for SSL client but not SSL server use. - -See the description of the B<verify> utility for more information on the -meaning of trust settings. - -Future versions of OpenSSL will recognize trust settings on any -certificate: not just root CAs. - - -=over 4 - -=item B<-trustout> - -this causes B<x509> to output a B<trusted> certificate. An ordinary -or trusted certificate can be input but by default an ordinary -certificate is output and any trust settings are discarded. With the -B<-trustout> option a trusted certificate is output. A trusted -certificate is automatically output if any trust settings are modified. - -=item B<-setalias arg> - -sets the alias of the certificate. This will allow the certificate -to be referred to using a nickname for example "Steve's Certificate". - -=item B<-alias> - -outputs the certificate alias, if any. - -=item B<-clrtrust> - -clears all the permitted or trusted uses of the certificate. - -=item B<-clrreject> - -clears all the prohibited or rejected uses of the certificate. - -=item B<-addtrust arg> - -adds a trusted certificate use. Any object name can be used here -but currently only B<clientAuth> (SSL client use), B<serverAuth> -(SSL server use) and B<emailProtection> (S/MIME email) are used. -Other OpenSSL applications may define additional uses. - -=item B<-addreject arg> - -adds a prohibited use. It accepts the same values as the B<-addtrust> -option. - -=item B<-purpose> - -this option performs tests on the certificate extensions and outputs -the results. For a more complete description see the B<CERTIFICATE -EXTENSIONS> section. - -=back - -=head2 SIGNING OPTIONS - -The B<x509> utility can be used to sign certificates and requests: it -can thus behave like a "mini CA". - -=over 4 - -=item B<-signkey filename> - -this option causes the input file to be self signed using the supplied -private key. - -If the input file is a certificate it sets the issuer name to the -subject name (i.e. makes it self signed) changes the public key to the -supplied value and changes the start and end dates. The start date is -set to the current time and the end date is set to a value determined -by the B<-days> option. Any certificate extensions are retained unless -the B<-clrext> option is supplied. - -If the input is a certificate request then a self signed certificate -is created using the supplied private key using the subject name in -the request. - -=item B<-clrext> - -delete any extensions from a certificate. This option is used when a -certificate is being created from another certificate (for example with -the B<-signkey> or the B<-CA> options). Normally all extensions are -retained. - -=item B<-keyform PEM|DER> - -specifies the format (DER or PEM) of the private key file used in the -B<-signkey> option. - -=item B<-days arg> - -specifies the number of days to make a certificate valid for. The default -is 30 days. - -=item B<-x509toreq> - -converts a certificate into a certificate request. The B<-signkey> option -is used to pass the required private key. - -=item B<-req> - -by default a certificate is expected on input. With this option a -certificate request is expected instead. - -=item B<-set_serial n> - -specifies the serial number to use. This option can be used with either -the B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA> -option the serial number file (as specified by the B<-CAserial> or -B<-CAcreateserial> options) is not used. - -The serial number can be decimal or hex (if preceded by B<0x>). Negative -serial numbers can also be specified but their use is not recommended. - -=item B<-CA filename> - -specifies the CA certificate to be used for signing. When this option is -present B<x509> behaves like a "mini CA". The input file is signed by this -CA using this option: that is its issuer name is set to the subject name -of the CA and it is digitally signed using the CAs private key. - -This option is normally combined with the B<-req> option. Without the -B<-req> option the input is a certificate which must be self signed. - -=item B<-CAkey filename> - -sets the CA private key to sign a certificate with. If this option is -not specified then it is assumed that the CA private key is present in -the CA certificate file. - -=item B<-CAserial filename> - -sets the CA serial number file to use. - -When the B<-CA> option is used to sign a certificate it uses a serial -number specified in a file. This file consist of one line containing -an even number of hex digits with the serial number to use. After each -use the serial number is incremented and written out to the file again. - -The default filename consists of the CA certificate file base name with -".srl" appended. For example if the CA certificate file is called -"mycacert.pem" it expects to find a serial number file called "mycacert.srl". - -=item B<-CAcreateserial> - -with this option the CA serial number file is created if it does not exist: -it will contain the serial number "02" and the certificate being signed will -have the 1 as its serial number. Normally if the B<-CA> option is specified -and the serial number file does not exist it is an error. - -=item B<-extfile filename> - -file containing certificate extensions to use. If not specified then -no extensions are added to the certificate. - -=item B<-extensions section> - -the section to add certificate extensions from. If this option is not -specified then the extensions should either be contained in the unnamed -(default) section or the default section should contain a variable called -"extensions" which contains the section to use. - -=back - -=head2 NAME OPTIONS - -The B<nameopt> command line switch determines how the subject and issuer -names are displayed. If no B<nameopt> switch is present the default "oneline" -format is used which is compatible with previous versions of OpenSSL. -Each option is described in detail below, all options can be preceded by -a B<-> to turn the option off. Only the first four will normally be used. - -=over 4 - -=item B<compat> - -use the old format. This is equivalent to specifying no name options at all. - -=item B<RFC2253> - -displays names compatible with RFC2253 equivalent to B<esc_2253>, B<esc_ctrl>, -B<esc_msb>, B<utf8>, B<dump_nostr>, B<dump_unknown>, B<dump_der>, -B<sep_comma_plus>, B<dn_rev> and B<sname>. - -=item B<oneline> - -a oneline format which is more readable than RFC2253. It is equivalent to -specifying the B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>, B<dump_nostr>, -B<dump_der>, B<use_quote>, B<sep_comma_plus_space>, B<space_eq> and B<sname> -options. - -=item B<multiline> - -a multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>, -B<space_eq>, B<lname> and B<align>. - -=item B<esc_2253> - -escape the "special" characters required by RFC2253 in a field That is -B<,+"E<lt>E<gt>;>. Additionally B<#> is escaped at the beginning of a string -and a space character at the beginning or end of a string. - -=item B<esc_ctrl> - -escape control characters. That is those with ASCII values less than -0x20 (space) and the delete (0x7f) character. They are escaped using the -RFC2253 \XX notation (where XX are two hex digits representing the -character value). - -=item B<esc_msb> - -escape characters with the MSB set, that is with ASCII values larger than -127. - -=item B<use_quote> - -escapes some characters by surrounding the whole string with B<"> characters, -without the option all escaping is done with the B<\> character. - -=item B<utf8> - -convert all strings to UTF8 format first. This is required by RFC2253. If -you are lucky enough to have a UTF8 compatible terminal then the use -of this option (and B<not> setting B<esc_msb>) may result in the correct -display of multibyte (international) characters. Is this option is not -present then multibyte characters larger than 0xff will be represented -using the format \UXXXX for 16 bits and \WXXXXXXXX for 32 bits. -Also if this option is off any UTF8Strings will be converted to their -character form first. - -=item B<no_type> - -this option does not attempt to interpret multibyte characters in any -way. That is their content octets are merely dumped as though one octet -represents each character. This is useful for diagnostic purposes but -will result in rather odd looking output. - -=item B<show_type> - -show the type of the ASN1 character string. The type precedes the -field contents. For example "BMPSTRING: Hello World". - -=item B<dump_der> - -when this option is set any fields that need to be hexdumped will -be dumped using the DER encoding of the field. Otherwise just the -content octets will be displayed. Both options use the RFC2253 -B<#XXXX...> format. - -=item B<dump_nostr> - -dump non character string types (for example OCTET STRING) if this -option is not set then non character string types will be displayed -as though each content octet represents a single character. - -=item B<dump_all> - -dump all fields. This option when used with B<dump_der> allows the -DER encoding of the structure to be unambiguously determined. - -=item B<dump_unknown> - -dump any field whose OID is not recognised by OpenSSL. - -=item B<sep_comma_plus>, B<sep_comma_plus_space>, B<sep_semi_plus_space>, -B<sep_multiline> - -these options determine the field separators. The first character is -between RDNs and the second between multiple AVAs (multiple AVAs are -very rare and their use is discouraged). The options ending in -"space" additionally place a space after the separator to make it -more readable. The B<sep_multiline> uses a linefeed character for -the RDN separator and a spaced B<+> for the AVA separator. It also -indents the fields by four characters. - -=item B<dn_rev> - -reverse the fields of the DN. This is required by RFC2253. As a side -effect this also reverses the order of multiple AVAs but this is -permissible. - -=item B<nofname>, B<sname>, B<lname>, B<oid> - -these options alter how the field name is displayed. B<nofname> does -not display the field at all. B<sname> uses the "short name" form -(CN for commonName for example). B<lname> uses the long form. -B<oid> represents the OID in numerical form and is useful for -diagnostic purpose. - -=item B<align> - -align field values for a more readable output. Only usable with -B<sep_multiline>. - -=item B<space_eq> - -places spaces round the B<=> character which follows the field -name. - -=back - -=head2 TEXT OPTIONS - -As well as customising the name output format, it is also possible to -customise the actual fields printed using the B<certopt> options when -the B<text> option is present. The default behaviour is to print all fields. - -=over 4 - -=item B<compatible> - -use the old format. This is equivalent to specifying no output options at all. - -=item B<no_header> - -don't print header information: that is the lines saying "Certificate" and "Data". - -=item B<no_version> - -don't print out the version number. - -=item B<no_serial> - -don't print out the serial number. - -=item B<no_signame> - -don't print out the signature algorithm used. - -=item B<no_validity> - -don't print the validity, that is the B<notBefore> and B<notAfter> fields. - -=item B<no_subject> - -don't print out the subject name. - -=item B<no_issuer> - -don't print out the issuer name. - -=item B<no_pubkey> - -don't print out the public key. - -=item B<no_sigdump> - -don't give a hexadecimal dump of the certificate signature. - -=item B<no_aux> - -don't print out certificate trust information. - -=item B<no_extensions> - -don't print out any X509V3 extensions. - -=item B<ext_default> - -retain default extension behaviour: attempt to print out unsupported certificate extensions. - -=item B<ext_error> - -print an error message for unsupported certificate extensions. - -=item B<ext_parse> - -ASN1 parse unsupported extensions. - -=item B<ext_dump> - -hex dump unsupported extensions. - -=item B<ca_default> - -the value used by the B<ca> utility, equivalent to B<no_issuer>, B<no_pubkey>, B<no_header>, -B<no_version>, B<no_sigdump> and B<no_signame>. - -=back - -=head1 EXAMPLES - -Note: in these examples the '\' means the example should be all on one -line. - -Display the contents of a certificate: - - openssl x509 -in cert.pem -noout -text - -Display the certificate serial number: - - openssl x509 -in cert.pem -noout -serial - -Display the certificate subject name: - - openssl x509 -in cert.pem -noout -subject - -Display the certificate subject name in RFC2253 form: - - openssl x509 -in cert.pem -noout -subject -nameopt RFC2253 - -Display the certificate subject name in oneline form on a terminal -supporting UTF8: - - openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb - -Display the certificate MD5 fingerprint: - - openssl x509 -in cert.pem -noout -fingerprint - -Display the certificate SHA1 fingerprint: - - openssl x509 -sha1 -in cert.pem -noout -fingerprint - -Convert a certificate from PEM to DER format: - - openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER - -Convert a certificate to a certificate request: - - openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem - -Convert a certificate request into a self signed certificate using -extensions for a CA: - - openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \ - -signkey key.pem -out cacert.pem - -Sign a certificate request using the CA certificate above and add user -certificate extensions: - - openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \ - -CA cacert.pem -CAkey key.pem -CAcreateserial - - -Set a certificate to be trusted for SSL client use and change set its alias to -"Steve's Class 1 CA" - - openssl x509 -in cert.pem -addtrust clientAuth \ - -setalias "Steve's Class 1 CA" -out trust.pem - -=head1 NOTES - -The PEM format uses the header and footer lines: - - -----BEGIN CERTIFICATE----- - -----END CERTIFICATE----- - -it will also handle files containing: - - -----BEGIN X509 CERTIFICATE----- - -----END X509 CERTIFICATE----- - -Trusted certificates have the lines - - -----BEGIN TRUSTED CERTIFICATE----- - -----END TRUSTED CERTIFICATE----- - -The conversion to UTF8 format used with the name options assumes that -T61Strings use the ISO8859-1 character set. This is wrong but Netscape -and MSIE do this as do many certificates. So although this is incorrect -it is more likely to display the majority of certificates correctly. - -The B<-fingerprint> option takes the digest of the DER encoded certificate. -This is commonly called a "fingerprint". Because of the nature of message -digests the fingerprint of a certificate is unique to that certificate and -two certificates with the same fingerprint can be considered to be the same. - -The Netscape fingerprint uses MD5 whereas MSIE uses SHA1. - -The B<-email> option searches the subject name and the subject alternative -name extension. Only unique email addresses will be printed out: it will -not print the same address more than once. - -=head1 CERTIFICATE EXTENSIONS - -The B<-purpose> option checks the certificate extensions and determines -what the certificate can be used for. The actual checks done are rather -complex and include various hacks and workarounds to handle broken -certificates and software. - -The same code is used when verifying untrusted certificates in chains -so this section is useful if a chain is rejected by the verify code. - -The basicConstraints extension CA flag is used to determine whether the -certificate can be used as a CA. If the CA flag is true then it is a CA, -if the CA flag is false then it is not a CA. B<All> CAs should have the -CA flag set to true. - -If the basicConstraints extension is absent then the certificate is -considered to be a "possible CA" other extensions are checked according -to the intended use of the certificate. A warning is given in this case -because the certificate should really not be regarded as a CA: however -it is allowed to be a CA to work around some broken software. - -If the certificate is a V1 certificate (and thus has no extensions) and -it is self signed it is also assumed to be a CA but a warning is again -given: this is to work around the problem of Verisign roots which are V1 -self signed certificates. - -If the keyUsage extension is present then additional restraints are -made on the uses of the certificate. A CA certificate B<must> have the -keyCertSign bit set if the keyUsage extension is present. - -The extended key usage extension places additional restrictions on the -certificate uses. If this extension is present (whether critical or not) -the key can only be used for the purposes specified. - -A complete description of each test is given below. The comments about -basicConstraints and keyUsage and V1 certificates above apply to B<all> -CA certificates. - - -=over 4 - -=item B<SSL Client> - -The extended key usage extension must be absent or include the "web client -authentication" OID. keyUsage must be absent or it must have the -digitalSignature bit set. Netscape certificate type must be absent or it must -have the SSL client bit set. - -=item B<SSL Client CA> - -The extended key usage extension must be absent or include the "web client -authentication" OID. Netscape certificate type must be absent or it must have -the SSL CA bit set: this is used as a work around if the basicConstraints -extension is absent. - -=item B<SSL Server> - -The extended key usage extension must be absent or include the "web server -authentication" and/or one of the SGC OIDs. keyUsage must be absent or it -must have the digitalSignature, the keyEncipherment set or both bits set. -Netscape certificate type must be absent or have the SSL server bit set. - -=item B<SSL Server CA> - -The extended key usage extension must be absent or include the "web server -authentication" and/or one of the SGC OIDs. Netscape certificate type must -be absent or the SSL CA bit must be set: this is used as a work around if the -basicConstraints extension is absent. - -=item B<Netscape SSL Server> - -For Netscape SSL clients to connect to an SSL server it must have the -keyEncipherment bit set if the keyUsage extension is present. This isn't -always valid because some cipher suites use the key for digital signing. -Otherwise it is the same as a normal SSL server. - -=item B<Common S/MIME Client Tests> - -The extended key usage extension must be absent or include the "email -protection" OID. Netscape certificate type must be absent or should have the -S/MIME bit set. If the S/MIME bit is not set in netscape certificate type -then the SSL client bit is tolerated as an alternative but a warning is shown: -this is because some Verisign certificates don't set the S/MIME bit. - -=item B<S/MIME Signing> - -In addition to the common S/MIME client tests the digitalSignature bit must -be set if the keyUsage extension is present. - -=item B<S/MIME Encryption> - -In addition to the common S/MIME tests the keyEncipherment bit must be set -if the keyUsage extension is present. - -=item B<S/MIME CA> - -The extended key usage extension must be absent or include the "email -protection" OID. Netscape certificate type must be absent or must have the -S/MIME CA bit set: this is used as a work around if the basicConstraints -extension is absent. - -=item B<CRL Signing> - -The keyUsage extension must be absent or it must have the CRL signing bit -set. - -=item B<CRL Signing CA> - -The normal CA tests apply. Except in this case the basicConstraints extension -must be present. - -=back - -=head1 BUGS - -Extensions in certificates are not transferred to certificate requests and -vice versa. - -It is possible to produce invalid certificates or requests by specifying the -wrong private key or using inconsistent options in some cases: these should -be checked. - -There should be options to explicitly set such things as start and end -dates rather than an offset from the current time. - -The code to implement the verify behaviour described in the B<TRUST SETTINGS> -is currently being developed. It thus describes the intended behaviour rather -than the current behaviour. It is hoped that it will represent reality in -OpenSSL 0.9.5 and later. - -=head1 SEE ALSO - -L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>, -L<gendsa(1)|gendsa(1)>, L<verify(1)|verify(1)> - -=head1 HISTORY - -Before OpenSSL 0.9.8, the default digest for RSA keys was MD5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/apps/x509v3_config.pod b/sys/src/ape/lib/openssl/doc/apps/x509v3_config.pod deleted file mode 100644 index 38c46e85c..000000000 --- a/sys/src/ape/lib/openssl/doc/apps/x509v3_config.pod +++ /dev/null @@ -1,456 +0,0 @@ -=pod - -=for comment openssl_manual_section:5 - -=head1 NAME - -x509v3_config - X509 V3 certificate extension configuration format - -=head1 DESCRIPTION - -Several of the OpenSSL utilities can add extensions to a certificate or -certificate request based on the contents of a configuration file. - -Typically the application will contain an option to point to an extension -section. Each line of the extension section takes the form: - - extension_name=[critical,] extension_options - -If B<critical> is present then the extension will be critical. - -The format of B<extension_options> depends on the value of B<extension_name>. - -There are four main types of extension: I<string> extensions, I<multi-valued> -extensions, I<raw> and I<arbitrary> extensions. - -String extensions simply have a string which contains either the value itself -or how it is obtained. - -For example: - - nsComment="This is a Comment" - -Multi-valued extensions have a short form and a long form. The short form -is a list of names and values: - - basicConstraints=critical,CA:true,pathlen:1 - -The long form allows the values to be placed in a separate section: - - basicConstraints=critical,@bs_section - - [bs_section] - - CA=true - pathlen=1 - -Both forms are equivalent. - -The syntax of raw extensions is governed by the extension code: it can -for example contain data in multiple sections. The correct syntax to -use is defined by the extension code itself: check out the certificate -policies extension for an example. - -If an extension type is unsupported then the I<arbitrary> extension syntax -must be used, see the L<ARBITRART EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details. - -=head1 STANDARD EXTENSIONS - -The following sections describe each supported extension in detail. - -=head2 Basic Constraints. - -This is a multi valued extension which indicates whether a certificate is -a CA certificate. The first (mandatory) name is B<CA> followed by B<TRUE> or -B<FALSE>. If B<CA> is B<TRUE> then an optional B<pathlen> name followed by an -non-negative value can be included. - -For example: - - basicConstraints=CA:TRUE - - basicConstraints=CA:FALSE - - basicConstraints=critical,CA:TRUE, pathlen:0 - -A CA certificate B<must> include the basicConstraints value with the CA field -set to TRUE. An end user certificate must either set CA to FALSE or exclude the -extension entirely. Some software may require the inclusion of basicConstraints -with CA set to FALSE for end entity certificates. - -The pathlen parameter indicates the maximum number of CAs that can appear -below this one in a chain. So if you have a CA with a pathlen of zero it can -only be used to sign end user certificates and not further CAs. - - -=head2 Key Usage. - -Key usage is a multi valued extension consisting of a list of names of the -permitted key usages. - -The supporte names are: digitalSignature, nonRepudiation, keyEncipherment, -dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly -and decipherOnly. - -Examples: - - keyUsage=digitalSignature, nonRepudiation - - keyUsage=critical, keyCertSign - - -=head2 Extended Key Usage. - -This extensions consists of a list of usages indicating purposes for which -the certificate public key can be used for, - -These can either be object short names of the dotted numerical form of OIDs. -While any OID can be used only certain values make sense. In particular the -following PKIX, NS and MS values are meaningful: - - Value Meaning - ----- ------- - serverAuth SSL/TLS Web Server Authentication. - clientAuth SSL/TLS Web Client Authentication. - codeSigning Code signing. - emailProtection E-mail Protection (S/MIME). - timeStamping Trusted Timestamping - msCodeInd Microsoft Individual Code Signing (authenticode) - msCodeCom Microsoft Commercial Code Signing (authenticode) - msCTLSign Microsoft Trust List Signing - msSGC Microsoft Server Gated Crypto - msEFS Microsoft Encrypted File System - nsSGC Netscape Server Gated Crypto - -Examples: - - extendedKeyUsage=critical,codeSigning,1.2.3.4 - extendedKeyUsage=nsSGC,msSGC - - -=head2 Subject Key Identifier. - -This is really a string extension and can take two possible values. Either -the word B<hash> which will automatically follow the guidelines in RFC3280 -or a hex string giving the extension value to include. The use of the hex -string is strongly discouraged. - -Example: - - subjectKeyIdentifier=hash - - -=head2 Authority Key Identifier. - -The authority key identifier extension permits two options. keyid and issuer: -both can take the optional value "always". - -If the keyid option is present an attempt is made to copy the subject key -identifier from the parent certificate. If the value "always" is present -then an error is returned if the option fails. - -The issuer option copies the issuer and serial number from the issuer -certificate. This will only be done if the keyid option fails or -is not included unless the "always" flag will always include the value. - -Example: - - authorityKeyIdentifier=keyid,issuer - - -=head2 Subject Alternative Name. - -The subject alternative name extension allows various literal values to be -included in the configuration file. These include B<email> (an email address) -B<URI> a uniform resource indicator, B<DNS> (a DNS domain name), B<RID> (a -registered ID: OBJECT IDENTIFIER), B<IP> (an IP address), B<dirName> -(a distinguished name) and otherName. - -The email option include a special 'copy' value. This will automatically -include and email addresses contained in the certificate subject name in -the extension. - -The IP address used in the B<IP> options can be in either IPv4 or IPv6 format. - -The value of B<dirName> should point to a section containing the distinguished -name to use as a set of name value pairs. Multi values AVAs can be formed by -preceeding the name with a B<+> character. - -otherName can include arbitrary data associated with an OID: the value -should be the OID followed by a semicolon and the content in standard -ASN1_generate_nconf() format. - -Examples: - - subjectAltName=email:copy,email:my@other.address,URI:http://my.url.here/ - subjectAltName=IP:192.168.7.1 - subjectAltName=IP:13::17 - subjectAltName=email:my@other.address,RID:1.2.3.4 - subjectAltName=otherName:1.2.3.4;UTF8:some other identifier - - subjectAltName=dirName:dir_sect - - [dir_sect] - C=UK - O=My Organization - OU=My Unit - CN=My Name - - -=head2 Issuer Alternative Name. - -The issuer alternative name option supports all the literal options of -subject alternative name. It does B<not> support the email:copy option because -that would not make sense. It does support an additional issuer:copy option -that will copy all the subject alternative name values from the issuer -certificate (if possible). - -Example: - - issuserAltName = issuer:copy - - -=head2 Authority Info Access. - -The authority information access extension gives details about how to access -certain information relating to the CA. Its syntax is accessOID;location -where I<location> has the same syntax as subject alternative name (except -that email:copy is not supported). accessOID can be any valid OID but only -certain values are meaningful, for example OCSP and caIssuers. - -Example: - - authorityInfoAccess = OCSP;URI:http://ocsp.my.host/ - authorityInfoAccess = caIssuers;URI:http://my.ca/ca.html - - -=head2 CRL distribution points. - -This is a multi-valued extension that supports all the literal options of -subject alternative name. Of the few software packages that currently interpret -this extension most only interpret the URI option. - -Currently each option will set a new DistributionPoint with the fullName -field set to the given value. - -Other fields like cRLissuer and reasons cannot currently be set or displayed: -at this time no examples were available that used these fields. - -Examples: - - crlDistributionPoints=URI:http://myhost.com/myca.crl - crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl - -=head2 Certificate Policies. - -This is a I<raw> extension. All the fields of this extension can be set by -using the appropriate syntax. - -If you follow the PKIX recommendations and just using one OID then you just -include the value of that OID. Multiple OIDs can be set separated by commas, -for example: - - certificatePolicies= 1.2.4.5, 1.1.3.4 - -If you wish to include qualifiers then the policy OID and qualifiers need to -be specified in a separate section: this is done by using the @section syntax -instead of a literal OID value. - -The section referred to must include the policy OID using the name -policyIdentifier, cPSuri qualifiers can be included using the syntax: - - CPS.nnn=value - -userNotice qualifiers can be set using the syntax: - - userNotice.nnn=@notice - -The value of the userNotice qualifier is specified in the relevant section. -This section can include explicitText, organization and noticeNumbers -options. explicitText and organization are text strings, noticeNumbers is a -comma separated list of numbers. The organization and noticeNumbers options -(if included) must BOTH be present. If you use the userNotice option with IE5 -then you need the 'ia5org' option at the top level to modify the encoding: -otherwise it will not be interpreted properly. - -Example: - - certificatePolicies=ia5org,1.2.3.4,1.5.6.7.8,@polsect - - [polsect] - - policyIdentifier = 1.3.5.8 - CPS.1="http://my.host.name/" - CPS.2="http://my.your.name/" - userNotice.1=@notice - - [notice] - - explicitText="Explicit Text Here" - organization="Organisation Name" - noticeNumbers=1,2,3,4 - -The B<ia5org> option changes the type of the I<organization> field. In RFC2459 -it can only be of type DisplayText. In RFC3280 IA5Strring is also permissible. -Some software (for example some versions of MSIE) may require ia5org. - -=head2 Policy Constraints - -This is a multi-valued extension which consisting of the names -B<requireExplicitPolicy> or B<inhibitPolicyMapping> and a non negative intger -value. At least one component must be present. - -Example: - - policyConstraints = requireExplicitPolicy:3 - - -=head2 Inhibit Any Policy - -This is a string extension whose value must be a non negative integer. - -Example: - - inhibitAnyPolicy = 2 - - -=head2 Name Constraints - -The name constraints extension is a multi-valued extension. The name should -begin with the word B<permitted> or B<excluded> followed by a B<;>. The rest of -the name and the value follows the syntax of subjectAltName except email:copy -is not supported and the B<IP> form should consist of an IP addresses and -subnet mask separated by a B</>. - -Examples: - - nameConstraints=permitted;IP:192.168.0.0/255.255.0.0 - - nameConstraints=permitted;email:.somedomain.com - - nameConstraints=excluded;email:.com - -=head1 DEPRECATED EXTENSIONS - -The following extensions are non standard, Netscape specific and largely -obsolete. Their use in new applications is discouraged. - -=head2 Netscape String extensions. - -Netscape Comment (B<nsComment>) is a string extension containing a comment -which will be displayed when the certificate is viewed in some browsers. - -Example: - - nsComment = "Some Random Comment" - -Other supported extensions in this category are: B<nsBaseUrl>, -B<nsRevocationUrl>, B<nsCaRevocationUrl>, B<nsRenewalUrl>, B<nsCaPolicyUrl> -and B<nsSslServerName>. - - -=head2 Netscape Certificate Type - -This is a multi-valued extensions which consists of a list of flags to be -included. It was used to indicate the purposes for which a certificate could -be used. The basicConstraints, keyUsage and extended key usage extensions are -now used instead. - -Acceptable values for nsCertType are: B<client>, B<server>, B<email>, -B<objsign>, B<reserved>, B<sslCA>, B<emailCA>, B<objCA>. - - -=head1 ARBITRARY EXTENSIONS - -If an extension is not supported by the OpenSSL code then it must be encoded -using the arbitrary extension format. It is also possible to use the arbitrary -format for supported extensions. Extreme care should be taken to ensure that -the data is formatted correctly for the given extension type. - -There are two ways to encode arbitrary extensions. - -The first way is to use the word ASN1 followed by the extension content -using the same syntax as ASN1_generate_nconf(). For example: - - 1.2.3.4=critical,ASN1:UTF8String:Some random data - - 1.2.3.4=ASN1:SEQUENCE:seq_sect - - [seq_sect] - - field1 = UTF8:field1 - field2 = UTF8:field2 - -It is also possible to use the word DER to include the raw encoded data in any -extension. - - 1.2.3.4=critical,DER:01:02:03:04 - 1.2.3.4=DER:01020304 - -The value following DER is a hex dump of the DER encoding of the extension -Any extension can be placed in this form to override the default behaviour. -For example: - - basicConstraints=critical,DER:00:01:02:03 - -=head1 WARNING - -There is no guarantee that a specific implementation will process a given -extension. It may therefore be sometimes possible to use certificates for -purposes prohibited by their extensions because a specific application does -not recognize or honour the values of the relevant extensions. - -The DER and ASN1 options should be used with caution. It is possible to create -totally invalid extensions if they are not used carefully. - - -=head1 NOTES - -If an extension is multi-value and a field value must contain a comma the long -form must be used otherwise the comma would be misinterpreted as a field -separator. For example: - - subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar - -will produce an error but the equivalent form: - - subjectAltName=@subject_alt_section - - [subject_alt_section] - subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar - -is valid. - -Due to the behaviour of the OpenSSL B<conf> library the same field name -can only occur once in a section. This means that: - - subjectAltName=@alt_section - - [alt_section] - - email=steve@here - email=steve@there - -will only recognize the last value. This can be worked around by using the form: - - [alt_section] - - email.1=steve@here - email.2=steve@there - -=head1 HISTORY - -The X509v3 extension code was first added to OpenSSL 0.9.2. - -Policy mappings, inhibit any policy and name constraints support was added in -OpenSSL 0.9.8 - -The B<directoryName> and B<otherName> option as well as the B<ASN1> option -for arbitrary extensions was added in OpenSSL 0.9.8 - -=head1 SEE ALSO - -L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)> - - -=cut diff --git a/sys/src/ape/lib/openssl/doc/c-indentation.el b/sys/src/ape/lib/openssl/doc/c-indentation.el deleted file mode 100644 index cbf01cb17..000000000 --- a/sys/src/ape/lib/openssl/doc/c-indentation.el +++ /dev/null @@ -1,44 +0,0 @@ -; This Emacs Lisp file defines a C indentation style that closely -; follows most aspects of the one that is used throughout SSLeay, -; and hence in OpenSSL. -; -; This definition is for the "CC mode" package, which is the default -; mode for editing C source files in Emacs 20, not for the older -; c-mode.el (which was the default in less recent releaes of Emacs 19). -; -; Copy the definition in your .emacs file or use M-x eval-buffer. -; To activate this indentation style, visit a C file, type -; M-x c-set-style <RET> (or C-c . for short), and enter "eay". -; To toggle the auto-newline feature of CC mode, type C-c C-a. -; -; Apparently statement blocks that are not introduced by a statement -; such as "if" and that are not the body of a function cannot -; be handled too well by CC mode with this indentation style, -; so you have to indent them manually (you can use C-q tab). -; -; For suggesting improvements, please send e-mail to bodo@openssl.org. - -(c-add-style "eay" - '((c-basic-offset . 8) - (c-comment-only-line-offset . 0) - (c-hanging-braces-alist) - (c-offsets-alist . ((defun-open . +) - (defun-block-intro . 0) - (class-open . +) - (class-close . +) - (block-open . 0) - (block-close . 0) - (substatement-open . +) - (statement . 0) - (statement-block-intro . 0) - (statement-case-open . +) - (statement-case-intro . +) - (case-label . -) - (label . -) - (arglist-cont-nonempty . +) - (topmost-intro . -) - (brace-list-close . 0) - (brace-list-intro . 0) - (brace-list-open . +) - )))) - diff --git a/sys/src/ape/lib/openssl/doc/crypto/ASN1_OBJECT_new.pod b/sys/src/ape/lib/openssl/doc/crypto/ASN1_OBJECT_new.pod deleted file mode 100644 index 51679bfcd..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ASN1_OBJECT_new.pod +++ /dev/null @@ -1,43 +0,0 @@ -=pod - -=head1 NAME - -ASN1_OBJECT_new, ASN1_OBJECT_free, - object allocation functions - -=head1 SYNOPSIS - - ASN1_OBJECT *ASN1_OBJECT_new(void); - void ASN1_OBJECT_free(ASN1_OBJECT *a); - -=head1 DESCRIPTION - -The ASN1_OBJECT allocation routines, allocate and free an -ASN1_OBJECT structure, which represents an ASN1 OBJECT IDENTIFIER. - -ASN1_OBJECT_new() allocates and initializes a ASN1_OBJECT structure. - -ASN1_OBJECT_free() frees up the B<ASN1_OBJECT> structure B<a>. - -=head1 NOTES - -Although ASN1_OBJECT_new() allocates a new ASN1_OBJECT structure it -is almost never used in applications. The ASN1 object utility functions -such as OBJ_nid2obj() are used instead. - -=head1 RETURN VALUES - -If the allocation fails, ASN1_OBJECT_new() returns B<NULL> and sets an error -code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. -Otherwise it returns a pointer to the newly allocated structure. - -ASN1_OBJECT_free() returns no value. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_ASN1_OBJECT(3)|d2i_ASN1_OBJECT(3)> - -=head1 HISTORY - -ASN1_OBJECT_new() and ASN1_OBJECT_free() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_length.pod b/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_length.pod deleted file mode 100644 index c4ec693f1..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_length.pod +++ /dev/null @@ -1,81 +0,0 @@ -=pod - -=head1 NAME - -ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length, -ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data - -ASN1_STRING utility functions - -=head1 SYNOPSIS - - int ASN1_STRING_length(ASN1_STRING *x); - unsigned char * ASN1_STRING_data(ASN1_STRING *x); - - ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); - - int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); - - int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); - - int ASN1_STRING_type(ASN1_STRING *x); - - int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); - -=head1 DESCRIPTION - -These functions allow an B<ASN1_STRING> structure to be manipulated. - -ASN1_STRING_length() returns the length of the content of B<x>. - -ASN1_STRING_data() returns an internal pointer to the data of B<x>. -Since this is an internal pointer it should B<not> be freed or -modified in any way. - -ASN1_STRING_dup() returns a copy of the structure B<a>. - -ASN1_STRING_cmp() compares B<a> and B<b> returning 0 if the two -are identical. The string types and content are compared. - -ASN1_STRING_set() sets the data of string B<str> to the buffer -B<data> or length B<len>. The supplied data is copied. If B<len> -is -1 then the length is determined by strlen(data). - -ASN1_STRING_type() returns the type of B<x>, using standard constants -such as B<V_ASN1_OCTET_STRING>. - -ASN1_STRING_to_UTF8() converts the string B<in> to UTF8 format, the -converted data is allocated in a buffer in B<*out>. The length of -B<out> is returned or a negative error code. The buffer B<*out> -should be free using OPENSSL_free(). - -=head1 NOTES - -Almost all ASN1 types in OpenSSL are represented as an B<ASN1_STRING> -structure. Other types such as B<ASN1_OCTET_STRING> are simply typedefed -to B<ASN1_STRING> and the functions call the B<ASN1_STRING> equivalents. -B<ASN1_STRING> is also used for some B<CHOICE> types which consist -entirely of primitive string types such as B<DirectoryString> and -B<Time>. - -These functions should B<not> be used to examine or modify B<ASN1_INTEGER> -or B<ASN1_ENUMERATED> types: the relevant B<INTEGER> or B<ENUMERATED> -utility functions should be used instead. - -In general it cannot be assumed that the data returned by ASN1_STRING_data() -is null terminated or does not contain embedded nulls. The actual format -of the data will depend on the actual string type itself: for example -for and IA5String the data will be ASCII, for a BMPString two bytes per -character in big endian format, UTF8String will be in UTF8 format. - -Similar care should be take to ensure the data is in the correct format -when calling ASN1_STRING_set(). - -=head1 RETURN VALUES - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_new.pod b/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_new.pod deleted file mode 100644 index 5b1bbb7eb..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_new.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free - -ASN1_STRING allocation functions - -=head1 SYNOPSIS - - ASN1_STRING * ASN1_STRING_new(void); - ASN1_STRING * ASN1_STRING_type_new(int type); - void ASN1_STRING_free(ASN1_STRING *a); - -=head1 DESCRIPTION - -ASN1_STRING_new() returns an allocated B<ASN1_STRING> structure. Its type -is undefined. - -ASN1_STRING_type_new() returns an allocated B<ASN1_STRING> structure of -type B<type>. - -ASN1_STRING_free() frees up B<a>. - -=head1 NOTES - -Other string types call the B<ASN1_STRING> functions. For example -ASN1_OCTET_STRING_new() calls ASN1_STRING_type(V_ASN1_OCTET_STRING). - -=head1 RETURN VALUES - -ASN1_STRING_new() and ASN1_STRING_type_new() return a valid -ASN1_STRING structure or B<NULL> if an error occurred. - -ASN1_STRING_free() does not return a value. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_print_ex.pod b/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_print_ex.pod deleted file mode 100644 index 3891b8879..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ASN1_STRING_print_ex.pod +++ /dev/null @@ -1,96 +0,0 @@ -=pod - -=head1 NAME - -ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp - ASN1_STRING output routines. - -=head1 SYNOPSIS - - #include <openssl/asn1.h> - - int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); - int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); - int ASN1_STRING_print(BIO *out, ASN1_STRING *str); - - -=head1 DESCRIPTION - -These functions output an B<ASN1_STRING> structure. B<ASN1_STRING> is used to -represent all the ASN1 string types. - -ASN1_STRING_print_ex() outputs B<str> to B<out>, the format is determined by -the options B<flags>. ASN1_STRING_print_ex_fp() is identical except it outputs -to B<fp> instead. - -ASN1_STRING_print() prints B<str> to B<out> but using a different format to -ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF) -with '.'. - -=head1 NOTES - -ASN1_STRING_print() is a legacy function which should be avoided in new applications. - -Although there are a large number of options frequently B<ASN1_STRFLGS_RFC2253> is -suitable, or on UTF8 terminals B<ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB>. - -The complete set of supported options for B<flags> is listed below. - -Various characters can be escaped. If B<ASN1_STRFLGS_ESC_2253> is set the characters -determined by RFC2253 are escaped. If B<ASN1_STRFLGS_ESC_CTRL> is set control -characters are escaped. If B<ASN1_STRFLGS_ESC_MSB> is set characters with the -MSB set are escaped: this option should B<not> be used if the terminal correctly -interprets UTF8 sequences. - -Escaping takes several forms. - -If the character being escaped is a 16 bit character then the form "\UXXXX" is used -using exactly four characters for the hex representation. If it is 32 bits then -"\WXXXXXXXX" is used using eight characters of its hex representation. These forms -will only be used if UTF8 conversion is not set (see below). - -Printable characters are normally escaped using the backslash '\' character. If -B<ASN1_STRFLGS_ESC_QUOTE> is set then the whole string is instead surrounded by -double quote characters: this is arguably more readable than the backslash -notation. Other characters use the "\XX" using exactly two characters of the hex -representation. - -If B<ASN1_STRFLGS_UTF8_CONVERT> is set then characters are converted to UTF8 -format first. If the terminal supports the display of UTF8 sequences then this -option will correctly display multi byte characters. - -If B<ASN1_STRFLGS_IGNORE_TYPE> is set then the string type is not interpreted at -all: everything is assumed to be one byte per character. This is primarily for -debugging purposes and can result in confusing output in multi character strings. - -If B<ASN1_STRFLGS_SHOW_TYPE> is set then the string type itself is printed out -before its value (for example "BMPSTRING"), this actually uses ASN1_tag2str(). - -The content of a string instead of being interpreted can be "dumped": this just -outputs the value of the string using the form #XXXX using hex format for each -octet. - -If B<ASN1_STRFLGS_DUMP_ALL> is set then any type is dumped. - -Normally non character string types (such as OCTET STRING) are assumed to be -one byte per character, if B<ASN1_STRFLGS_DUMP_UNKNOWN> is set then they will -be dumped instead. - -When a type is dumped normally just the content octets are printed, if -B<ASN1_STRFLGS_DUMP_DER> is set then the complete encoding is dumped -instead (including tag and length octets). - -B<ASN1_STRFLGS_RFC2253> includes all the flags required by RFC2253. It is -equivalent to: - ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | - ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER - -=head1 SEE ALSO - -L<X509_NAME_print_ex(3)|X509_NAME_print_ex(3)>, -L<ASN1_tag2str(3)|ASN1_tag2str(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ASN1_generate_nconf.pod b/sys/src/ape/lib/openssl/doc/crypto/ASN1_generate_nconf.pod deleted file mode 100644 index ba6e3c2e8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ASN1_generate_nconf.pod +++ /dev/null @@ -1,253 +0,0 @@ -=pod - -=head1 NAME - -ASN1_generate_nconf, ASN1_generate_v3 - ASN1 generation functions - -=head1 SYNOPSIS - - ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); - ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); - -=head1 DESCRIPTION - -These functions generate the ASN1 encoding of a string -in an B<ASN1_TYPE> structure. - -B<str> contains the string to encode B<nconf> or B<cnf> contains -the optional configuration information where additional strings -will be read from. B<nconf> will typically come from a config -file wherease B<cnf> is obtained from an B<X509V3_CTX> structure -which will typically be used by X509 v3 certificate extension -functions. B<cnf> or B<nconf> can be set to B<NULL> if no additional -configuration will be used. - -=head1 GENERATION STRING FORMAT - -The actual data encoded is determined by the string B<str> and -the configuration information. The general format of the string -is: - - B<[modifier,]type[:value]> - -That is zero or more comma separated modifiers followed by a type -followed by an optional colon and a value. The formats of B<type>, -B<value> and B<modifier> are explained below. - -=head2 SUPPORTED TYPES - -The supported types are listed below. Unless otherwise specified -only the B<ASCII> format is permissible. - -=over 2 - -=item B<BOOLEAN>, B<BOOL> - -This encodes a boolean type. The B<value> string is mandatory and -should be B<TRUE> or B<FALSE>. Additionally B<TRUE>, B<true>, B<Y>, -B<y>, B<YES>, B<yes>, B<FALSE>, B<false>, B<N>, B<n>, B<NO> and B<no> -are acceptable. - -=item B<NULL> - -Encode the B<NULL> type, the B<value> string must not be present. - -=item B<INTEGER>, B<INT> - -Encodes an ASN1 B<INTEGER> type. The B<value> string represents -the value of the integer, it can be preceeded by a minus sign and -is normally interpreted as a decimal value unless the prefix B<0x> -is included. - -=item B<ENUMERATED>, B<ENUM> - -Encodes the ASN1 B<ENUMERATED> type, it is otherwise identical to -B<INTEGER>. - -=item B<OBJECT>, B<OID> - -Encodes an ASN1 B<OBJECT IDENTIFIER>, the B<value> string can be -a short name, a long name or numerical format. - -=item B<UTCTIME>, B<UTC> - -Encodes an ASN1 B<UTCTime> structure, the value should be in -the format B<YYMMDDHHMMSSZ>. - -=item B<GENERALIZEDTIME>, B<GENTIME> - -Encodes an ASN1 B<GeneralizedTime> structure, the value should be in -the format B<YYYYMMDDHHMMSSZ>. - -=item B<OCTETSTRING>, B<OCT> - -Emcodes an ASN1 B<OCTET STRING>. B<value> represents the contents -of this structure, the format strings B<ASCII> and B<HEX> can be -used to specify the format of B<value>. - -=item B<BITSRING>, B<BITSTR> - -Emcodes an ASN1 B<BIT STRING>. B<value> represents the contents -of this structure, the format strings B<ASCII>, B<HEX> and B<BITLIST> -can be used to specify the format of B<value>. - -If the format is anything other than B<BITLIST> the number of unused -bits is set to zero. - -=item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>, -B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>, -B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>, -B<T61STRING>, B<TELETEXSTRING>, B<GeneralString> - -These encode the corresponding string types. B<value> represents the -contents of this structure. The format can be B<ASCII> or B<UTF8>. - -=item B<SEQUENCE>, B<SEQ>, B<SET> - -Formats the result as an ASN1 B<SEQUENCE> or B<SET> type. B<value> -should be a section name which will contain the contents. The -field names in the section are ignored and the values are in the -generated string format. If B<value> is absent then an empty SEQUENCE -will be encoded. - -=back - -=head2 MODIFIERS - -Modifiers affect the following structure, they can be used to -add EXPLICIT or IMPLICIT tagging, add wrappers or to change -the string format of the final type and value. The supported -formats are documented below. - -=over 2 - -=item B<EXPLICIT>, B<EXP> - -Add an explicit tag to the following structure. This string -should be followed by a colon and the tag value to use as a -decimal value. - -By following the number with B<U>, B<A>, B<P> or B<C> UNIVERSAL, -APPLICATION, PRIVATE or CONTEXT SPECIFIC tagging can be used, -the default is CONTEXT SPECIFIC. - -=item B<IMPLICIT>, B<IMP> - -This is the same as B<EXPLICIT> except IMPLICIT tagging is used -instead. - -=item B<OCTWRAP>, B<SEQWRAP>, B<SETWRAP>, B<BITWRAP> - -The following structure is surrounded by an OCTET STRING, a SEQUENCE, -a SET or a BIT STRING respectively. For a BIT STRING the number of unused -bits is set to zero. - -=item B<FORMAT> - -This specifies the format of the ultimate value. It should be followed -by a colon and one of the strings B<ASCII>, B<UTF8>, B<HEX> or B<BITLIST>. - -If no format specifier is included then B<ASCII> is used. If B<UTF8> is specified -then the value string must be a valid B<UTF8> string. For B<HEX> the output must -be a set of hex digits. B<BITLIST> (which is only valid for a BIT STRING) is a -comma separated list of set bits. - -=back - -=head1 EXAMPLES - -A simple IA5String: - - IA5STRING:Hello World - -An IA5String explicitly tagged: - - EXPLICIT:0,IA5STRING:Hello World - -An IA5String explicitly tagged using APPLICATION tagging: - - EXPLICIT:0A,IA5STRING:Hello World - -A more complex example using a config file to produce a -SEQUENCE consiting of a BOOL an OID and a UTF8String: - -asn1 = SEQUENCE:seq_section - -[seq_section] - -field1 = BOOLEAN:TRUE -field2 = OID:commonName -field3 = UTF8:Third field - -This example produces an RSAPrivateKey structure, this is the -key contained in the file client.pem in all OpenSSL distributions -(note: the field names such as 'coeff' are ignored and are present just -for clarity): - - asn1=SEQUENCE:private_key - [private_key] - version=INTEGER:0 - - n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\ - D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9 - - e=INTEGER:0x010001 - - d=INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A52F4A\ - F810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D - - p=INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083DA912\ - D4BD57 - - q=INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7FE467\ - 46EC4F - - exp1=INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4ABEA\ - 9C0A39B9 - - exp2=INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E397779\ - E7B2458F - - coeff=INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\ - 628657053A - -This example is the corresponding public key in a SubjectPublicKeyInfo -structure: - - # Start with a SEQUENCE - asn1=SEQUENCE:pubkeyinfo - - # pubkeyinfo contains an algorithm identifier and the public key wrapped - # in a BIT STRING - [pubkeyinfo] - algorithm=SEQUENCE:rsa_alg - pubkey=BITWRAP,SEQUENCE:rsapubkey - - # algorithm ID for RSA is just an OID and a NULL - [rsa_alg] - algorithm=OID:rsaEncryption - parameter=NULL - - # Actual public key: modulus and exponent - [rsapubkey] - n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\ - D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9 - - e=INTEGER:0x010001 - -=head1 RETURN VALUES - -ASN1_generate_nconf() and ASN1_generate_v3() return the encoded -data as an B<ASN1_TYPE> structure or B<NULL> if an error occurred. - -The error codes that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -ASN1_generate_nconf() and ASN1_generate_v3() were added to OpenSSL 0.9.8 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_ctrl.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_ctrl.pod deleted file mode 100644 index 722e8b8f4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_ctrl.pod +++ /dev/null @@ -1,128 +0,0 @@ -=pod - -=head1 NAME - -BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, -BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, -BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, -BIO_get_info_callback, BIO_set_info_callback - BIO control operations - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); - long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); - char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); - long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); - - int BIO_reset(BIO *b); - int BIO_seek(BIO *b, int ofs); - int BIO_tell(BIO *b); - int BIO_flush(BIO *b); - int BIO_eof(BIO *b); - int BIO_set_close(BIO *b,long flag); - int BIO_get_close(BIO *b); - int BIO_pending(BIO *b); - int BIO_wpending(BIO *b); - size_t BIO_ctrl_pending(BIO *b); - size_t BIO_ctrl_wpending(BIO *b); - - int BIO_get_info_callback(BIO *b,bio_info_cb **cbp); - int BIO_set_info_callback(BIO *b,bio_info_cb *cb); - - typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3); - -=head1 DESCRIPTION - -BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() -are BIO "control" operations taking arguments of various types. -These functions are not normally called directly, various macros -are used instead. The standard macros are described below, macros -specific to a particular type of BIO are described in the specific -BIOs manual page as well as any special features of the standard -calls. - -BIO_reset() typically resets a BIO to some initial state, in the case -of file related BIOs for example it rewinds the file pointer to the -start of the file. - -BIO_seek() resets a file related BIO's (that is file descriptor and -FILE BIOs) file position pointer to B<ofs> bytes from start of file. - -BIO_tell() returns the current file position of a file related BIO. - -BIO_flush() normally writes out any internally buffered data, in some -cases it is used to signal EOF and that no more data will be written. - -BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of -"EOF" varies according to the BIO type. - -BIO_set_close() sets the BIO B<b> close flag to B<flag>. B<flag> can -take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used -in a source/sink BIO to indicate that the underlying I/O stream should -be closed when the BIO is freed. - -BIO_get_close() returns the BIOs close flag. - -BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() -return the number of pending characters in the BIOs read and write buffers. -Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() -return a size_t type and are functions, BIO_pending() and BIO_wpending() are -macros which call BIO_ctrl(). - -=head1 RETURN VALUES - -BIO_reset() normally returns 1 for success and 0 or -1 for failure. File -BIOs are an exception, they return 0 for success and -1 for failure. - -BIO_seek() and BIO_tell() both return the current file position on success -and -1 for failure, except file BIOs which for BIO_seek() always return 0 -for success and -1 for failure. - -BIO_flush() returns 1 for success and 0 or -1 for failure. - -BIO_eof() returns 1 if EOF has been reached 0 otherwise. - -BIO_set_close() always returns 1. - -BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. - -BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() -return the amount of pending data. - -=head1 NOTES - -BIO_flush(), because it can write data may return 0 or -1 indicating -that the call should be retried later in a similar manner to BIO_write(). -The BIO_should_retry() call should be used and appropriate action taken -is the call fails. - -The return values of BIO_pending() and BIO_wpending() may not reliably -determine the amount of pending data in all cases. For example in the -case of a file BIO some data may be available in the FILE structures -internal buffers but it is not possible to determine this in a -portably way. For other types of BIO they may not be supported. - -Filter BIOs if they do not internally handle a particular BIO_ctrl() -operation usually pass the operation to the next BIO in the chain. -This often means there is no need to locate the required BIO for -a particular operation, it can be called on a chain and it will -be automatically passed to the relevant BIO. However this can cause -unexpected results: for example no current filter BIOs implement -BIO_seek(), but this may still succeed if the chain ends in a FILE -or file descriptor BIO. - -Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl() -operation. - -=head1 BUGS - -Some of the return values are ambiguous and care should be taken. In -particular a return value of 0 can be returned if an operation is not -supported, if an error occurred, if EOF has not been reached and in -the case of BIO_seek() on a file BIO for a successful operation. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_base64.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_base64.pod deleted file mode 100644 index 438af3b6b..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_base64.pod +++ /dev/null @@ -1,81 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_base64 - base64 BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_base64(void); - -=head1 DESCRIPTION - -BIO_f_base64() returns the base64 BIO method. This is a filter -BIO that base64 encodes any data written through it and decodes -any data read through it. - -Base64 BIOs do not support BIO_gets() or BIO_puts(). - -BIO_flush() on a base64 BIO that is being written through is -used to signal that no more data is to be encoded: this is used -to flush the final block through the BIO. - -The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags() -to encode the data all on one line or expect the data to be all -on one line. - -=head1 NOTES - -Because of the format of base64 encoding the end of the encoded -block cannot always be reliably determined. - -=head1 RETURN VALUES - -BIO_f_base64() returns the base64 BIO method. - -=head1 EXAMPLES - -Base64 encode the string "Hello World\n" and write the result -to standard output: - - BIO *bio, *b64; - char message[] = "Hello World \n"; - - b64 = BIO_new(BIO_f_base64()); - bio = BIO_new_fp(stdout, BIO_NOCLOSE); - bio = BIO_push(b64, bio); - BIO_write(bio, message, strlen(message)); - BIO_flush(bio); - - BIO_free_all(bio); - -Read Base64 encoded data from standard input and write the decoded -data to standard output: - - BIO *bio, *b64, *bio_out; - char inbuf[512]; - int inlen; - - b64 = BIO_new(BIO_f_base64()); - bio = BIO_new_fp(stdin, BIO_NOCLOSE); - bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); - bio = BIO_push(b64, bio); - while((inlen = BIO_read(bio, inbuf, 512)) > 0) - BIO_write(bio_out, inbuf, inlen); - - BIO_free_all(bio); - -=head1 BUGS - -The ambiguity of EOF in base64 encoded data can cause additional -data following the base64 encoded block to be misinterpreted. - -There should be some way of specifying a test that the BIO can perform -to reliably determine EOF (for example a MIME boundary). - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_buffer.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_buffer.pod deleted file mode 100644 index c9093c6a5..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_buffer.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_buffer - buffering BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_f_buffer(void); - - #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) - #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) - #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) - #define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) - #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -=head1 DESCRIPTION - -BIO_f_buffer() returns the buffering BIO method. - -Data written to a buffering BIO is buffered and periodically written -to the next BIO in the chain. Data read from a buffering BIO comes from -an internal buffer which is filled from the next BIO in the chain. -Both BIO_gets() and BIO_puts() are supported. - -Calling BIO_reset() on a buffering BIO clears any buffered data. - -BIO_get_buffer_num_lines() returns the number of lines currently buffered. - -BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() -set the read, write or both read and write buffer sizes to B<size>. The initial -buffer size is DEFAULT_BUFFER_SIZE, currently 1024. Any attempt to reduce the -buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared -when the buffer is resized. - -BIO_set_buffer_read_data() clears the read buffer and fills it with B<num> -bytes of B<buf>. If B<num> is larger than the current buffer size the buffer -is expanded. - -=head1 NOTES - -Buffering BIOs implement BIO_gets() by using BIO_read() operations on the -next BIO in the chain. By prepending a buffering BIO to a chain it is therefore -possible to provide BIO_gets() functionality if the following BIOs do not -support it (for example SSL BIOs). - -Data is only written to the next BIO in the chain when the write buffer fills -or when BIO_flush() is called. It is therefore important to call BIO_flush() -whenever any pending data should be written such as when removing a buffering -BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate -source/sink BIO is non blocking. - -=head1 RETURN VALUES - -BIO_f_buffer() returns the buffering BIO method. - -BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0). - -BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() -return 1 if the buffer was successfully resized or 0 for failure. - -BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if -there was an error. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_cipher.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_cipher.pod deleted file mode 100644 index 02439cea9..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_cipher.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_cipher(void); - void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, - unsigned char *key, unsigned char *iv, int enc); - int BIO_get_cipher_status(BIO *b) - int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx) - -=head1 DESCRIPTION - -BIO_f_cipher() returns the cipher BIO method. This is a filter -BIO that encrypts any data written through it, and decrypts any data -read from it. It is a BIO wrapper for the cipher routines -EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal(). - -Cipher BIOs do not support BIO_gets() or BIO_puts(). - -BIO_flush() on an encryption BIO that is being written through is -used to signal that no more data is to be encrypted: this is used -to flush and possibly pad the final block through the BIO. - -BIO_set_cipher() sets the cipher of BIO B<b> to B<cipher> using key B<key> -and IV B<iv>. B<enc> should be set to 1 for encryption and zero for -decryption. - -When reading from an encryption BIO the final block is automatically -decrypted and checked when EOF is detected. BIO_get_cipher_status() -is a BIO_ctrl() macro which can be called to determine whether the -decryption operation was successful. - -BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal -BIO cipher context. The retrieved context can be used in conjunction -with the standard cipher routines to set it up. This is useful when -BIO_set_cipher() is not flexible enough for the applications needs. - -=head1 NOTES - -When encrypting BIO_flush() B<must> be called to flush the final block -through the BIO. If it is not then the final block will fail a subsequent -decrypt. - -When decrypting an error on the final block is signalled by a zero -return value from the read operation. A successful decrypt followed -by EOF will also return zero for the final read. BIO_get_cipher_status() -should be called to determine if the decrypt was successful. - -As always, if BIO_gets() or BIO_puts() support is needed then it can -be achieved by preceding the cipher BIO with a buffering BIO. - -=head1 RETURN VALUES - -BIO_f_cipher() returns the cipher BIO method. - -BIO_set_cipher() does not return a value. - -BIO_get_cipher_status() returns 1 for a successful decrypt and 0 -for failure. - -BIO_get_cipher_ctx() currently always returns 1. - -=head1 EXAMPLES - -TBA - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_md.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_md.pod deleted file mode 100644 index 0d24083e6..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_md.pod +++ /dev/null @@ -1,138 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_md(void); - int BIO_set_md(BIO *b,EVP_MD *md); - int BIO_get_md(BIO *b,EVP_MD **mdp); - int BIO_get_md_ctx(BIO *b,EVP_MD_CTX **mdcp); - -=head1 DESCRIPTION - -BIO_f_md() returns the message digest BIO method. This is a filter -BIO that digests any data passed through it, it is a BIO wrapper -for the digest routines EVP_DigestInit(), EVP_DigestUpdate() -and EVP_DigestFinal(). - -Any data written or read through a digest BIO using BIO_read() and -BIO_write() is digested. - -BIO_gets(), if its B<size> parameter is large enough finishes the -digest calculation and returns the digest value. BIO_puts() is -not supported. - -BIO_reset() reinitialises a digest BIO. - -BIO_set_md() sets the message digest of BIO B<b> to B<md>: this -must be called to initialize a digest BIO before any data is -passed through it. It is a BIO_ctrl() macro. - -BIO_get_md() places the a pointer to the digest BIOs digest method -in B<mdp>, it is a BIO_ctrl() macro. - -BIO_get_md_ctx() returns the digest BIOs context into B<mdcp>. - -=head1 NOTES - -The context returned by BIO_get_md_ctx() can be used in calls -to EVP_DigestFinal() and also the signature routines EVP_SignFinal() -and EVP_VerifyFinal(). - -The context returned by BIO_get_md_ctx() is an internal context -structure. Changes made to this context will affect the digest -BIO itself and the context pointer will become invalid when the digest -BIO is freed. - -After the digest has been retrieved from a digest BIO it must be -reinitialized by calling BIO_reset(), or BIO_set_md() before any more -data is passed through it. - -If an application needs to call BIO_gets() or BIO_puts() through -a chain containing digest BIOs then this can be done by prepending -a buffering BIO. - -=head1 RETURN VALUES - -BIO_f_md() returns the digest BIO method. - -BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and -0 for failure. - -=head1 EXAMPLES - -The following example creates a BIO chain containing an SHA1 and MD5 -digest BIO and passes the string "Hello World" through it. Error -checking has been omitted for clarity. - - BIO *bio, *mdtmp; - char message[] = "Hello World"; - bio = BIO_new(BIO_s_null()); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_sha1()); - /* For BIO_push() we want to append the sink BIO and keep a note of - * the start of the chain. - */ - bio = BIO_push(mdtmp, bio); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_md5()); - bio = BIO_push(mdtmp, bio); - /* Note: mdtmp can now be discarded */ - BIO_write(bio, message, strlen(message)); - -The next example digests data by reading through a chain instead: - - BIO *bio, *mdtmp; - char buf[1024]; - int rdlen; - bio = BIO_new_file(file, "rb"); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_sha1()); - bio = BIO_push(mdtmp, bio); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_md5()); - bio = BIO_push(mdtmp, bio); - do { - rdlen = BIO_read(bio, buf, sizeof(buf)); - /* Might want to do something with the data here */ - } while(rdlen > 0); - -This next example retrieves the message digests from a BIO chain and -outputs them. This could be used with the examples above. - - BIO *mdtmp; - unsigned char mdbuf[EVP_MAX_MD_SIZE]; - int mdlen; - int i; - mdtmp = bio; /* Assume bio has previously been set up */ - do { - EVP_MD *md; - mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD); - if(!mdtmp) break; - BIO_get_md(mdtmp, &md); - printf("%s digest", OBJ_nid2sn(EVP_MD_type(md))); - mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE); - for(i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]); - printf("\n"); - mdtmp = BIO_next(mdtmp); - } while(mdtmp); - - BIO_free_all(bio); - -=head1 BUGS - -The lack of support for BIO_puts() and the non standard behaviour of -BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets() -and BIO_puts() should be passed to the next BIO in the chain and digest -the data passed through and that digests should be retrieved using a -separate BIO_ctrl() call. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_null.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_null.pod deleted file mode 100644 index b057c1840..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_null.pod +++ /dev/null @@ -1,32 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_null - null filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_f_null(void); - -=head1 DESCRIPTION - -BIO_f_null() returns the null filter BIO method. This is a filter BIO -that does nothing. - -All requests to a null filter BIO are passed through to the next BIO in -the chain: this means that a BIO chain containing a null filter BIO -behaves just as though the BIO was not there. - -=head1 NOTES - -As may be apparent a null filter BIO is not particularly useful. - -=head1 RETURN VALUES - -BIO_f_null() returns the null filter BIO method. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_ssl.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_f_ssl.pod deleted file mode 100644 index f0b731731..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_f_ssl.pod +++ /dev/null @@ -1,313 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, -BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, -BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, -BIO_ssl_shutdown - SSL BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/ssl.h> - - BIO_METHOD *BIO_f_ssl(void); - - #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) - #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) - #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) - #define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); - #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); - #define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL); - - BIO *BIO_new_ssl(SSL_CTX *ctx,int client); - BIO *BIO_new_ssl_connect(SSL_CTX *ctx); - BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); - int BIO_ssl_copy_session_id(BIO *to,BIO *from); - void BIO_ssl_shutdown(BIO *bio); - - #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -=head1 DESCRIPTION - -BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which -is a wrapper round the OpenSSL SSL routines adding a BIO "flavour" to -SSL I/O. - -I/O performed on an SSL BIO communicates using the SSL protocol with -the SSLs read and write BIOs. If an SSL connection is not established -then an attempt is made to establish one on the first I/O call. - -If a BIO is appended to an SSL BIO using BIO_push() it is automatically -used as the SSL BIOs read and write BIOs. - -Calling BIO_reset() on an SSL BIO closes down any current SSL connection -by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in -the chain: this will typically disconnect the underlying transport. -The SSL BIO is then reset to the initial accept or connect state. - -If the close flag is set when an SSL BIO is freed then the internal -SSL structure is also freed using SSL_free(). - -BIO_set_ssl() sets the internal SSL pointer of BIO B<b> to B<ssl> using -the close flag B<c>. - -BIO_get_ssl() retrieves the SSL pointer of BIO B<b>, it can then be -manipulated using the standard SSL library functions. - -BIO_set_ssl_mode() sets the SSL BIO mode to B<client>. If B<client> -is 1 client mode is set. If B<client> is 0 server mode is set. - -BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count -to B<num>. When set after every B<num> bytes of I/O (read and write) -the SSL session is automatically renegotiated. B<num> must be at -least 512 bytes. - -BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout to -B<seconds>. When the renegotiate timeout elapses the session is -automatically renegotiated. - -BIO_get_num_renegotiates() returns the total number of session -renegotiations due to I/O or timeout. - -BIO_new_ssl() allocates an SSL BIO using SSL_CTX B<ctx> and using -client mode if B<client> is non zero. - -BIO_new_ssl_connect() creates a new BIO chain consisting of an -SSL BIO (using B<ctx>) followed by a connect BIO. - -BIO_new_buffer_ssl_connect() creates a new BIO chain consisting -of a buffering BIO, an SSL BIO (using B<ctx>) and a connect -BIO. - -BIO_ssl_copy_session_id() copies an SSL session id between -BIO chains B<from> and B<to>. It does this by locating the -SSL BIOs in each chain and calling SSL_copy_session_id() on -the internal SSL pointer. - -BIO_ssl_shutdown() closes down an SSL connection on BIO -chain B<bio>. It does this by locating the SSL BIO in the -chain and calling SSL_shutdown() on its internal SSL -pointer. - -BIO_do_handshake() attempts to complete an SSL handshake on the -supplied BIO and establish the SSL connection. It returns 1 -if the connection was established successfully. A zero or negative -value is returned if the connection could not be established, the -call BIO_should_retry() should be used for non blocking connect BIOs -to determine if the call should be retried. If an SSL connection has -already been established this call has no effect. - -=head1 NOTES - -SSL BIOs are exceptional in that if the underlying transport -is non blocking they can still request a retry in exceptional -circumstances. Specifically this will happen if a session -renegotiation takes place during a BIO_read() operation, one -case where this happens is when SGC or step up occurs. - -In OpenSSL 0.9.6 and later the SSL flag SSL_AUTO_RETRY can be -set to disable this behaviour. That is when this flag is set -an SSL BIO using a blocking transport will never request a -retry. - -Since unknown BIO_ctrl() operations are sent through filter -BIOs the servers name and port can be set using BIO_set_host() -on the BIO returned by BIO_new_ssl_connect() without having -to locate the connect BIO first. - -Applications do not have to call BIO_do_handshake() but may wish -to do so to separate the handshake process from other I/O -processing. - -=head1 RETURN VALUES - -TBA - -=head1 EXAMPLE - -This SSL/TLS client example, attempts to retrieve a page from an -SSL/TLS web server. The I/O routines are identical to those of the -unencrypted example in L<BIO_s_connect(3)|BIO_s_connect(3)>. - - BIO *sbio, *out; - int len; - char tmpbuf[1024]; - SSL_CTX *ctx; - SSL *ssl; - - ERR_load_crypto_strings(); - ERR_load_SSL_strings(); - OpenSSL_add_all_algorithms(); - - /* We would seed the PRNG here if the platform didn't - * do it automatically - */ - - ctx = SSL_CTX_new(SSLv23_client_method()); - - /* We'd normally set some stuff like the verify paths and - * mode here because as things stand this will connect to - * any server whose certificate is signed by any CA. - */ - - sbio = BIO_new_ssl_connect(ctx); - - BIO_get_ssl(sbio, &ssl); - - if(!ssl) { - fprintf(stderr, "Can't locate SSL pointer\n"); - /* whatever ... */ - } - - /* Don't want any retries */ - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); - - /* We might want to do other things with ssl here */ - - BIO_set_conn_hostname(sbio, "localhost:https"); - - out = BIO_new_fp(stdout, BIO_NOCLOSE); - if(BIO_do_connect(sbio) <= 0) { - fprintf(stderr, "Error connecting to server\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - - if(BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error establishing SSL connection\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - - /* Could examine ssl here to get connection info */ - - BIO_puts(sbio, "GET / HTTP/1.0\n\n"); - for(;;) { - len = BIO_read(sbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(out, tmpbuf, len); - } - BIO_free_all(sbio); - BIO_free(out); - -Here is a simple server example. It makes use of a buffering -BIO to allow lines to be read from the SSL BIO using BIO_gets. -It creates a pseudo web page containing the actual request from -a client and also echoes the request to standard output. - - BIO *sbio, *bbio, *acpt, *out; - int len; - char tmpbuf[1024]; - SSL_CTX *ctx; - SSL *ssl; - - ERR_load_crypto_strings(); - ERR_load_SSL_strings(); - OpenSSL_add_all_algorithms(); - - /* Might seed PRNG here */ - - ctx = SSL_CTX_new(SSLv23_server_method()); - - if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) - || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) - || !SSL_CTX_check_private_key(ctx)) { - - fprintf(stderr, "Error setting up SSL_CTX\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* Might do other things here like setting verify locations and - * DH and/or RSA temporary key callbacks - */ - - /* New SSL BIO setup as server */ - sbio=BIO_new_ssl(ctx,0); - - BIO_get_ssl(sbio, &ssl); - - if(!ssl) { - fprintf(stderr, "Can't locate SSL pointer\n"); - /* whatever ... */ - } - - /* Don't want any retries */ - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); - - /* Create the buffering BIO */ - - bbio = BIO_new(BIO_f_buffer()); - - /* Add to chain */ - sbio = BIO_push(bbio, sbio); - - acpt=BIO_new_accept("4433"); - - /* By doing this when a new connection is established - * we automatically have sbio inserted into it. The - * BIO chain is now 'swallowed' by the accept BIO and - * will be freed when the accept BIO is freed. - */ - - BIO_set_accept_bios(acpt,sbio); - - out = BIO_new_fp(stdout, BIO_NOCLOSE); - - /* Setup accept BIO */ - if(BIO_do_accept(acpt) <= 0) { - fprintf(stderr, "Error setting up accept BIO\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* Now wait for incoming connection */ - if(BIO_do_accept(acpt) <= 0) { - fprintf(stderr, "Error in connection\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* We only want one connection so remove and free - * accept BIO - */ - - sbio = BIO_pop(acpt); - - BIO_free_all(acpt); - - if(BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error in SSL handshake\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - BIO_puts(sbio, "HTTP/1.0 200 OK\r\nContent-type: text/plain\r\n\r\n"); - BIO_puts(sbio, "\r\nConnection Established\r\nRequest headers:\r\n"); - BIO_puts(sbio, "--------------------------------------------------\r\n"); - - for(;;) { - len = BIO_gets(sbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(sbio, tmpbuf, len); - BIO_write(out, tmpbuf, len); - /* Look for blank line signifying end of headers*/ - if((tmpbuf[0] == '\r') || (tmpbuf[0] == '\n')) break; - } - - BIO_puts(sbio, "--------------------------------------------------\r\n"); - BIO_puts(sbio, "\r\n"); - - /* Since there is a buffering BIO present we had better flush it */ - BIO_flush(sbio); - - BIO_free_all(sbio); - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_find_type.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_find_type.pod deleted file mode 100644 index bd3b25619..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_find_type.pod +++ /dev/null @@ -1,98 +0,0 @@ -=pod - -=head1 NAME - -BIO_find_type, BIO_next - BIO chain traversal - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_find_type(BIO *b,int bio_type); - BIO * BIO_next(BIO *b); - - #define BIO_method_type(b) ((b)->method->type) - - #define BIO_TYPE_NONE 0 - #define BIO_TYPE_MEM (1|0x0400) - #define BIO_TYPE_FILE (2|0x0400) - - #define BIO_TYPE_FD (4|0x0400|0x0100) - #define BIO_TYPE_SOCKET (5|0x0400|0x0100) - #define BIO_TYPE_NULL (6|0x0400) - #define BIO_TYPE_SSL (7|0x0200) - #define BIO_TYPE_MD (8|0x0200) - #define BIO_TYPE_BUFFER (9|0x0200) - #define BIO_TYPE_CIPHER (10|0x0200) - #define BIO_TYPE_BASE64 (11|0x0200) - #define BIO_TYPE_CONNECT (12|0x0400|0x0100) - #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) - #define BIO_TYPE_PROXY_CLIENT (14|0x0200) - #define BIO_TYPE_PROXY_SERVER (15|0x0200) - #define BIO_TYPE_NBIO_TEST (16|0x0200) - #define BIO_TYPE_NULL_FILTER (17|0x0200) - #define BIO_TYPE_BER (18|0x0200) - #define BIO_TYPE_BIO (19|0x0400) - - #define BIO_TYPE_DESCRIPTOR 0x0100 - #define BIO_TYPE_FILTER 0x0200 - #define BIO_TYPE_SOURCE_SINK 0x0400 - -=head1 DESCRIPTION - -The BIO_find_type() searches for a BIO of a given type in a chain, starting -at BIO B<b>. If B<type> is a specific type (such as BIO_TYPE_MEM) then a search -is made for a BIO of that type. If B<type> is a general type (such as -B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is -searched for. BIO_find_type() returns the next matching BIO or NULL if none is -found. - -Note: not all the B<BIO_TYPE_*> types above have corresponding BIO implementations. - -BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs -in a chain or used in conjunction with BIO_find_type() to find all BIOs of a -certain type. - -BIO_method_type() returns the type of a BIO. - -=head1 RETURN VALUES - -BIO_find_type() returns a matching BIO or NULL for no match. - -BIO_next() returns the next BIO in a chain. - -BIO_method_type() returns the type of the BIO B<b>. - -=head1 NOTES - -BIO_next() was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO -chain or find multiple matches using BIO_find_type(). Previous versions had to -use: - - next = bio->next_bio; - -=head1 BUGS - -BIO_find_type() in OpenSSL 0.9.5a and earlier could not be safely passed a -NULL pointer for the B<b> argument. - -=head1 EXAMPLE - -Traverse a chain looking for digest BIOs: - - BIO *btmp; - btmp = in_bio; /* in_bio is chain to search through */ - - do { - btmp = BIO_find_type(btmp, BIO_TYPE_MD); - if(btmp == NULL) break; /* Not found */ - /* btmp is a digest BIO, do something with it ...*/ - ... - - btmp = BIO_next(btmp); - } while(btmp); - - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_new.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_new.pod deleted file mode 100644 index 2a245fc8d..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_new.pod +++ /dev/null @@ -1,65 +0,0 @@ -=pod - -=head1 NAME - -BIO_new, BIO_set, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and freeing functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_new(BIO_METHOD *type); - int BIO_set(BIO *a,BIO_METHOD *type); - int BIO_free(BIO *a); - void BIO_vfree(BIO *a); - void BIO_free_all(BIO *a); - -=head1 DESCRIPTION - -The BIO_new() function returns a new BIO using method B<type>. - -BIO_set() sets the method of an already existing BIO. - -BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO -but it does not return a value. Calling BIO_free() may also have some effect -on the underlying I/O structure, for example it may close the file being -referred to under certain circumstances. For more details see the individual -BIO_METHOD descriptions. - -BIO_free_all() frees up an entire BIO chain, it does not halt if an error -occurs freeing up an individual BIO in the chain. - -=head1 RETURN VALUES - -BIO_new() returns a newly created BIO or NULL if the call fails. - -BIO_set(), BIO_free() return 1 for success and 0 for failure. - -BIO_free_all() and BIO_vfree() do not return values. - -=head1 NOTES - -Some BIOs (such as memory BIOs) can be used immediately after calling -BIO_new(). Others (such as file BIOs) need some additional initialization, -and frequently a utility function exists to create and initialize such BIOs. - -If BIO_free() is called on a BIO chain it will only free one BIO resulting -in a memory leak. - -Calling BIO_free_all() a single BIO has the same effect as calling BIO_free() -on it other than the discarded return value. - -Normally the B<type> argument is supplied by a function which returns a -pointer to a BIO_METHOD. There is a naming convention for such functions: -a source/sink BIO is normally called BIO_s_*() and a filter BIO -BIO_f_*(); - -=head1 EXAMPLE - -Create a memory BIO: - - BIO *mem = BIO_new(BIO_s_mem()); - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_push.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_push.pod deleted file mode 100644 index 8af1d3c09..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_push.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -BIO_push, BIO_pop - add and remove BIOs from a chain. - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_push(BIO *b,BIO *append); - BIO * BIO_pop(BIO *b); - -=head1 DESCRIPTION - -The BIO_push() function appends the BIO B<append> to B<b>, it returns -B<b>. - -BIO_pop() removes the BIO B<b> from a chain and returns the next BIO -in the chain, or NULL if there is no next BIO. The removed BIO then -becomes a single BIO with no association with the original chain, -it can thus be freed or attached to a different chain. - -=head1 NOTES - -The names of these functions are perhaps a little misleading. BIO_push() -joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, -the deleted BIO does not need to be at the end of a chain. - -The process of calling BIO_push() and BIO_pop() on a BIO may have additional -consequences (a control call is made to the affected BIOs) any effects will -be noted in the descriptions of individual BIOs. - -=head1 EXAMPLES - -For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is -a base64 BIO and B<f> is a file BIO. - -If the call: - - BIO_push(b64, f); - -is made then the new chain will be B<b64-chain>. After making the calls - - BIO_push(md2, b64); - BIO_push(md1, md2); - -the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested -by B<md1> and B<md2>, B<base64> encoded and written to B<f>. - -It should be noted that reading causes data to pass in the reverse -direction, that is data is read from B<f>, base64 B<decoded> and digested -by B<md1> and B<md2>. If the call: - - BIO_pop(md2); - -The call will return B<b64> and the new chain will be B<md1-b64-f> data can -be written to B<md1> as before. - -=head1 RETURN VALUES - -BIO_push() returns the end of the chain, B<b>. - -BIO_pop() returns the next BIO in the chain, or NULL if there is no next -BIO. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_read.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_read.pod deleted file mode 100644 index b34528104..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_read.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -BIO_read, BIO_write, BIO_gets, BIO_puts - BIO I/O functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - int BIO_read(BIO *b, void *buf, int len); - int BIO_gets(BIO *b,char *buf, int size); - int BIO_write(BIO *b, const void *buf, int len); - int BIO_puts(BIO *b,const char *buf); - -=head1 DESCRIPTION - -BIO_read() attempts to read B<len> bytes from BIO B<b> and places -the data in B<buf>. - -BIO_gets() performs the BIOs "gets" operation and places the data -in B<buf>. Usually this operation will attempt to read a line of data -from the BIO of maximum length B<len>. There are exceptions to this -however, for example BIO_gets() on a digest BIO will calculate and -return the digest and other BIOs may not support BIO_gets() at all. - -BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>. - -BIO_puts() attempts to write a null terminated string B<buf> to BIO B<b> - -=head1 RETURN VALUES - -All these functions return either the amount of data successfully read or -written (if the return value is positive) or that no data was successfully -read or written if the result is 0 or -1. If the return value is -2 then -the operation is not implemented in the specific BIO type. - -=head1 NOTES - -A 0 or -1 return is not necessarily an indication of an error. In -particular when the source/sink is non-blocking or of a certain type -it may merely be an indication that no data is currently available and that -the application should retry the operation later. - -One technique sometimes used with blocking sockets is to use a system call -(such as select(), poll() or equivalent) to determine when data is available -and then call read() to read the data. The equivalent with BIOs (that is call -select() on the underlying I/O structure and then call BIO_read() to -read the data) should B<not> be used because a single call to BIO_read() -can cause several reads (and writes in the case of SSL BIOs) on the underlying -I/O structure and may block as a result. Instead select() (or equivalent) -should be combined with non blocking I/O so successive reads will request -a retry instead of blocking. - -See L<BIO_should_retry(3)|BIO_should_retry(3)> for details of how to -determine the cause of a retry and other I/O issues. - -If the BIO_gets() function is not supported by a BIO then it possible to -work around this by adding a buffering BIO L<BIO_f_buffer(3)|BIO_f_buffer(3)> -to the chain. - -=head1 SEE ALSO - -L<BIO_should_retry(3)|BIO_should_retry(3)> - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_accept.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_accept.pod deleted file mode 100644 index 7b63e4621..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_accept.pod +++ /dev/null @@ -1,195 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port, -BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode, -BIO_get_bind_mode, BIO_do_accept - accept BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD *BIO_s_accept(void); - - long BIO_set_accept_port(BIO *b, char *name); - char *BIO_get_accept_port(BIO *b); - - BIO *BIO_new_accept(char *host_port); - - long BIO_set_nbio_accept(BIO *b, int n); - long BIO_set_accept_bios(BIO *b, char *bio); - - long BIO_set_bind_mode(BIO *b, long mode); - long BIO_get_bind_mode(BIO *b, long dummy); - - #define BIO_BIND_NORMAL 0 - #define BIO_BIND_REUSEADDR_IF_UNUSED 1 - #define BIO_BIND_REUSEADDR 2 - - int BIO_do_accept(BIO *b); - -=head1 DESCRIPTION - -BIO_s_accept() returns the accept BIO method. This is a wrapper -round the platform's TCP/IP socket accept routines. - -Using accept BIOs, TCP/IP connections can be accepted and data -transferred using only BIO routines. In this way any platform -specific operations are hidden by the BIO abstraction. - -Read and write operations on an accept BIO will perform I/O -on the underlying connection. If no connection is established -and the port (see below) is set up properly then the BIO -waits for an incoming connection. - -Accept BIOs support BIO_puts() but not BIO_gets(). - -If the close flag is set on an accept BIO then any active -connection on that chain is shutdown and the socket closed when -the BIO is freed. - -Calling BIO_reset() on a accept BIO will close any active -connection and reset the BIO into a state where it awaits another -incoming connection. - -BIO_get_fd() and BIO_set_fd() can be called to retrieve or set -the accept socket. See L<BIO_s_fd(3)|BIO_s_fd(3)> - -BIO_set_accept_port() uses the string B<name> to set the accept -port. The port is represented as a string of the form "host:port", -where "host" is the interface to use and "port" is the port. -Either or both values can be "*" which is interpreted as meaning -any interface or port respectively. "port" has the same syntax -as the port specified in BIO_set_conn_port() for connect BIOs, -that is it can be a numerical port string or a string to lookup -using getservbyname() and a string table. - -BIO_new_accept() combines BIO_new() and BIO_set_accept_port() into -a single call: that is it creates a new accept BIO with port -B<host_port>. - -BIO_set_nbio_accept() sets the accept socket to blocking mode -(the default) if B<n> is 0 or non blocking mode if B<n> is 1. - -BIO_set_accept_bios() can be used to set a chain of BIOs which -will be duplicated and prepended to the chain when an incoming -connection is received. This is useful if, for example, a -buffering or SSL BIO is required for each connection. The -chain of BIOs must not be freed after this call, they will -be automatically freed when the accept BIO is freed. - -BIO_set_bind_mode() and BIO_get_bind_mode() set and retrieve -the current bind mode. If BIO_BIND_NORMAL (the default) is set -then another socket cannot be bound to the same port. If -BIO_BIND_REUSEADDR is set then other sockets can bind to the -same port. If BIO_BIND_REUSEADDR_IF_UNUSED is set then and -attempt is first made to use BIO_BIN_NORMAL, if this fails -and the port is not in use then a second attempt is made -using BIO_BIND_REUSEADDR. - -BIO_do_accept() serves two functions. When it is first -called, after the accept BIO has been setup, it will attempt -to create the accept socket and bind an address to it. Second -and subsequent calls to BIO_do_accept() will await an incoming -connection, or request a retry in non blocking mode. - -=head1 NOTES - -When an accept BIO is at the end of a chain it will await an -incoming connection before processing I/O calls. When an accept -BIO is not at then end of a chain it passes I/O calls to the next -BIO in the chain. - -When a connection is established a new socket BIO is created for -the connection and appended to the chain. That is the chain is now -accept->socket. This effectively means that attempting I/O on -an initial accept socket will await an incoming connection then -perform I/O on it. - -If any additional BIOs have been set using BIO_set_accept_bios() -then they are placed between the socket and the accept BIO, -that is the chain will be accept->otherbios->socket. - -If a server wishes to process multiple connections (as is normally -the case) then the accept BIO must be made available for further -incoming connections. This can be done by waiting for a connection and -then calling: - - connection = BIO_pop(accept); - -After this call B<connection> will contain a BIO for the recently -established connection and B<accept> will now be a single BIO -again which can be used to await further incoming connections. -If no further connections will be accepted the B<accept> can -be freed using BIO_free(). - -If only a single connection will be processed it is possible to -perform I/O using the accept BIO itself. This is often undesirable -however because the accept BIO will still accept additional incoming -connections. This can be resolved by using BIO_pop() (see above) -and freeing up the accept BIO after the initial connection. - -If the underlying accept socket is non-blocking and BIO_do_accept() is -called to await an incoming connection it is possible for -BIO_should_io_special() with the reason BIO_RR_ACCEPT. If this happens -then it is an indication that an accept attempt would block: the application -should take appropriate action to wait until the underlying socket has -accepted a connection and retry the call. - -BIO_set_accept_port(), BIO_get_accept_port(), BIO_set_nbio_accept(), -BIO_set_accept_bios(), BIO_set_bind_mode(), BIO_get_bind_mode() and -BIO_do_accept() are macros. - -=head1 RETURN VALUES - -TBA - -=head1 EXAMPLE - -This example accepts two connections on port 4444, sends messages -down each and finally closes both down. - - BIO *abio, *cbio, *cbio2; - ERR_load_crypto_strings(); - abio = BIO_new_accept("4444"); - - /* First call to BIO_accept() sets up accept BIO */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error setting up accept\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - - /* Wait for incoming connection */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error accepting connection\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - fprintf(stderr, "Connection 1 established\n"); - /* Retrieve BIO for connection */ - cbio = BIO_pop(abio); - BIO_puts(cbio, "Connection 1: Sending out Data on initial connection\n"); - fprintf(stderr, "Sent out data on connection 1\n"); - /* Wait for another connection */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error accepting connection\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - fprintf(stderr, "Connection 2 established\n"); - /* Close accept BIO to refuse further connections */ - cbio2 = BIO_pop(abio); - BIO_free(abio); - BIO_puts(cbio2, "Connection 2: Sending out Data on second\n"); - fprintf(stderr, "Sent out data on connection 2\n"); - - BIO_puts(cbio, "Connection 1: Second connection established\n"); - /* Close the two established connections */ - BIO_free(cbio); - BIO_free(cbio2); - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_bio.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_bio.pod deleted file mode 100644 index 8d0a55a02..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_bio.pod +++ /dev/null @@ -1,182 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, -BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, -BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, -BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD *BIO_s_bio(void); - - #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) - #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) - - #define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) - - #define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) - #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) - - int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); - - #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) - size_t BIO_ctrl_get_write_guarantee(BIO *b); - - #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) - size_t BIO_ctrl_get_read_request(BIO *b); - - int BIO_ctrl_reset_read_request(BIO *b); - -=head1 DESCRIPTION - -BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink -BIOs where data written to either half of the pair is buffered and can be read from -the other half. Both halves must usually by handled by the same application thread -since no locking is done on the internal data structures. - -Since BIO chains typically end in a source/sink BIO it is possible to make this -one half of a BIO pair and have all the data processed by the chain under application -control. - -One typical use of BIO pairs is to place TLS/SSL I/O under application control, this -can be used when the application wishes to use a non standard transport for -TLS/SSL or the normal socket routines are inappropriate. - -Calls to BIO_read() will read data from the buffer or request a retry if no -data is available. - -Calls to BIO_write() will place data in the buffer or request a retry if the -buffer is full. - -The standard calls BIO_ctrl_pending() and BIO_ctrl_wpending() can be used to -determine the amount of pending data in the read or write buffer. - -BIO_reset() clears any data in the write buffer. - -BIO_make_bio_pair() joins two separate BIOs into a connected pair. - -BIO_destroy_pair() destroys the association between two connected BIOs. Freeing -up any half of the pair will automatically destroy the association. - -BIO_shutdown_wr() is used to close down a BIO B<b>. After this call no further -writes on BIO B<b> are allowed (they will return an error). Reads on the other -half of the pair will return any pending data or EOF when all pending data has -been read. - -BIO_set_write_buf_size() sets the write buffer size of BIO B<b> to B<size>. -If the size is not initialized a default value is used. This is currently -17K, sufficient for a maximum size TLS record. - -BIO_get_write_buf_size() returns the size of the write buffer. - -BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and -BIO_set_write_buf_size() to create a connected pair of BIOs B<bio1>, B<bio2> -with write buffer sizes B<writebuf1> and B<writebuf2>. If either size is -zero then the default size is used. BIO_new_bio_pair() does not check whether -B<bio1> or B<bio2> do point to some other BIO, the values are overwritten, -BIO_free() is not called. - -BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum -length of data that can be currently written to the BIO. Writes larger than this -value will return a value from BIO_write() less than the amount requested or if the -buffer is full request a retry. BIO_ctrl_get_write_guarantee() is a function -whereas BIO_get_write_guarantee() is a macro. - -BIO_get_read_request() and BIO_ctrl_get_read_request() return the -amount of data requested, or the buffer size if it is less, if the -last read attempt at the other half of the BIO pair failed due to an -empty buffer. This can be used to determine how much data should be -written to the BIO so the next read will succeed: this is most useful -in TLS/SSL applications where the amount of data read is usually -meaningful rather than just a buffer size. After a successful read -this call will return zero. It also will return zero once new data -has been written satisfying the read request or part of it. -Note that BIO_get_read_request() never returns an amount larger -than that returned by BIO_get_write_guarantee(). - -BIO_ctrl_reset_read_request() can also be used to reset the value returned by -BIO_get_read_request() to zero. - -=head1 NOTES - -Both halves of a BIO pair should be freed. That is even if one half is implicit -freed due to a BIO_free_all() or SSL_free() call the other half needs to be freed. - -When used in bidirectional applications (such as TLS/SSL) care should be taken to -flush any data in the write buffer. This can be done by calling BIO_pending() -on the other half of the pair and, if any data is pending, reading it and sending -it to the underlying transport. This must be done before any normal processing -(such as calling select() ) due to a request and BIO_should_read() being true. - -To see why this is important consider a case where a request is sent using -BIO_write() and a response read with BIO_read(), this can occur during an -TLS/SSL handshake for example. BIO_write() will succeed and place data in the write -buffer. BIO_read() will initially fail and BIO_should_read() will be true. If -the application then waits for data to be available on the underlying transport -before flushing the write buffer it will never succeed because the request was -never sent! - -=head1 RETURN VALUES - -BIO_new_bio_pair() returns 1 on success, with the new BIOs available in -B<bio1> and B<bio2>, or 0 on failure, with NULL pointers stored into the -locations for B<bio1> and B<bio2>. Check the error stack for more information. - -[XXXXX: More return values need to be added here] - -=head1 EXAMPLE - -The BIO pair can be used to have full control over the network access of an -application. The application can call select() on the socket as required -without having to go through the SSL-interface. - - BIO *internal_bio, *network_bio; - ... - BIO_new_bio_pair(internal_bio, 0, network_bio, 0); - SSL_set_bio(ssl, internal_bio, internal_bio); - SSL_operations(); - ... - - application | TLS-engine - | | - +----------> SSL_operations() - | /\ || - | || \/ - | BIO-pair (internal_bio) - +----------< BIO-pair (network_bio) - | | - socket | - - ... - SSL_free(ssl); /* implicitly frees internal_bio */ - BIO_free(network_bio); - ... - -As the BIO pair will only buffer the data and never directly access the -connection, it behaves non-blocking and will return as soon as the write -buffer is full or the read buffer is drained. Then the application has to -flush the write buffer and/or fill the read buffer. - -Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO -and must be transfered to the network. Use BIO_ctrl_get_read_request() to -find out, how many bytes must be written into the buffer before the -SSL_operation() can successfully be continued. - -=head1 WARNING - -As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ -condition, but there is still data in the write buffer. An application must -not rely on the error value of SSL_operation() but must assure that the -write buffer is always flushed first. Otherwise a deadlock may occur as -the peer might be waiting for the data before being able to continue. - -=head1 SEE ALSO - -L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<BIO_should_retry(3)|BIO_should_retry(3)>, L<BIO_read(3)|BIO_read(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_connect.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_connect.pod deleted file mode 100644 index bcf7d8dca..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_connect.pod +++ /dev/null @@ -1,192 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_connect, BIO_set_conn_hostname, BIO_set_conn_port, -BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname, -BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port, -BIO_set_nbio, BIO_do_connect - connect BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_connect(void); - - BIO *BIO_new_connect(char *name); - - long BIO_set_conn_hostname(BIO *b, char *name); - long BIO_set_conn_port(BIO *b, char *port); - long BIO_set_conn_ip(BIO *b, char *ip); - long BIO_set_conn_int_port(BIO *b, char *port); - char *BIO_get_conn_hostname(BIO *b); - char *BIO_get_conn_port(BIO *b); - char *BIO_get_conn_ip(BIO *b, dummy); - long BIO_get_conn_int_port(BIO *b, int port); - - long BIO_set_nbio(BIO *b, long n); - - int BIO_do_connect(BIO *b); - -=head1 DESCRIPTION - -BIO_s_connect() returns the connect BIO method. This is a wrapper -round the platform's TCP/IP socket connection routines. - -Using connect BIOs, TCP/IP connections can be made and data -transferred using only BIO routines. In this way any platform -specific operations are hidden by the BIO abstraction. - -Read and write operations on a connect BIO will perform I/O -on the underlying connection. If no connection is established -and the port and hostname (see below) is set up properly then -a connection is established first. - -Connect BIOs support BIO_puts() but not BIO_gets(). - -If the close flag is set on a connect BIO then any active -connection is shutdown and the socket closed when the BIO -is freed. - -Calling BIO_reset() on a connect BIO will close any active -connection and reset the BIO into a state where it can connect -to the same host again. - -BIO_get_fd() places the underlying socket in B<c> if it is not NULL, -it also returns the socket . If B<c> is not NULL it should be of -type (int *). - -BIO_set_conn_hostname() uses the string B<name> to set the hostname. -The hostname can be an IP address. The hostname can also include the -port in the form hostname:port . It is also acceptable to use the -form "hostname/any/other/path" or "hostname:port/any/other/path". - -BIO_set_conn_port() sets the port to B<port>. B<port> can be the -numerical form or a string such as "http". A string will be looked -up first using getservbyname() on the host platform but if that -fails a standard table of port names will be used. Currently the -list is http, telnet, socks, https, ssl, ftp, gopher and wais. - -BIO_set_conn_ip() sets the IP address to B<ip> using binary form, -that is four bytes specifying the IP address in big-endian form. - -BIO_set_conn_int_port() sets the port using B<port>. B<port> should -be of type (int *). - -BIO_get_conn_hostname() returns the hostname of the connect BIO or -NULL if the BIO is initialized but no hostname is set. -This return value is an internal pointer which should not be modified. - -BIO_get_conn_port() returns the port as a string. - -BIO_get_conn_ip() returns the IP address in binary form. - -BIO_get_conn_int_port() returns the port as an int. - -BIO_set_nbio() sets the non blocking I/O flag to B<n>. If B<n> is -zero then blocking I/O is set. If B<n> is 1 then non blocking I/O -is set. Blocking I/O is the default. The call to BIO_set_nbio() -should be made before the connection is established because -non blocking I/O is set during the connect process. - -BIO_new_connect() combines BIO_new() and BIO_set_conn_hostname() into -a single call: that is it creates a new connect BIO with B<name>. - -BIO_do_connect() attempts to connect the supplied BIO. It returns 1 -if the connection was established successfully. A zero or negative -value is returned if the connection could not be established, the -call BIO_should_retry() should be used for non blocking connect BIOs -to determine if the call should be retried. - -=head1 NOTES - -If blocking I/O is set then a non positive return value from any -I/O call is caused by an error condition, although a zero return -will normally mean that the connection was closed. - -If the port name is supplied as part of the host name then this will -override any value set with BIO_set_conn_port(). This may be undesirable -if the application does not wish to allow connection to arbitrary -ports. This can be avoided by checking for the presence of the ':' -character in the passed hostname and either indicating an error or -truncating the string at that point. - -The values returned by BIO_get_conn_hostname(), BIO_get_conn_port(), -BIO_get_conn_ip() and BIO_get_conn_int_port() are updated when a -connection attempt is made. Before any connection attempt the values -returned are those set by the application itself. - -Applications do not have to call BIO_do_connect() but may wish to do -so to separate the connection process from other I/O processing. - -If non blocking I/O is set then retries will be requested as appropriate. - -It addition to BIO_should_read() and BIO_should_write() it is also -possible for BIO_should_io_special() to be true during the initial -connection process with the reason BIO_RR_CONNECT. If this is returned -then this is an indication that a connection attempt would block, -the application should then take appropriate action to wait until -the underlying socket has connected and retry the call. - -BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_set_conn_ip(), -BIO_set_conn_int_port(), BIO_get_conn_hostname(), BIO_get_conn_port(), -BIO_get_conn_ip(), BIO_get_conn_int_port(), BIO_set_nbio() and -BIO_do_connect() are macros. - -=head1 RETURN VALUES - -BIO_s_connect() returns the connect BIO method. - -BIO_get_fd() returns the socket or -1 if the BIO has not -been initialized. - -BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_set_conn_ip() and -BIO_set_conn_int_port() always return 1. - -BIO_get_conn_hostname() returns the connected hostname or NULL is -none was set. - -BIO_get_conn_port() returns a string representing the connected -port or NULL if not set. - -BIO_get_conn_ip() returns a pointer to the connected IP address in -binary form or all zeros if not set. - -BIO_get_conn_int_port() returns the connected port or 0 if none was -set. - -BIO_set_nbio() always returns 1. - -BIO_do_connect() returns 1 if the connection was successfully -established and 0 or -1 if the connection failed. - -=head1 EXAMPLE - -This is example connects to a webserver on the local host and attempts -to retrieve a page and copy the result to standard output. - - - BIO *cbio, *out; - int len; - char tmpbuf[1024]; - ERR_load_crypto_strings(); - cbio = BIO_new_connect("localhost:http"); - out = BIO_new_fp(stdout, BIO_NOCLOSE); - if(BIO_do_connect(cbio) <= 0) { - fprintf(stderr, "Error connecting to server\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - BIO_puts(cbio, "GET / HTTP/1.0\n\n"); - for(;;) { - len = BIO_read(cbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(out, tmpbuf, len); - } - BIO_free(cbio); - BIO_free(out); - - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_fd.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_fd.pod deleted file mode 100644 index b1de1d101..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_fd.pod +++ /dev/null @@ -1,89 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_fd(void); - - #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) - #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) - - BIO *BIO_new_fd(int fd, int close_flag); - -=head1 DESCRIPTION - -BIO_s_fd() returns the file descriptor BIO method. This is a wrapper -round the platforms file descriptor routines such as read() and write(). - -BIO_read() and BIO_write() read or write the underlying descriptor. -BIO_puts() is supported but BIO_gets() is not. - -If the close flag is set then then close() is called on the underlying -file descriptor when the BIO is freed. - -BIO_reset() attempts to change the file pointer to the start of file -using lseek(fd, 0, 0). - -BIO_seek() sets the file pointer to position B<ofs> from start of file -using lseek(fd, ofs, 0). - -BIO_tell() returns the current file position by calling lseek(fd, 0, 1). - -BIO_set_fd() sets the file descriptor of BIO B<b> to B<fd> and the close -flag to B<c>. - -BIO_get_fd() places the file descriptor in B<c> if it is not NULL, it also -returns the file descriptor. If B<c> is not NULL it should be of type -(int *). - -BIO_new_fd() returns a file descriptor BIO using B<fd> and B<close_flag>. - -=head1 NOTES - -The behaviour of BIO_read() and BIO_write() depends on the behavior of the -platforms read() and write() calls on the descriptor. If the underlying -file descriptor is in a non blocking mode then the BIO will behave in the -manner described in the L<BIO_read(3)|BIO_read(3)> and L<BIO_should_retry(3)|BIO_should_retry(3)> -manual pages. - -File descriptor BIOs should not be used for socket I/O. Use socket BIOs -instead. - -=head1 RETURN VALUES - -BIO_s_fd() returns the file descriptor BIO method. - -BIO_reset() returns zero for success and -1 if an error occurred. -BIO_seek() and BIO_tell() return the current file position or -1 -is an error occurred. These values reflect the underlying lseek() -behaviour. - -BIO_set_fd() always returns 1. - -BIO_get_fd() returns the file descriptor or -1 if the BIO has not -been initialized. - -BIO_new_fd() returns the newly allocated BIO or NULL is an error -occurred. - -=head1 EXAMPLE - -This is a file descriptor BIO version of "Hello World": - - BIO *out; - out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE); - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -=head1 SEE ALSO - -L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, -L<BIO_reset(3)|BIO_reset(3)>, L<BIO_read(3)|BIO_read(3)>, -L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, -L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, -L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_file.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_file.pod deleted file mode 100644 index b2a29263f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_file.pod +++ /dev/null @@ -1,144 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, -BIO_read_filename, BIO_write_filename, BIO_append_filename, -BIO_rw_filename - FILE bio - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_file(void); - BIO *BIO_new_file(const char *filename, const char *mode); - BIO *BIO_new_fp(FILE *stream, int flags); - - BIO_set_fp(BIO *b,FILE *fp, int flags); - BIO_get_fp(BIO *b,FILE **fpp); - - int BIO_read_filename(BIO *b, char *name) - int BIO_write_filename(BIO *b, char *name) - int BIO_append_filename(BIO *b, char *name) - int BIO_rw_filename(BIO *b, char *name) - -=head1 DESCRIPTION - -BIO_s_file() returns the BIO file method. As its name implies it -is a wrapper round the stdio FILE structure and it is a -source/sink BIO. - -Calls to BIO_read() and BIO_write() read and write data to the -underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs. - -BIO_flush() on a file BIO calls the fflush() function on the wrapped -stream. - -BIO_reset() attempts to change the file pointer to the start of file -using fseek(stream, 0, 0). - -BIO_seek() sets the file pointer to position B<ofs> from start of file -using fseek(stream, ofs, 0). - -BIO_eof() calls feof(). - -Setting the BIO_CLOSE flag calls fclose() on the stream when the BIO -is freed. - -BIO_new_file() creates a new file BIO with mode B<mode> the meaning -of B<mode> is the same as the stdio function fopen(). The BIO_CLOSE -flag is set on the returned BIO. - -BIO_new_fp() creates a file BIO wrapping B<stream>. Flags can be: -BIO_CLOSE, BIO_NOCLOSE (the close flag) BIO_FP_TEXT (sets the underlying -stream to text mode, default is binary: this only has any effect under -Win32). - -BIO_set_fp() set the fp of a file BIO to B<fp>. B<flags> has the same -meaning as in BIO_new_fp(), it is a macro. - -BIO_get_fp() retrieves the fp of a file BIO, it is a macro. - -BIO_seek() is a macro that sets the position pointer to B<offset> bytes -from the start of file. - -BIO_tell() returns the value of the position pointer. - -BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and -BIO_rw_filename() set the file BIO B<b> to use file B<name> for -reading, writing, append or read write respectively. - -=head1 NOTES - -When wrapping stdout, stdin or stderr the underlying stream should not -normally be closed so the BIO_NOCLOSE flag should be set. - -Because the file BIO calls the underlying stdio functions any quirks -in stdio behaviour will be mirrored by the corresponding BIO. - -=head1 EXAMPLES - -File BIO "hello world": - - BIO *bio_out; - bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); - BIO_printf(bio_out, "Hello World\n"); - -Alternative technique: - - BIO *bio_out; - bio_out = BIO_new(BIO_s_file()); - if(bio_out == NULL) /* Error ... */ - if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */ - BIO_printf(bio_out, "Hello World\n"); - -Write to a file: - - BIO *out; - out = BIO_new_file("filename.txt", "w"); - if(!out) /* Error occurred */ - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -Alternative technique: - - BIO *out; - out = BIO_new(BIO_s_file()); - if(out == NULL) /* Error ... */ - if(!BIO_write_filename(out, "filename.txt")) /* Error ... */ - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -=head1 RETURN VALUES - -BIO_s_file() returns the file BIO method. - -BIO_new_file() and BIO_new_fp() return a file BIO or NULL if an error -occurred. - -BIO_set_fp() and BIO_get_fp() return 1 for success or 0 for failure -(although the current implementation never return 0). - -BIO_seek() returns the same value as the underlying fseek() function: -0 for success or -1 for failure. - -BIO_tell() returns the current file position. - -BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and -BIO_rw_filename() return 1 for success or 0 for failure. - -=head1 BUGS - -BIO_reset() and BIO_seek() are implemented using fseek() on the underlying -stream. The return value for fseek() is 0 for success or -1 if an error -occurred this differs from other types of BIO which will typically return -1 for success and a non positive value if an error occurred. - -=head1 SEE ALSO - -L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, -L<BIO_reset(3)|BIO_reset(3)>, L<BIO_flush(3)|BIO_flush(3)>, -L<BIO_read(3)|BIO_read(3)>, -L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, -L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, -L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_mem.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_mem.pod deleted file mode 100644 index 19648acfa..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_mem.pod +++ /dev/null @@ -1,115 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, -BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_mem(void); - - BIO_set_mem_eof_return(BIO *b,int v) - long BIO_get_mem_data(BIO *b, char **pp) - BIO_set_mem_buf(BIO *b,BUF_MEM *bm,int c) - BIO_get_mem_ptr(BIO *b,BUF_MEM **pp) - - BIO *BIO_new_mem_buf(void *buf, int len); - -=head1 DESCRIPTION - -BIO_s_mem() return the memory BIO method function. - -A memory BIO is a source/sink BIO which uses memory for its I/O. Data -written to a memory BIO is stored in a BUF_MEM structure which is extended -as appropriate to accommodate the stored data. - -Any data written to a memory BIO can be recalled by reading from it. -Unless the memory BIO is read only any data read from it is deleted from -the BIO. - -Memory BIOs support BIO_gets() and BIO_puts(). - -If the BIO_CLOSE flag is set when a memory BIO is freed then the underlying -BUF_MEM structure is also freed. - -Calling BIO_reset() on a read write memory BIO clears any data in it. On a -read only BIO it restores the BIO to its original state and the read only -data can be read again. - -BIO_eof() is true if no data is in the BIO. - -BIO_ctrl_pending() returns the number of bytes currently stored. - -BIO_set_mem_eof_return() sets the behaviour of memory BIO B<b> when it is -empty. If the B<v> is zero then an empty memory BIO will return EOF (that is -it will return zero and BIO_should_retry(b) will be false. If B<v> is non -zero then it will return B<v> when it is empty and it will set the read retry -flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal -positive return value B<v> should be set to a negative value, typically -1. - -BIO_get_mem_data() sets B<pp> to a pointer to the start of the memory BIOs data -and returns the total amount of data available. It is implemented as a macro. - -BIO_set_mem_buf() sets the internal BUF_MEM structure to B<bm> and sets the -close flag to B<c>, that is B<c> should be either BIO_CLOSE or BIO_NOCLOSE. -It is a macro. - -BIO_get_mem_ptr() places the underlying BUF_MEM structure in B<pp>. It is -a macro. - -BIO_new_mem_buf() creates a memory BIO using B<len> bytes of data at B<buf>, -if B<len> is -1 then the B<buf> is assumed to be null terminated and its -length is determined by B<strlen>. The BIO is set to a read only state and -as a result cannot be written to. This is useful when some data needs to be -made available from a static area of memory in the form of a BIO. The -supplied data is read directly from the supplied buffer: it is B<not> copied -first, so the supplied area of memory must be unchanged until the BIO is freed. - -=head1 NOTES - -Writes to memory BIOs will always succeed if memory is available: that is -their size can grow indefinitely. - -Every read from a read write memory BIO will remove the data just read with -an internal copy operation, if a BIO contains a lots of data and it is -read in small chunks the operation can be very slow. The use of a read only -memory BIO avoids this problem. If the BIO must be read write then adding -a buffering BIO to the chain will speed up the process. - -=head1 BUGS - -There should be an option to set the maximum size of a memory BIO. - -There should be a way to "rewind" a read write BIO without destroying -its contents. - -The copying operation should not occur after every small read of a large BIO -to improve efficiency. - -=head1 EXAMPLE - -Create a memory BIO and write some data to it: - - BIO *mem = BIO_new(BIO_s_mem()); - BIO_puts(mem, "Hello World\n"); - -Create a read only memory BIO: - - char data[] = "Hello World"; - BIO *mem; - mem = BIO_new_mem_buf(data, -1); - -Extract the BUF_MEM structure from a memory BIO and then free up the BIO: - - BUF_MEM *bptr; - BIO_get_mem_ptr(mem, &bptr); - BIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */ - BIO_free(mem); - - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_null.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_null.pod deleted file mode 100644 index e5514f723..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_null.pod +++ /dev/null @@ -1,37 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_null - null data sink - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_null(void); - -=head1 DESCRIPTION - -BIO_s_null() returns the null sink BIO method. Data written to -the null sink is discarded, reads return EOF. - -=head1 NOTES - -A null sink BIO behaves in a similar manner to the Unix /dev/null -device. - -A null bio can be placed on the end of a chain to discard any data -passed through it. - -A null sink is useful if, for example, an application wishes to digest some -data by writing through a digest bio but not send the digested data anywhere. -Since a BIO chain must normally include a source/sink BIO this can be achieved -by adding a null sink BIO to the end of the chain - -=head1 RETURN VALUES - -BIO_s_null() returns the null sink BIO method. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_socket.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_s_socket.pod deleted file mode 100644 index 1c8d3a911..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_s_socket.pod +++ /dev/null @@ -1,63 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_socket, BIO_new_socket - socket BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD *BIO_s_socket(void); - - long BIO_set_fd(BIO *b, int fd, long close_flag); - long BIO_get_fd(BIO *b, int *c); - - BIO *BIO_new_socket(int sock, int close_flag); - -=head1 DESCRIPTION - -BIO_s_socket() returns the socket BIO method. This is a wrapper -round the platform's socket routines. - -BIO_read() and BIO_write() read or write the underlying socket. -BIO_puts() is supported but BIO_gets() is not. - -If the close flag is set then the socket is shut down and closed -when the BIO is freed. - -BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close -flag to B<close_flag>. - -BIO_get_fd() places the socket in B<c> if it is not NULL, it also -returns the socket. If B<c> is not NULL it should be of type (int *). - -BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. - -=head1 NOTES - -Socket BIOs also support any relevant functionality of file descriptor -BIOs. - -The reason for having separate file descriptor and socket BIOs is that on some -platforms sockets are not file descriptors and use distinct I/O routines, -Windows is one such platform. Any code mixing the two will not work on -all platforms. - -BIO_set_fd() and BIO_get_fd() are macros. - -=head1 RETURN VALUES - -BIO_s_socket() returns the socket BIO method. - -BIO_set_fd() always returns 1. - -BIO_get_fd() returns the socket or -1 if the BIO has not been -initialized. - -BIO_new_socket() returns the newly allocated BIO or NULL is an error -occurred. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_set_callback.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_set_callback.pod deleted file mode 100644 index 475955624..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_set_callback.pod +++ /dev/null @@ -1,108 +0,0 @@ -=pod - -=head1 NAME - -BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, -BIO_debug_callback - BIO callback functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - #define BIO_set_callback(b,cb) ((b)->callback=(cb)) - #define BIO_get_callback(b) ((b)->callback) - #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) - #define BIO_get_callback_arg(b) ((b)->cb_arg) - - long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, - long argl,long ret); - - typedef long (*callback)(BIO *b, int oper, const char *argp, - int argi, long argl, long retvalue); - -=head1 DESCRIPTION - -BIO_set_callback() and BIO_get_callback() set and retrieve the BIO callback, -they are both macros. The callback is called during most high level BIO -operations. It can be used for debugging purposes to trace operations on -a BIO or to modify its operation. - -BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can be -used to set and retrieve an argument for use in the callback. - -BIO_debug_callback() is a standard debugging callback which prints -out information relating to each BIO operation. If the callback -argument is set if is interpreted as a BIO to send the information -to, otherwise stderr is used. - -callback() is the callback function itself. The meaning of each -argument is described below. - -The BIO the callback is attached to is passed in B<b>. - -B<oper> is set to the operation being performed. For some operations -the callback is called twice, once before and once after the actual -operation, the latter case has B<oper> or'ed with BIO_CB_RETURN. - -The meaning of the arguments B<argp>, B<argi> and B<argl> depends on -the value of B<oper>, that is the operation being performed. - -B<retvalue> is the return value that would be returned to the -application if no callback were present. The actual value returned -is the return value of the callback itself. In the case of callbacks -called before the actual BIO operation 1 is placed in retvalue, if -the return value is not positive it will be immediately returned to -the application and the BIO operation will not be performed. - -The callback should normally simply return B<retvalue> when it has -finished processing, unless if specifically wishes to modify the -value returned to the application. - -=head1 CALLBACK OPERATIONS - -=over 4 - -=item B<BIO_free(b)> - -callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L) is called before the -free operation. - -=item B<BIO_read(b, out, outl)> - -callback(b, BIO_CB_READ, out, outl, 0L, 1L) is called before -the read and callback(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0L, retvalue) -after. - -=item B<BIO_write(b, in, inl)> - -callback(b, BIO_CB_WRITE, in, inl, 0L, 1L) is called before -the write and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0L, retvalue) -after. - -=item B<BIO_gets(b, out, outl)> - -callback(b, BIO_CB_GETS, out, outl, 0L, 1L) is called before -the operation and callback(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0L, retvalue) -after. - -=item B<BIO_puts(b, in)> - -callback(b, BIO_CB_WRITE, in, 0, 0L, 1L) is called before -the operation and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, 0, 0L, retvalue) -after. - -=item B<BIO_ctrl(BIO *b, int cmd, long larg, void *parg)> - -callback(b,BIO_CB_CTRL,parg,cmd,larg,1L) is called before the call and -callback(b,BIO_CB_CTRL|BIO_CB_RETURN,parg,cmd, larg,ret) after. - -=back - -=head1 EXAMPLE - -The BIO_debug_callback() function is a good example, its source is -in crypto/bio/bio_cb.c - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BIO_should_retry.pod b/sys/src/ape/lib/openssl/doc/crypto/BIO_should_retry.pod deleted file mode 100644 index 539c39127..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BIO_should_retry.pod +++ /dev/null @@ -1,114 +0,0 @@ -=pod - -=head1 NAME - -BIO_should_retry, BIO_should_read, BIO_should_write, -BIO_should_io_special, BIO_retry_type, BIO_should_retry, -BIO_get_retry_BIO, BIO_get_retry_reason - BIO retry functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) - #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) - #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) - #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) - #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) - - #define BIO_FLAGS_READ 0x01 - #define BIO_FLAGS_WRITE 0x02 - #define BIO_FLAGS_IO_SPECIAL 0x04 - #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) - #define BIO_FLAGS_SHOULD_RETRY 0x08 - - BIO * BIO_get_retry_BIO(BIO *bio, int *reason); - int BIO_get_retry_reason(BIO *bio); - -=head1 DESCRIPTION - -These functions determine why a BIO is not able to read or write data. -They will typically be called after a failed BIO_read() or BIO_write() -call. - -BIO_should_retry() is true if the call that produced this condition -should then be retried at a later time. - -If BIO_should_retry() is false then the cause is an error condition. - -BIO_should_read() is true if the cause of the condition is that a BIO -needs to read data. - -BIO_should_write() is true if the cause of the condition is that a BIO -needs to read data. - -BIO_should_io_special() is true if some "special" condition, that is a -reason other than reading or writing is the cause of the condition. - -BIO_get_retry_reason() returns a mask of the cause of a retry condition -consisting of the values B<BIO_FLAGS_READ>, B<BIO_FLAGS_WRITE>, -B<BIO_FLAGS_IO_SPECIAL> though current BIO types will only set one of -these. - -BIO_get_retry_BIO() determines the precise reason for the special -condition, it returns the BIO that caused this condition and if -B<reason> is not NULL it contains the reason code. The meaning of -the reason code and the action that should be taken depends on -the type of BIO that resulted in this condition. - -BIO_get_retry_reason() returns the reason for a special condition if -passed the relevant BIO, for example as returned by BIO_get_retry_BIO(). - -=head1 NOTES - -If BIO_should_retry() returns false then the precise "error condition" -depends on the BIO type that caused it and the return code of the BIO -operation. For example if a call to BIO_read() on a socket BIO returns -0 and BIO_should_retry() is false then the cause will be that the -connection closed. A similar condition on a file BIO will mean that it -has reached EOF. Some BIO types may place additional information on -the error queue. For more details see the individual BIO type manual -pages. - -If the underlying I/O structure is in a blocking mode almost all current -BIO types will not request a retry, because the underlying I/O -calls will not. If the application knows that the BIO type will never -signal a retry then it need not call BIO_should_retry() after a failed -BIO I/O call. This is typically done with file BIOs. - -SSL BIOs are the only current exception to this rule: they can request a -retry even if the underlying I/O structure is blocking, if a handshake -occurs during a call to BIO_read(). An application can retry the failed -call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY -on the underlying SSL structure. - -While an application may retry a failed non blocking call immediately -this is likely to be very inefficient because the call will fail -repeatedly until data can be processed or is available. An application -will normally wait until the necessary condition is satisfied. How -this is done depends on the underlying I/O structure. - -For example if the cause is ultimately a socket and BIO_should_read() -is true then a call to select() may be made to wait until data is -available and then retry the BIO operation. By combining the retry -conditions of several non blocking BIOs in a single select() call -it is possible to service several BIOs in a single thread, though -the performance may be poor if SSL BIOs are present because long delays -can occur during the initial handshake process. - -It is possible for a BIO to block indefinitely if the underlying I/O -structure cannot process or return any data. This depends on the behaviour of -the platforms I/O functions. This is often not desirable: one solution -is to use non blocking I/O and use a timeout on the select() (or -equivalent) call. - -=head1 BUGS - -The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: -that is they cannot retry after a partial read or write. This is usually -worked around by only passing the relevant data to ASN1 functions when -the entire structure can be read or written. - -=head1 SEE ALSO - -TBA diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_BLINDING_new.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_BLINDING_new.pod deleted file mode 100644 index 7b087f728..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_BLINDING_new.pod +++ /dev/null @@ -1,109 +0,0 @@ -=pod - -=head1 NAME - -BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, -BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, -BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_get_flags, -BN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM -functions. - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, - BIGNUM *mod); - void BN_BLINDING_free(BN_BLINDING *b); - int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); - int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); - int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); - int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, - BN_CTX *ctx); - int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, - BN_CTX *ctx); - unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); - void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); - unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); - void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); - BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -=head1 DESCRIPTION - -BN_BLINDING_new() allocates a new B<BN_BLINDING> structure and copies -the B<A> and B<Ai> values into the newly created B<BN_BLINDING> object. - -BN_BLINDING_free() frees the B<BN_BLINDING> structure. - -BN_BLINDING_update() updates the B<BN_BLINDING> parameters by squaring -the B<A> and B<Ai> or, after specific number of uses and if the -necessary parameters are set, by re-creating the blinding parameters. - -BN_BLINDING_convert_ex() multiplies B<n> with the blinding factor B<A>. -If B<r> is not NULL a copy the inverse blinding factor B<Ai> will be -returned in B<r> (this is useful if a B<RSA> object is shared amoung -several threads). BN_BLINDING_invert_ex() multiplies B<n> with the -inverse blinding factor B<Ai>. If B<r> is not NULL it will be used as -the inverse blinding. - -BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper -functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() -with B<r> set to NULL. - -BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id() -set and get the "thread id" value of the B<BN_BLINDING> structure, -a field provided to users of B<BN_BLINDING> structure to help them -provide proper locking if needed for multi-threaded use. The -"thread id" of a newly allocated B<BN_BLINDING> structure is zero. - -BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently -there are two supported flags: B<BN_BLINDING_NO_UPDATE> and -B<BN_BLINDING_NO_RECREATE>. B<BN_BLINDING_NO_UPDATE> inhibits the -automatic update of the B<BN_BLINDING> parameters after each use -and B<BN_BLINDING_NO_RECREATE> inhibits the automatic re-creation -of the B<BN_BLINDING> parameters after a fixed number of uses (currently -32). In newly allocated B<BN_BLINDING> objects no flags are set. -BN_BLINDING_set_flags() sets the B<BN_BLINDING> parameters flags. - -BN_BLINDING_create_param() creates new B<BN_BLINDING> parameters -using the exponent B<e> and the modulus B<m>. B<bn_mod_exp> and -B<m_ctx> can be used to pass special functions for exponentiation -(normally BN_mod_exp_mont() and B<BN_MONT_CTX>). - -=head1 RETURN VALUES - -BN_BLINDING_new() returns the newly allocated B<BN_BLINDING> structure -or NULL in case of an error. - -BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), -BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on -success and 0 if an error occured. - -BN_BLINDING_get_thread_id() returns the thread id (a B<unsigned long> -value) or 0 if not set. - -BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags -(a B<unsigned long> value). - -BN_BLINDING_create_param() returns the newly created B<BN_BLINDING> -parameters or NULL on error. - -=head1 SEE ALSO - -L<bn(3)|bn(3)> - -=head1 HISTORY - -BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, -BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags -and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 - -=head1 AUTHOR - -Nils Larsch for the OpenSSL project (http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_new.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_new.pod deleted file mode 100644 index ad8d07db8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_new.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -BN_CTX_new, BN_CTX_init, BN_CTX_free - allocate and free BN_CTX structures - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BN_CTX *BN_CTX_new(void); - - void BN_CTX_init(BN_CTX *c); - - void BN_CTX_free(BN_CTX *c); - -=head1 DESCRIPTION - -A B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by -library functions. Since dynamic memory allocation to create B<BIGNUM>s -is rather expensive when used in conjunction with repeated subroutine -calls, the B<BN_CTX> structure is used. - -BN_CTX_new() allocates and initializes a B<BN_CTX> -structure. BN_CTX_init() initializes an existing uninitialized -B<BN_CTX>. - -BN_CTX_free() frees the components of the B<BN_CTX>, and if it was -created by BN_CTX_new(), also the structure itself. -If L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>, -L<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX> -may be freed by BN_CTX_free(). - - -=head1 RETURN VALUES - -BN_CTX_new() returns a pointer to the B<BN_CTX>. If the allocation fails, -it returns B<NULL> and sets an error code that can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. - -BN_CTX_init() and BN_CTX_free() have no return values. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, -L<BN_CTX_start(3)|BN_CTX_start(3)> - -=head1 HISTORY - -BN_CTX_new() and BN_CTX_free() are available in all versions on SSLeay -and OpenSSL. BN_CTX_init() was added in SSLeay 0.9.1b. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_start.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_start.pod deleted file mode 100644 index dfcefe1a8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_CTX_start.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - void BN_CTX_start(BN_CTX *ctx); - - BIGNUM *BN_CTX_get(BN_CTX *ctx); - - void BN_CTX_end(BN_CTX *ctx); - -=head1 DESCRIPTION - -These functions are used to obtain temporary B<BIGNUM> variables from -a B<BN_CTX> (which can been created by using L<BN_CTX_new(3)|BN_CTX_new(3)>) -in order to save the overhead of repeatedly creating and -freeing B<BIGNUM>s in functions that are called from inside a loop. - -A function must call BN_CTX_start() first. Then, BN_CTX_get() may be -called repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get() -calls must be made before calling any other functions that use the -B<ctx> as an argument. - -Finally, BN_CTX_end() must be called before returning from the function. -When BN_CTX_end() is called, the B<BIGNUM> pointers obtained from -BN_CTX_get() become invalid. - -=head1 RETURN VALUES - -BN_CTX_start() and BN_CTX_end() return no values. - -BN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error. -Once BN_CTX_get() has failed, the subsequent calls will return B<NULL> -as well, so it is sufficient to check the return value of the last -BN_CTX_get() call. In case of an error, an error code is set, which -can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - - -=head1 SEE ALSO - -L<BN_CTX_new(3)|BN_CTX_new(3)> - -=head1 HISTORY - -BN_CTX_start(), BN_CTX_get() and BN_CTX_end() were added in OpenSSL 0.9.5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_add.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_add.pod deleted file mode 100644 index 88c7a799e..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_add.pod +++ /dev/null @@ -1,126 +0,0 @@ -=pod - -=head1 NAME - -BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, -BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_exp, BN_mod_exp, BN_gcd - -arithmetic operations on BIGNUMs - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); - - int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); - - int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); - - int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); - - int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, - BN_CTX *ctx); - - int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - - int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - - int BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - - int BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - - int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - - int BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - - int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); - - int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - - int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); - -=head1 DESCRIPTION - -BN_add() adds I<a> and I<b> and places the result in I<r> (C<r=a+b>). -I<r> may be the same B<BIGNUM> as I<a> or I<b>. - -BN_sub() subtracts I<b> from I<a> and places the result in I<r> (C<r=a-b>). - -BN_mul() multiplies I<a> and I<b> and places the result in I<r> (C<r=a*b>). -I<r> may be the same B<BIGNUM> as I<a> or I<b>. -For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>. - -BN_sqr() takes the square of I<a> and places the result in I<r> -(C<r=a^2>). I<r> and I<a> may be the same B<BIGNUM>. -This function is faster than BN_mul(r,a,a). - -BN_div() divides I<a> by I<d> and places the result in I<dv> and the -remainder in I<rem> (C<dv=a/d, rem=a%d>). Either of I<dv> and I<rem> may -be B<NULL>, in which case the respective value is not returned. -The result is rounded towards zero; thus if I<a> is negative, the -remainder will be zero or negative. -For division by powers of 2, use BN_rshift(3). - -BN_mod() corresponds to BN_div() with I<dv> set to B<NULL>. - -BN_nnmod() reduces I<a> modulo I<m> and places the non-negative -remainder in I<r>. - -BN_mod_add() adds I<a> to I<b> modulo I<m> and places the non-negative -result in I<r>. - -BN_mod_sub() subtracts I<b> from I<a> modulo I<m> and places the -non-negative result in I<r>. - -BN_mod_mul() multiplies I<a> by I<b> and finds the non-negative -remainder respective to modulus I<m> (C<r=(a*b) mod m>). I<r> may be -the same B<BIGNUM> as I<a> or I<b>. For more efficient algorithms for -repeated computations using the same modulus, see -L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)> and -L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>. - -BN_mod_sqr() takes the square of I<a> modulo B<m> and places the -result in I<r>. - -BN_exp() raises I<a> to the I<p>-th power and places the result in I<r> -(C<r=a^p>). This function is faster than repeated applications of -BN_mul(). - -BN_mod_exp() computes I<a> to the I<p>-th power modulo I<m> (C<r=a^p % -m>). This function uses less time and space than BN_exp(). - -BN_gcd() computes the greatest common divisor of I<a> and I<b> and -places the result in I<r>. I<r> may be the same B<BIGNUM> as I<a> or -I<b>. - -For all functions, I<ctx> is a previously allocated B<BN_CTX> used for -temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>. - -Unless noted otherwise, the result B<BIGNUM> must be different from -the arguments. - -=head1 RETURN VALUES - -For all functions, 1 is returned for success, 0 on error. The return -value should always be checked (e.g., C<if (!BN_add(r,a,b)) goto err;>). -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, -L<BN_add_word(3)|BN_add_word(3)>, L<BN_set_bit(3)|BN_set_bit(3)> - -=head1 HISTORY - -BN_add(), BN_sub(), BN_sqr(), BN_div(), BN_mod(), BN_mod_mul(), -BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and -OpenSSL. The I<ctx> argument to BN_mul() was added in SSLeay -0.9.1b. BN_exp() appeared in SSLeay 0.9.0. -BN_nnmod(), BN_mod_add(), BN_mod_sub(), and BN_mod_sqr() were added in -OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_add_word.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_add_word.pod deleted file mode 100644 index 70667d289..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_add_word.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic -functions on BIGNUMs with integers - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_add_word(BIGNUM *a, BN_ULONG w); - - int BN_sub_word(BIGNUM *a, BN_ULONG w); - - int BN_mul_word(BIGNUM *a, BN_ULONG w); - - BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); - - BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); - -=head1 DESCRIPTION - -These functions perform arithmetic operations on BIGNUMs with unsigned -integers. They are much more efficient than the normal BIGNUM -arithmetic operations. - -BN_add_word() adds B<w> to B<a> (C<a+=w>). - -BN_sub_word() subtracts B<w> from B<a> (C<a-=w>). - -BN_mul_word() multiplies B<a> and B<w> (C<a*=w>). - -BN_div_word() divides B<a> by B<w> (C<a/=w>) and returns the remainder. - -BN_mod_word() returns the remainder of B<a> divided by B<w> (C<a%w>). - -For BN_div_word() and BN_mod_word(), B<w> must not be 0. - -=head1 RETURN VALUES - -BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 -on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -BN_mod_word() and BN_div_word() return B<a>%B<w> on success and -B<(BN_ULONG)-1> if an error occurred. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)> - -=head1 HISTORY - -BN_add_word() and BN_mod_word() are available in all versions of -SSLeay and OpenSSL. BN_div_word() was added in SSLeay 0.8, and -BN_sub_word() and BN_mul_word() in SSLeay 0.9.0. - -Before 0.9.8a the return value for BN_div_word() and BN_mod_word() -in case of an error was 0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_bn2bin.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_bn2bin.pod deleted file mode 100644 index a4b17ca60..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_bn2bin.pod +++ /dev/null @@ -1,95 +0,0 @@ -=pod - -=head1 NAME - -BN_bn2bin, BN_bin2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, -BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn - format conversions - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_bn2bin(const BIGNUM *a, unsigned char *to); - BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); - - char *BN_bn2hex(const BIGNUM *a); - char *BN_bn2dec(const BIGNUM *a); - int BN_hex2bn(BIGNUM **a, const char *str); - int BN_dec2bn(BIGNUM **a, const char *str); - - int BN_print(BIO *fp, const BIGNUM *a); - int BN_print_fp(FILE *fp, const BIGNUM *a); - - int BN_bn2mpi(const BIGNUM *a, unsigned char *to); - BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret); - -=head1 DESCRIPTION - -BN_bn2bin() converts the absolute value of B<a> into big-endian form -and stores it at B<to>. B<to> must point to BN_num_bytes(B<a>) bytes of -memory. - -BN_bin2bn() converts the positive integer in big-endian form of length -B<len> at B<s> into a B<BIGNUM> and places it in B<ret>. If B<ret> is -NULL, a new B<BIGNUM> is created. - -BN_bn2hex() and BN_bn2dec() return printable strings containing the -hexadecimal and decimal encoding of B<a> respectively. For negative -numbers, the string is prefaced with a leading '-'. The string must be -freed later using OPENSSL_free(). - -BN_hex2bn() converts the string B<str> containing a hexadecimal number -to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new -B<BIGNUM> is created. If B<bn> is NULL, it only computes the number's -length in hexadecimal digits. If the string starts with '-', the -number is negative. BN_dec2bn() is the same using the decimal system. - -BN_print() and BN_print_fp() write the hexadecimal encoding of B<a>, -with a leading '-' for negative numbers, to the B<BIO> or B<FILE> -B<fp>. - -BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format -that consists of the number's length in bytes represented as a 4-byte -big-endian number, and the number itself in big-endian format, where -the most significant bit signals a negative number (the representation -of numbers with the MSB set is prefixed with null byte). - -BN_bn2mpi() stores the representation of B<a> at B<to>, where B<to> -must be large enough to hold the result. The size can be determined by -calling BN_bn2mpi(B<a>, NULL). - -BN_mpi2bn() converts the B<len> bytes long representation at B<s> to -a B<BIGNUM> and stores it at B<ret>, or in a newly allocated B<BIGNUM> -if B<ret> is NULL. - -=head1 RETURN VALUES - -BN_bn2bin() returns the length of the big-endian number placed at B<to>. -BN_bin2bn() returns the B<BIGNUM>, NULL on error. - -BN_bn2hex() and BN_bn2dec() return a null-terminated string, or NULL -on error. BN_hex2bn() and BN_dec2bn() return the number's length in -hexadecimal or decimal digits, and 0 on error. - -BN_print_fp() and BN_print() return 1 on success, 0 on write errors. - -BN_bn2mpi() returns the length of the representation. BN_mpi2bn() -returns the B<BIGNUM>, and NULL on error. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_zero(3)|BN_zero(3)>, -L<ASN1_INTEGER_to_BN(3)|ASN1_INTEGER_to_BN(3)>, -L<BN_num_bytes(3)|BN_num_bytes(3)> - -=head1 HISTORY - -BN_bn2bin(), BN_bin2bn(), BN_print_fp() and BN_print() are available -in all versions of SSLeay and OpenSSL. - -BN_bn2hex(), BN_bn2dec(), BN_hex2bn(), BN_dec2bn(), BN_bn2mpi() and -BN_mpi2bn() were added in SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_cmp.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_cmp.pod deleted file mode 100644 index 23e9ed0b4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_cmp.pod +++ /dev/null @@ -1,48 +0,0 @@ -=pod - -=head1 NAME - -BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM comparison and test functions - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_cmp(BIGNUM *a, BIGNUM *b); - int BN_ucmp(BIGNUM *a, BIGNUM *b); - - int BN_is_zero(BIGNUM *a); - int BN_is_one(BIGNUM *a); - int BN_is_word(BIGNUM *a, BN_ULONG w); - int BN_is_odd(BIGNUM *a); - -=head1 DESCRIPTION - -BN_cmp() compares the numbers B<a> and B<b>. BN_ucmp() compares their -absolute values. - -BN_is_zero(), BN_is_one() and BN_is_word() test if B<a> equals 0, 1, -or B<w> respectively. BN_is_odd() tests if a is odd. - -BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros. - -=head1 RETURN VALUES - -BN_cmp() returns -1 if B<a> E<lt> B<b>, 0 if B<a> == B<b> and 1 if -B<a> E<gt> B<b>. BN_ucmp() is the same using the absolute values -of B<a> and B<b>. - -BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if -the condition is true, 0 otherwise. - -=head1 SEE ALSO - -L<bn(3)|bn(3)> - -=head1 HISTORY - -BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are -available in all versions of SSLeay and OpenSSL. -BN_is_odd() was added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_copy.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_copy.pod deleted file mode 100644 index 388dd7df2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_copy.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -BN_copy, BN_dup - copy BIGNUMs - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); - - BIGNUM *BN_dup(const BIGNUM *from); - -=head1 DESCRIPTION - -BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM> -containing the value B<from>. - -=head1 RETURN VALUES - -BN_copy() returns B<to> on success, NULL on error. BN_dup() returns -the new B<BIGNUM>, and NULL on error. The error codes can be obtained -by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -BN_copy() and BN_dup() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_generate_prime.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_generate_prime.pod deleted file mode 100644 index 7dccacbc1..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_generate_prime.pod +++ /dev/null @@ -1,102 +0,0 @@ -=pod - -=head1 NAME - -BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test for primality - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add, - BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); - - int BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int, int, - void *), BN_CTX *ctx, void *cb_arg); - - int BN_is_prime_fasttest(const BIGNUM *a, int checks, - void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg, - int do_trial_division); - -=head1 DESCRIPTION - -BN_generate_prime() generates a pseudo-random prime number of B<num> -bits. -If B<ret> is not B<NULL>, it will be used to store the number. - -If B<callback> is not B<NULL>, it is called as follows: - -=over 4 - -=item * - -B<callback(0, i, cb_arg)> is called after generating the i-th -potential prime number. - -=item * - -While the number is being tested for primality, B<callback(1, j, -cb_arg)> is called as described below. - -=item * - -When a prime has been found, B<callback(2, i, cb_arg)> is called. - -=back - -The prime may have to fulfill additional requirements for use in -Diffie-Hellman key exchange: - -If B<add> is not B<NULL>, the prime will fulfill the condition p % B<add> -== B<rem> (p % B<add> == 1 if B<rem> == B<NULL>) in order to suit a given -generator. - -If B<safe> is true, it will be a safe prime (i.e. a prime p so -that (p-1)/2 is also prime). - -The PRNG must be seeded prior to calling BN_generate_prime(). -The prime number generation has a negligible error probability. - -BN_is_prime() and BN_is_prime_fasttest() test if the number B<a> is -prime. The following tests are performed until one of them shows that -B<a> is composite; if B<a> passes all these tests, it is considered -prime. - -BN_is_prime_fasttest(), when called with B<do_trial_division == 1>, -first attempts trial division by a number of small primes; -if no divisors are found by this test and B<callback> is not B<NULL>, -B<callback(1, -1, cb_arg)> is called. -If B<do_trial_division == 0>, this test is skipped. - -Both BN_is_prime() and BN_is_prime_fasttest() perform a Miller-Rabin -probabilistic primality test with B<checks> iterations. If -B<checks == BN_prime_checks>, a number of iterations is used that -yields a false positive rate of at most 2^-80 for random input. - -If B<callback> is not B<NULL>, B<callback(1, j, cb_arg)> is called -after the j-th iteration (j = 0, 1, ...). B<ctx> is a -pre-allocated B<BN_CTX> (to save the overhead of allocating and -freeing the structure in a loop), or B<NULL>. - -=head1 RETURN VALUES - -BN_generate_prime() returns the prime number on success, B<NULL> otherwise. - -BN_is_prime() returns 0 if the number is composite, 1 if it is -prime with an error probability of less than 0.25^B<checks>, and --1 on error. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)> - -=head1 HISTORY - -The B<cb_arg> arguments to BN_generate_prime() and to BN_is_prime() -were added in SSLeay 0.9.0. The B<ret> argument to BN_generate_prime() -was added in SSLeay 0.9.1. -BN_is_prime_fasttest() was added in OpenSSL 0.9.5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_inverse.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_mod_inverse.pod deleted file mode 100644 index 3ea3975c7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_inverse.pod +++ /dev/null @@ -1,36 +0,0 @@ -=pod - -=head1 NAME - -BN_mod_inverse - compute inverse modulo n - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, - BN_CTX *ctx); - -=head1 DESCRIPTION - -BN_mod_inverse() computes the inverse of B<a> modulo B<n> -places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, -a new B<BIGNUM> is created. - -B<ctx> is a previously allocated B<BN_CTX> used for temporary -variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>. - -=head1 RETURN VALUES - -BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and -NULL on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)> - -=head1 HISTORY - -BN_mod_inverse() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_montgomery.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_montgomery.pod deleted file mode 100644 index 6b16351b9..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_montgomery.pod +++ /dev/null @@ -1,101 +0,0 @@ -=pod - -=head1 NAME - -BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init, -BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, -BN_from_montgomery, BN_to_montgomery - Montgomery multiplication - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BN_MONT_CTX *BN_MONT_CTX_new(void); - void BN_MONT_CTX_init(BN_MONT_CTX *ctx); - void BN_MONT_CTX_free(BN_MONT_CTX *mont); - - int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); - BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); - - int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); - - int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); - - int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); - -=head1 DESCRIPTION - -These functions implement Montgomery multiplication. They are used -automatically when L<BN_mod_exp(3)|BN_mod_exp(3)> is called with suitable input, -but they may be useful when several operations are to be performed -using the same modulus. - -BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure. -BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. - -BN_MONT_CTX_set() sets up the I<mont> structure from the modulus I<m> -by precomputing its inverse and a value R. - -BN_MONT_CTX_copy() copies the B<BN_MONT_CTX> I<from> to I<to>. - -BN_MONT_CTX_free() frees the components of the B<BN_MONT_CTX>, and, if -it was created by BN_MONT_CTX_new(), also the structure itself. - -BN_mod_mul_montgomery() computes Mont(I<a>,I<b>):=I<a>*I<b>*R^-1 and places -the result in I<r>. - -BN_from_montgomery() performs the Montgomery reduction I<r> = I<a>*R^-1. - -BN_to_montgomery() computes Mont(I<a>,R^2), i.e. I<a>*R. -Note that I<a> must be non-negative and smaller than the modulus. - -For all functions, I<ctx> is a previously allocated B<BN_CTX> used for -temporary variables. - -The B<BN_MONT_CTX> structure is defined as follows: - - typedef struct bn_mont_ctx_st - { - int ri; /* number of bits in R */ - BIGNUM RR; /* R^2 (used to convert to Montgomery form) */ - BIGNUM N; /* The modulus */ - BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 - * (Ni is only stored for bignum algorithm) */ - BN_ULONG n0; /* least significant word of Ni */ - int flags; - } BN_MONT_CTX; - -BN_to_montgomery() is a macro. - -=head1 RETURN VALUES - -BN_MONT_CTX_new() returns the newly allocated B<BN_MONT_CTX>, and NULL -on error. - -BN_MONT_CTX_init() and BN_MONT_CTX_free() have no return values. - -For the other functions, 1 is returned for success, 0 on error. -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 WARNING - -The inputs must be reduced modulo B<m>, otherwise the result will be -outside the expected range. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, -L<BN_CTX_new(3)|BN_CTX_new(3)> - -=head1 HISTORY - -BN_MONT_CTX_new(), BN_MONT_CTX_free(), BN_MONT_CTX_set(), -BN_mod_mul_montgomery(), BN_from_montgomery() and BN_to_montgomery() -are available in all versions of SSLeay and OpenSSL. - -BN_MONT_CTX_init() and BN_MONT_CTX_copy() were added in SSLeay 0.9.1b. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_reciprocal.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_reciprocal.pod deleted file mode 100644 index 74a216ddc..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_mod_mul_reciprocal.pod +++ /dev/null @@ -1,81 +0,0 @@ -=pod - -=head1 NAME - -BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_init, -BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using -reciprocal - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BN_RECP_CTX *BN_RECP_CTX_new(void); - void BN_RECP_CTX_init(BN_RECP_CTX *recp); - void BN_RECP_CTX_free(BN_RECP_CTX *recp); - - int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx); - - int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *a, BN_RECP_CTX *recp, - BN_CTX *ctx); - - int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, - BN_RECP_CTX *recp, BN_CTX *ctx); - -=head1 DESCRIPTION - -BN_mod_mul_reciprocal() can be used to perform an efficient -L<BN_mod_mul(3)|BN_mod_mul(3)> operation when the operation will be performed -repeatedly with the same modulus. It computes B<r>=(B<a>*B<b>)%B<m> -using B<recp>=1/B<m>, which is set as described below. B<ctx> is a -previously allocated B<BN_CTX> used for temporary variables. - -BN_RECP_CTX_new() allocates and initializes a B<BN_RECP> structure. -BN_RECP_CTX_init() initializes an existing uninitialized B<BN_RECP>. - -BN_RECP_CTX_free() frees the components of the B<BN_RECP>, and, if it -was created by BN_RECP_CTX_new(), also the structure itself. - -BN_RECP_CTX_set() stores B<m> in B<recp> and sets it up for computing -1/B<m> and shifting it left by BN_num_bits(B<m>)+1 to make it an -integer. The result and the number of bits it was shifted left will -later be stored in B<recp>. - -BN_div_recp() divides B<a> by B<m> using B<recp>. It places the quotient -in B<dv> and the remainder in B<rem>. - -The B<BN_RECP_CTX> structure is defined as follows: - - typedef struct bn_recp_ctx_st - { - BIGNUM N; /* the divisor */ - BIGNUM Nr; /* the reciprocal */ - int num_bits; - int shift; - int flags; - } BN_RECP_CTX; - -It cannot be shared between threads. - -=head1 RETURN VALUES - -BN_RECP_CTX_new() returns the newly allocated B<BN_RECP_CTX>, and NULL -on error. - -BN_RECP_CTX_init() and BN_RECP_CTX_free() have no return values. - -For the other functions, 1 is returned for success, 0 on error. -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, -L<BN_CTX_new(3)|BN_CTX_new(3)> - -=head1 HISTORY - -B<BN_RECP_CTX> was added in SSLeay 0.9.0. Before that, the function -BN_reciprocal() was used instead, and the BN_mod_mul_reciprocal() -arguments were different. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_new.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_new.pod deleted file mode 100644 index ab7a105e3..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_new.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -BN_new, BN_init, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BIGNUM *BN_new(void); - - void BN_init(BIGNUM *); - - void BN_clear(BIGNUM *a); - - void BN_free(BIGNUM *a); - - void BN_clear_free(BIGNUM *a); - -=head1 DESCRIPTION - -BN_new() allocates and initializes a B<BIGNUM> structure. BN_init() -initializes an existing uninitialized B<BIGNUM>. - -BN_clear() is used to destroy sensitive data such as keys when they -are no longer needed. It erases the memory used by B<a> and sets it -to the value 0. - -BN_free() frees the components of the B<BIGNUM>, and if it was created -by BN_new(), also the structure itself. BN_clear_free() additionally -overwrites the data before the memory is returned to the system. - -=head1 RETURN VALUES - -BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails, -it returns B<NULL> and sets an error code that can be obtained -by L<ERR_get_error(3)|ERR_get_error(3)>. - -BN_init(), BN_clear(), BN_free() and BN_clear_free() have no return -values. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -BN_new(), BN_clear(), BN_free() and BN_clear_free() are available in -all versions on SSLeay and OpenSSL. BN_init() was added in SSLeay -0.9.1b. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_num_bytes.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_num_bytes.pod deleted file mode 100644 index a6a2e3f81..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_num_bytes.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_num_bytes(const BIGNUM *a); - - int BN_num_bits(const BIGNUM *a); - - int BN_num_bits_word(BN_ULONG w); - -=head1 DESCRIPTION - -BN_num_bytes() returns the size of a B<BIGNUM> in bytes. - -BN_num_bits_word() returns the number of significant bits in a word. -If we take 0x00000432 as an example, it returns 11, not 16, not 32. -Basically, except for a zero, it returns I<floor(log2(w))+1>. - -BN_num_bits() returns the number of significant bits in a B<BIGNUM>, -following the same principle as BN_num_bits_word(). - -BN_num_bytes() is a macro. - -=head1 RETURN VALUES - -The size. - -=head1 NOTES - -Some have tried using BN_num_bits() on individual numbers in RSA keys, -DH keys and DSA keys, and found that they don't always come up with -the number of bits they expected (something like 512, 1024, 2048, -...). This is because generating a number with some specific number -of bits doesn't always set the highest bits, thereby making the number -of I<significant> bits a little lower. If you want to know the "key -size" of such a key, either use functions like RSA_size(), DH_size() -and DSA_size(), or use BN_num_bytes() and multiply with 8 (although -there's no real guarantee that will match the "key size", just a lot -more probability). - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<DH_size(3)|DH_size(3)>, L<DSA_size(3)|DSA_size(3)>, -L<RSA_size(3)|RSA_size(3)> - -=head1 HISTORY - -BN_num_bytes(), BN_num_bits() and BN_num_bits_word() are available in -all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_rand.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_rand.pod deleted file mode 100644 index 81f93c2eb..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_rand.pod +++ /dev/null @@ -1,58 +0,0 @@ -=pod - -=head1 NAME - -BN_rand, BN_pseudo_rand - generate pseudo-random number - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); - - int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); - - int BN_rand_range(BIGNUM *rnd, BIGNUM *range); - - int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range); - -=head1 DESCRIPTION - -BN_rand() generates a cryptographically strong pseudo-random number of -B<bits> bits in length and stores it in B<rnd>. If B<top> is -1, the -most significant bit of the random number can be zero. If B<top> is 0, -it is set to 1, and if B<top> is 1, the two most significant bits of -the number will be set to 1, so that the product of two such random -numbers will always have 2*B<bits> length. If B<bottom> is true, the -number will be odd. - -BN_pseudo_rand() does the same, but pseudo-random numbers generated by -this function are not necessarily unpredictable. They can be used for -non-cryptographic purposes and for certain purposes in cryptographic -protocols, but usually not for key generation etc. - -BN_rand_range() generates a cryptographically strong pseudo-random -number B<rnd> in the range 0 <lt>= B<rnd> E<lt> B<range>. -BN_pseudo_rand_range() does the same, but is based on BN_pseudo_rand(), -and hence numbers generated by it are not necessarily unpredictable. - -The PRNG must be seeded prior to calling BN_rand() or BN_rand_range(). - -=head1 RETURN VALUES - -The functions return 1 on success, 0 on error. -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)> - -=head1 HISTORY - -BN_rand() is available in all versions of SSLeay and OpenSSL. -BN_pseudo_rand() was added in OpenSSL 0.9.5. The B<top> == -1 case -and the function BN_rand_range() were added in OpenSSL 0.9.6a. -BN_pseudo_rand_range() was added in OpenSSL 0.9.6c. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_set_bit.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_set_bit.pod deleted file mode 100644 index b7c47b9b0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_set_bit.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, -BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_set_bit(BIGNUM *a, int n); - int BN_clear_bit(BIGNUM *a, int n); - - int BN_is_bit_set(const BIGNUM *a, int n); - - int BN_mask_bits(BIGNUM *a, int n); - - int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); - int BN_lshift1(BIGNUM *r, BIGNUM *a); - - int BN_rshift(BIGNUM *r, BIGNUM *a, int n); - int BN_rshift1(BIGNUM *r, BIGNUM *a); - -=head1 DESCRIPTION - -BN_set_bit() sets bit B<n> in B<a> to 1 (C<a|=(1E<lt>E<lt>n)>). The -number is expanded if necessary. - -BN_clear_bit() sets bit B<n> in B<a> to 0 (C<a&=~(1E<lt>E<lt>n)>). An -error occurs if B<a> is shorter than B<n> bits. - -BN_is_bit_set() tests if bit B<n> in B<a> is set. - -BN_mask_bits() truncates B<a> to an B<n> bit number -(C<a&=~((~0)E<gt>E<gt>n)>). An error occurs if B<a> already is -shorter than B<n> bits. - -BN_lshift() shifts B<a> left by B<n> bits and places the result in -B<r> (C<r=a*2^n>). BN_lshift1() shifts B<a> left by one and places -the result in B<r> (C<r=2*a>). - -BN_rshift() shifts B<a> right by B<n> bits and places the result in -B<r> (C<r=a/2^n>). BN_rshift1() shifts B<a> right by one and places -the result in B<r> (C<r=a/2>). - -For the shift functions, B<r> and B<a> may be the same variable. - -=head1 RETURN VALUES - -BN_is_bit_set() returns 1 if the bit is set, 0 otherwise. - -All other functions return 1 for success, 0 on error. The error codes -can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, L<BN_add(3)|BN_add(3)> - -=head1 HISTORY - -BN_set_bit(), BN_clear_bit(), BN_is_bit_set(), BN_mask_bits(), -BN_lshift(), BN_lshift1(), BN_rshift(), and BN_rshift1() are available -in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_swap.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_swap.pod deleted file mode 100644 index 79efaa144..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_swap.pod +++ /dev/null @@ -1,23 +0,0 @@ -=pod - -=head1 NAME - -BN_swap - exchange BIGNUMs - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - void BN_swap(BIGNUM *a, BIGNUM *b); - -=head1 DESCRIPTION - -BN_swap() exchanges the values of I<a> and I<b>. - -L<bn(3)|bn(3)> - -=head1 HISTORY - -BN_swap was added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/BN_zero.pod b/sys/src/ape/lib/openssl/doc/crypto/BN_zero.pod deleted file mode 100644 index b555ec398..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/BN_zero.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment -operations - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - int BN_zero(BIGNUM *a); - int BN_one(BIGNUM *a); - - const BIGNUM *BN_value_one(void); - - int BN_set_word(BIGNUM *a, unsigned long w); - unsigned long BN_get_word(BIGNUM *a); - -=head1 DESCRIPTION - -BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and -B<w> respectively. BN_zero() and BN_one() are macros. - -BN_value_one() returns a B<BIGNUM> constant of value 1. This constant -is useful for use in comparisons and assignment. - -BN_get_word() returns B<a>, if it can be represented as an unsigned -long. - -=head1 RETURN VALUES - -BN_get_word() returns the value B<a>, and 0xffffffffL if B<a> cannot -be represented as an unsigned long. - -BN_zero(), BN_one() and BN_set_word() return 1 on success, 0 otherwise. -BN_value_one() returns the constant. - -=head1 BUGS - -Someone might change the constant. - -If a B<BIGNUM> is equal to 0xffffffffL it can be represented as an -unsigned long but this value is also returned on error. - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)> - -=head1 HISTORY - -BN_zero(), BN_one() and BN_set_word() are available in all versions of -SSLeay and OpenSSL. BN_value_one() and BN_get_word() were added in -SSLeay 0.8. - -BN_value_one() was changed to return a true const BIGNUM * in OpenSSL -0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_free.pod b/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_free.pod deleted file mode 100644 index 87bc7b783..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_free.pod +++ /dev/null @@ -1,47 +0,0 @@ -=pod - -=head1 NAME - - CONF_modules_free, CONF_modules_finish, CONF_modules_unload - - OpenSSL configuration cleanup functions - -=head1 SYNOPSIS - - #include <openssl/conf.h> - - void CONF_modules_free(void); - void CONF_modules_finish(void); - void CONF_modules_unload(int all); - -=head1 DESCRIPTION - -CONF_modules_free() closes down and frees up all memory allocated by all -configuration modules. - -CONF_modules_finish() calls each configuration modules B<finish> handler -to free up any configuration that module may have performed. - -CONF_modules_unload() finishes and unloads configuration modules. If -B<all> is set to B<0> only modules loaded from DSOs will be unloads. If -B<all> is B<1> all modules, including builtin modules will be unloaded. - -=head1 NOTES - -Normally applications will only call CONF_modules_free() at application to -tidy up any configuration performed. - -=head1 RETURN VALUE - -None of the functions return a value. - -=head1 SEE ALSO - -L<conf(5)|conf(5)>, L<OPENSSL_config(3)|OPENSSL_config(3)>, -L<CONF_modules_load_file(3), CONF_modules_load_file(3)> - -=head1 HISTORY - -CONF_modules_free(), CONF_modules_unload(), and CONF_modules_finish() -first appeared in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_load_file.pod b/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_load_file.pod deleted file mode 100644 index 9965d69bf..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/CONF_modules_load_file.pod +++ /dev/null @@ -1,60 +0,0 @@ -=pod - -=head1 NAME - - CONF_modules_load_file, CONF_modules_load - OpenSSL configuration functions - -=head1 SYNOPSIS - - #include <openssl/conf.h> - - int CONF_modules_load_file(const char *filename, const char *appname, - unsigned long flags); - int CONF_modules_load(const CONF *cnf, const char *appname, - unsigned long flags); - -=head1 DESCRIPTION - -The function CONF_modules_load_file() configures OpenSSL using file -B<filename> and application name B<appname>. If B<filename> is NULL -the standard OpenSSL configuration file is used. If B<appname> is -NULL the standard OpenSSL application name B<openssl_conf> is used. -The behaviour can be cutomized using B<flags>. - -CONF_modules_load() is idential to CONF_modules_load_file() except it -read configuration information from B<cnf>. - -=head1 NOTES - -The following B<flags> are currently recognized: - -B<CONF_MFLAGS_IGNORE_ERRORS> if set errors returned by individual -configuration modules are ignored. If not set the first module error is -considered fatal and no further modules are loads. - -Normally any modules errors will add error information to the error queue. If -B<CONF_MFLAGS_SILENT> is set no error information is added. - -If B<CONF_MFLAGS_NO_DSO> is set configuration module loading from DSOs is -disabled. - -B<CONF_MFLAGS_IGNORE_MISSING_FILE> if set will make CONF_load_modules_file() -ignore missing configuration files. Normally a missing configuration file -return an error. - -=head1 RETURN VALUE - -These functions return 1 for success and a zero or negative value for -failure. If module errors are not ignored the return code will reflect the -return value of the failing module (this will always be zero or negative). - -=head1 SEE ALSO - -L<conf(5)|conf(5)>, L<OPENSSL_config(3)|OPENSSL_config(3)>, -L<CONF_free(3), CONF_free(3)>, L<err(3),err(3)> - -=head1 HISTORY - -CONF_modules_load_file and CONF_modules_load first appeared in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/CRYPTO_set_ex_data.pod b/sys/src/ape/lib/openssl/doc/crypto/CRYPTO_set_ex_data.pod deleted file mode 100644 index 1bd5bed67..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/CRYPTO_set_ex_data.pod +++ /dev/null @@ -1,51 +0,0 @@ -=pod - -=head1 NAME - -CRYPTO_set_ex_data, CRYPTO_get_ex_data - internal application specific data functions - -=head1 SYNOPSIS - - int CRYPTO_set_ex_data(CRYPTO_EX_DATA *r, int idx, void *arg); - - void *CRYPTO_get_ex_data(CRYPTO_EX_DATA *r, int idx); - -=head1 DESCRIPTION - -Several OpenSSL structures can have application specific data attached to them. -These functions are used internally by OpenSSL to manipulate application -specific data attached to a specific structure. - -These functions should only be used by applications to manipulate -B<CRYPTO_EX_DATA> structures passed to the B<new_func()>, B<free_func()> and -B<dup_func()> callbacks: as passed to B<RSA_get_ex_new_index()> for example. - -B<CRYPTO_set_ex_data()> is used to set application specific data, the data is -supplied in the B<arg> parameter and its precise meaning is up to the -application. - -B<CRYPTO_get_ex_data()> is used to retrieve application specific data. The data -is returned to the application, this will be the same value as supplied to -a previous B<CRYPTO_set_ex_data()> call. - -=head1 RETURN VALUES - -B<CRYPTO_set_ex_data()> returns 1 on success or 0 on failure. - -B<CRYPTO_get_ex_data()> returns the application data or 0 on failure. 0 may also -be valid application data but currently it can only fail if given an invalid B<idx> -parameter. - -On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, -L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>, -L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)> - -=head1 HISTORY - -CRYPTO_set_ex_data() and CRYPTO_get_ex_data() have been available since SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_generate_key.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_generate_key.pod deleted file mode 100644 index 81f09fdf4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_generate_key.pod +++ /dev/null @@ -1,50 +0,0 @@ -=pod - -=head1 NAME - -DH_generate_key, DH_compute_key - perform Diffie-Hellman key exchange - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - int DH_generate_key(DH *dh); - - int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); - -=head1 DESCRIPTION - -DH_generate_key() performs the first step of a Diffie-Hellman key -exchange by generating private and public DH values. By calling -DH_compute_key(), these are combined with the other party's public -value to compute the shared key. - -DH_generate_key() expects B<dh> to contain the shared parameters -B<dh-E<gt>p> and B<dh-E<gt>g>. It generates a random private DH value -unless B<dh-E<gt>priv_key> is already set, and computes the -corresponding public value B<dh-E<gt>pub_key>, which can then be -published. - -DH_compute_key() computes the shared secret from the private DH value -in B<dh> and the other party's public value in B<pub_key> and stores -it in B<key>. B<key> must point to B<DH_size(dh)> bytes of memory. - -=head1 RETURN VALUES - -DH_generate_key() returns 1 on success, 0 otherwise. - -DH_compute_key() returns the size of the shared secret on success, -1 -on error. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, L<DH_size(3)|DH_size(3)> - -=head1 HISTORY - -DH_generate_key() and DH_compute_key() are available in all versions -of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_generate_parameters.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_generate_parameters.pod deleted file mode 100644 index 9081e9ea7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_generate_parameters.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -DH_generate_parameters, DH_check - generate and check Diffie-Hellman parameters - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - DH *DH_generate_parameters(int prime_len, int generator, - void (*callback)(int, int, void *), void *cb_arg); - - int DH_check(DH *dh, int *codes); - -=head1 DESCRIPTION - -DH_generate_parameters() generates Diffie-Hellman parameters that can -be shared among a group of users, and returns them in a newly -allocated B<DH> structure. The pseudo-random number generator must be -seeded prior to calling DH_generate_parameters(). - -B<prime_len> is the length in bits of the safe prime to be generated. -B<generator> is a small number E<gt> 1, typically 2 or 5. - -A callback function may be used to provide feedback about the progress -of the key generation. If B<callback> is not B<NULL>, it will be -called as described in L<BN_generate_prime(3)|BN_generate_prime(3)> while a random prime -number is generated, and when a prime has been found, B<callback(3, -0, cb_arg)> is called. - -DH_check() validates Diffie-Hellman parameters. It checks that B<p> is -a safe prime, and that B<g> is a suitable generator. In the case of an -error, the bit flags DH_CHECK_P_NOT_SAFE_PRIME or -DH_NOT_SUITABLE_GENERATOR are set in B<*codes>. -DH_UNABLE_TO_CHECK_GENERATOR is set if the generator cannot be -checked, i.e. it does not equal 2 or 5. - -=head1 RETURN VALUES - -DH_generate_parameters() returns a pointer to the DH structure, or -NULL if the parameter generation fails. The error codes can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -DH_check() returns 1 if the check could be performed, 0 otherwise. - -=head1 NOTES - -DH_generate_parameters() may run for several hours before finding a -suitable prime. - -The parameters generated by DH_generate_parameters() are not to be -used in signature schemes. - -=head1 BUGS - -If B<generator> is not 2 or 5, B<dh-E<gt>g>=B<generator> is not -a usable generator. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DH_free(3)|DH_free(3)> - -=head1 HISTORY - -DH_check() is available in all versions of SSLeay and OpenSSL. -The B<cb_arg> argument to DH_generate_parameters() was added in SSLeay 0.9.0. - -In versions before OpenSSL 0.9.5, DH_CHECK_P_NOT_STRONG_PRIME is used -instead of DH_CHECK_P_NOT_SAFE_PRIME. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_get_ex_new_index.pod deleted file mode 100644 index fa5eab265..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_get_ex_new_index.pod +++ /dev/null @@ -1,36 +0,0 @@ -=pod - -=head1 NAME - -DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data - add application specific data to DH structures - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - int DH_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int DH_set_ex_data(DH *d, int idx, void *arg); - - char *DH_get_ex_data(DH *d, int idx); - -=head1 DESCRIPTION - -These functions handle application specific data in DH -structures. Their usage is identical to that of -RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() -as described in L<RSA_get_ex_new_index(3)>. - -=head1 SEE ALSO - -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dh(3)|dh(3)> - -=head1 HISTORY - -DH_get_ex_new_index(), DH_set_ex_data() and DH_get_ex_data() are -available since OpenSSL 0.9.5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_new.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_new.pod deleted file mode 100644 index 60c930093..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_new.pod +++ /dev/null @@ -1,40 +0,0 @@ -=pod - -=head1 NAME - -DH_new, DH_free - allocate and free DH objects - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - DH* DH_new(void); - - void DH_free(DH *dh); - -=head1 DESCRIPTION - -DH_new() allocates and initializes a B<DH> structure. - -DH_free() frees the B<DH> structure and its components. The values are -erased before the memory is returned to the system. - -=head1 RETURN VALUES - -If the allocation fails, DH_new() returns B<NULL> and sets an error -code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns -a pointer to the newly allocated structure. - -DH_free() returns no value. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, -L<DH_generate_parameters(3)|DH_generate_parameters(3)>, -L<DH_generate_key(3)|DH_generate_key(3)> - -=head1 HISTORY - -DH_new() and DH_free() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_set_method.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_set_method.pod deleted file mode 100644 index 73261fc46..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_set_method.pod +++ /dev/null @@ -1,129 +0,0 @@ -=pod - -=head1 NAME - -DH_set_default_method, DH_get_default_method, -DH_set_method, DH_new_method, DH_OpenSSL - select DH method - -=head1 SYNOPSIS - - #include <openssl/dh.h> - #include <openssl/engine.h> - - void DH_set_default_method(const DH_METHOD *meth); - - const DH_METHOD *DH_get_default_method(void); - - int DH_set_method(DH *dh, const DH_METHOD *meth); - - DH *DH_new_method(ENGINE *engine); - - const DH_METHOD *DH_OpenSSL(void); - -=head1 DESCRIPTION - -A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman -operations. By modifying the method, alternative implementations -such as hardware accelerators may be used. IMPORTANT: See the NOTES section for -important information about how these DH API functions are affected by the use -of B<ENGINE> API calls. - -Initially, the default DH_METHOD is the OpenSSL internal implementation, as -returned by DH_OpenSSL(). - -DH_set_default_method() makes B<meth> the default method for all DH -structures created later. B<NB>: This is true only whilst no ENGINE has been set -as a default for DH, so this function is no longer recommended. - -DH_get_default_method() returns a pointer to the current default DH_METHOD. -However, the meaningfulness of this result is dependant on whether the ENGINE -API is being used, so this function is no longer recommended. - -DH_set_method() selects B<meth> to perform all operations using the key B<dh>. -This will replace the DH_METHOD used by the DH key and if the previous method -was supplied by an ENGINE, the handle to that ENGINE will be released during the -change. It is possible to have DH keys that only work with certain DH_METHOD -implementations (eg. from an ENGINE module that supports embedded -hardware-protected keys), and in such cases attempting to change the DH_METHOD -for the key can have unexpected results. - -DH_new_method() allocates and initializes a DH structure so that B<engine> will -be used for the DH operations. If B<engine> is NULL, the default ENGINE for DH -operations is used, and if no default ENGINE is set, the DH_METHOD controlled by -DH_set_default_method() is used. - -=head1 THE DH_METHOD STRUCTURE - - typedef struct dh_meth_st - { - /* name of the implementation */ - const char *name; - - /* generate private and public DH values for key agreement */ - int (*generate_key)(DH *dh); - - /* compute shared secret */ - int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh); - - /* compute r = a ^ p mod m (May be NULL for some implementations) */ - int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, - BN_MONT_CTX *m_ctx); - - /* called at DH_new */ - int (*init)(DH *dh); - - /* called at DH_free */ - int (*finish)(DH *dh); - - int flags; - - char *app_data; /* ?? */ - - } DH_METHOD; - -=head1 RETURN VALUES - -DH_OpenSSL() and DH_get_default_method() return pointers to the respective -B<DH_METHOD>s. - -DH_set_default_method() returns no value. - -DH_set_method() returns non-zero if the provided B<meth> was successfully set as -the method for B<dh> (including unloading the ENGINE handle if the previous -method was supplied by an ENGINE). - -DH_new_method() returns NULL and sets an error code that can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it -returns a pointer to the newly allocated structure. - -=head1 NOTES - -As of version 0.9.7, DH_METHOD implementations are grouped together with other -algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a -default ENGINE is specified for DH functionality using an ENGINE API function, -that will override any DH defaults set using the DH API (ie. -DH_set_default_method()). For this reason, the ENGINE API is the recommended way -to control default implementations for use in DH and other cryptographic -algorithms. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)> - -=head1 HISTORY - -DH_set_default_method(), DH_get_default_method(), DH_set_method(), -DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. - -DH_set_default_openssl_method() and DH_get_default_openssl_method() replaced -DH_set_default_method() and DH_get_default_method() respectively, and -DH_set_method() and DH_new_method() were altered to use B<ENGINE>s rather than -B<DH_METHOD>s during development of the engine version of OpenSSL 0.9.6. For -0.9.7, the handling of defaults in the ENGINE API was restructured so that this -change was reversed, and behaviour of the other functions resembled more closely -the previous behaviour. The behaviour of defaults in the ENGINE API now -transparently overrides the behaviour of defaults in the DH API without -requiring changing these function prototypes. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DH_size.pod b/sys/src/ape/lib/openssl/doc/crypto/DH_size.pod deleted file mode 100644 index 97f26fda7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DH_size.pod +++ /dev/null @@ -1,33 +0,0 @@ -=pod - -=head1 NAME - -DH_size - get Diffie-Hellman prime size - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - int DH_size(DH *dh); - -=head1 DESCRIPTION - -This function returns the Diffie-Hellman size in bytes. It can be used -to determine how much memory must be allocated for the shared secret -computed by DH_compute_key(). - -B<dh-E<gt>p> must not be B<NULL>. - -=head1 RETURN VALUE - -The size in bytes. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<DH_generate_key(3)|DH_generate_key(3)> - -=head1 HISTORY - -DH_size() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_SIG_new.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_SIG_new.pod deleted file mode 100644 index 3ac614003..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_SIG_new.pod +++ /dev/null @@ -1,40 +0,0 @@ -=pod - -=head1 NAME - -DSA_SIG_new, DSA_SIG_free - allocate and free DSA signature objects - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - DSA_SIG *DSA_SIG_new(void); - - void DSA_SIG_free(DSA_SIG *a); - -=head1 DESCRIPTION - -DSA_SIG_new() allocates and initializes a B<DSA_SIG> structure. - -DSA_SIG_free() frees the B<DSA_SIG> structure and its components. The -values are erased before the memory is returned to the system. - -=head1 RETURN VALUES - -If the allocation fails, DSA_SIG_new() returns B<NULL> and sets an -error code that can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer -to the newly allocated structure. - -DSA_SIG_free() returns no value. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, -L<DSA_do_sign(3)|DSA_do_sign(3)> - -=head1 HISTORY - -DSA_SIG_new() and DSA_SIG_free() were added in OpenSSL 0.9.3. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_do_sign.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_do_sign.pod deleted file mode 100644 index 5dfc733b2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_do_sign.pod +++ /dev/null @@ -1,47 +0,0 @@ -=pod - -=head1 NAME - -DSA_do_sign, DSA_do_verify - raw DSA signature operations - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); - - int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - -=head1 DESCRIPTION - -DSA_do_sign() computes a digital signature on the B<len> byte message -digest B<dgst> using the private key B<dsa> and returns it in a -newly allocated B<DSA_SIG> structure. - -L<DSA_sign_setup(3)|DSA_sign_setup(3)> may be used to precompute part -of the signing operation in case signature generation is -time-critical. - -DSA_do_verify() verifies that the signature B<sig> matches a given -message digest B<dgst> of size B<len>. B<dsa> is the signer's public -key. - -=head1 RETURN VALUES - -DSA_do_sign() returns the signature, NULL on error. DSA_do_verify() -returns 1 for a valid signature, 0 for an incorrect signature and -1 -on error. The error codes can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DSA_SIG_new(3)|DSA_SIG_new(3)>, -L<DSA_sign(3)|DSA_sign(3)> - -=head1 HISTORY - -DSA_do_sign() and DSA_do_verify() were added in OpenSSL 0.9.3. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_dup_DH.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_dup_DH.pod deleted file mode 100644 index 7f6f0d111..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_dup_DH.pod +++ /dev/null @@ -1,36 +0,0 @@ -=pod - -=head1 NAME - -DSA_dup_DH - create a DH structure out of DSA structure - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - DH * DSA_dup_DH(const DSA *r); - -=head1 DESCRIPTION - -DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q -is lost during that conversion, but the resulting DH parameters -contain its length. - -=head1 RETURN VALUE - -DSA_dup_DH() returns the new B<DH> structure, and NULL on error. The -error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 NOTE - -Be careful to avoid small subgroup attacks when using this. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -DSA_dup_DH() was added in OpenSSL 0.9.4. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_key.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_key.pod deleted file mode 100644 index af83ccfaa..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_key.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -DSA_generate_key - generate DSA key pair - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - int DSA_generate_key(DSA *a); - -=head1 DESCRIPTION - -DSA_generate_key() expects B<a> to contain DSA parameters. It generates -a new key pair and stores it in B<a-E<gt>pub_key> and B<a-E<gt>priv_key>. - -The PRNG must be seeded prior to calling DSA_generate_key(). - -=head1 RETURN VALUE - -DSA_generate_key() returns 1 on success, 0 otherwise. -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DSA_generate_parameters(3)|DSA_generate_parameters(3)> - -=head1 HISTORY - -DSA_generate_key() is available since SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_parameters.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_parameters.pod deleted file mode 100644 index be7c924ff..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_generate_parameters.pod +++ /dev/null @@ -1,105 +0,0 @@ -=pod - -=head1 NAME - -DSA_generate_parameters - generate DSA parameters - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - DSA *DSA_generate_parameters(int bits, unsigned char *seed, - int seed_len, int *counter_ret, unsigned long *h_ret, - void (*callback)(int, int, void *), void *cb_arg); - -=head1 DESCRIPTION - -DSA_generate_parameters() generates primes p and q and a generator g -for use in the DSA. - -B<bits> is the length of the prime to be generated; the DSS allows a -maximum of 1024 bits. - -If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be -generated at random. Otherwise, the seed is used to generate -them. If the given seed does not yield a prime q, a new random -seed is chosen and placed at B<seed>. - -DSA_generate_parameters() places the iteration count in -*B<counter_ret> and a counter used for finding a generator in -*B<h_ret>, unless these are B<NULL>. - -A callback function may be used to provide feedback about the progress -of the key generation. If B<callback> is not B<NULL>, it will be -called as follows: - -=over 4 - -=item * - -When a candidate for q is generated, B<callback(0, m++, cb_arg)> is called -(m is 0 for the first candidate). - -=item * - -When a candidate for q has passed a test by trial division, -B<callback(1, -1, cb_arg)> is called. -While a candidate for q is tested by Miller-Rabin primality tests, -B<callback(1, i, cb_arg)> is called in the outer loop -(once for each witness that confirms that the candidate may be prime); -i is the loop counter (starting at 0). - -=item * - -When a prime q has been found, B<callback(2, 0, cb_arg)> and -B<callback(3, 0, cb_arg)> are called. - -=item * - -Before a candidate for p (other than the first) is generated and tested, -B<callback(0, counter, cb_arg)> is called. - -=item * - -When a candidate for p has passed the test by trial division, -B<callback(1, -1, cb_arg)> is called. -While it is tested by the Miller-Rabin primality test, -B<callback(1, i, cb_arg)> is called in the outer loop -(once for each witness that confirms that the candidate may be prime). -i is the loop counter (starting at 0). - -=item * - -When p has been found, B<callback(2, 1, cb_arg)> is called. - -=item * - -When the generator has been found, B<callback(3, 1, cb_arg)> is called. - -=back - -=head1 RETURN VALUE - -DSA_generate_parameters() returns a pointer to the DSA structure, or -B<NULL> if the parameter generation fails. The error codes can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 BUGS - -Seed lengths E<gt> 20 are not supported. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DSA_free(3)|DSA_free(3)> - -=head1 HISTORY - -DSA_generate_parameters() appeared in SSLeay 0.8. The B<cb_arg> -argument was added in SSLeay 0.9.0. -In versions up to OpenSSL 0.9.4, B<callback(1, ...)> was called -in the inner loop of the Miller-Rabin test whenever it reached the -squaring step (the parameters to B<callback> did not reveal how many -witnesses had been tested); since OpenSSL 0.9.5, B<callback(1, ...)> -is called as in BN_is_prime(3), i.e. once for each witness. -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_get_ex_new_index.pod deleted file mode 100644 index 4612e708e..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_get_ex_new_index.pod +++ /dev/null @@ -1,36 +0,0 @@ -=pod - -=head1 NAME - -DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data - add application specific data to DSA structures - -=head1 SYNOPSIS - - #include <openssl/DSA.h> - - int DSA_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int DSA_set_ex_data(DSA *d, int idx, void *arg); - - char *DSA_get_ex_data(DSA *d, int idx); - -=head1 DESCRIPTION - -These functions handle application specific data in DSA -structures. Their usage is identical to that of -RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() -as described in L<RSA_get_ex_new_index(3)>. - -=head1 SEE ALSO - -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dsa(3)|dsa(3)> - -=head1 HISTORY - -DSA_get_ex_new_index(), DSA_set_ex_data() and DSA_get_ex_data() are -available since OpenSSL 0.9.5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_new.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_new.pod deleted file mode 100644 index 48e9b82a0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_new.pod +++ /dev/null @@ -1,42 +0,0 @@ -=pod - -=head1 NAME - -DSA_new, DSA_free - allocate and free DSA objects - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - DSA* DSA_new(void); - - void DSA_free(DSA *dsa); - -=head1 DESCRIPTION - -DSA_new() allocates and initializes a B<DSA> structure. It is equivalent to -calling DSA_new_method(NULL). - -DSA_free() frees the B<DSA> structure and its components. The values are -erased before the memory is returned to the system. - -=head1 RETURN VALUES - -If the allocation fails, DSA_new() returns B<NULL> and sets an error -code that can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer -to the newly allocated structure. - -DSA_free() returns no value. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, -L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, -L<DSA_generate_key(3)|DSA_generate_key(3)> - -=head1 HISTORY - -DSA_new() and DSA_free() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_set_method.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_set_method.pod deleted file mode 100644 index bc3cfb1f0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_set_method.pod +++ /dev/null @@ -1,143 +0,0 @@ -=pod - -=head1 NAME - -DSA_set_default_method, DSA_get_default_method, -DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - #include <openssl/engine.h> - - void DSA_set_default_method(const DSA_METHOD *meth); - - const DSA_METHOD *DSA_get_default_method(void); - - int DSA_set_method(DSA *dsa, const DSA_METHOD *meth); - - DSA *DSA_new_method(ENGINE *engine); - - DSA_METHOD *DSA_OpenSSL(void); - -=head1 DESCRIPTION - -A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA -operations. By modifying the method, alternative implementations -such as hardware accelerators may be used. IMPORTANT: See the NOTES section for -important information about how these DSA API functions are affected by the use -of B<ENGINE> API calls. - -Initially, the default DSA_METHOD is the OpenSSL internal implementation, -as returned by DSA_OpenSSL(). - -DSA_set_default_method() makes B<meth> the default method for all DSA -structures created later. B<NB>: This is true only whilst no ENGINE has -been set as a default for DSA, so this function is no longer recommended. - -DSA_get_default_method() returns a pointer to the current default -DSA_METHOD. However, the meaningfulness of this result is dependant on -whether the ENGINE API is being used, so this function is no longer -recommended. - -DSA_set_method() selects B<meth> to perform all operations using the key -B<rsa>. This will replace the DSA_METHOD used by the DSA key and if the -previous method was supplied by an ENGINE, the handle to that ENGINE will -be released during the change. It is possible to have DSA keys that only -work with certain DSA_METHOD implementations (eg. from an ENGINE module -that supports embedded hardware-protected keys), and in such cases -attempting to change the DSA_METHOD for the key can have unexpected -results. - -DSA_new_method() allocates and initializes a DSA structure so that B<engine> -will be used for the DSA operations. If B<engine> is NULL, the default engine -for DSA operations is used, and if no default ENGINE is set, the DSA_METHOD -controlled by DSA_set_default_method() is used. - -=head1 THE DSA_METHOD STRUCTURE - -struct - { - /* name of the implementation */ - const char *name; - - /* sign */ - DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, - DSA *dsa); - - /* pre-compute k^-1 and r */ - int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, - BIGNUM **rp); - - /* verify */ - int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - - /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some - implementations) */ - int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, - BIGNUM *a2, BIGNUM *p2, BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *in_mont); - - /* compute r = a ^ p mod m (May be NULL for some implementations) */ - int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, - const BIGNUM *p, const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); - - /* called at DSA_new */ - int (*init)(DSA *DSA); - - /* called at DSA_free */ - int (*finish)(DSA *DSA); - - int flags; - - char *app_data; /* ?? */ - - } DSA_METHOD; - -=head1 RETURN VALUES - -DSA_OpenSSL() and DSA_get_default_method() return pointers to the respective -B<DSA_METHOD>s. - -DSA_set_default_method() returns no value. - -DSA_set_method() returns non-zero if the provided B<meth> was successfully set as -the method for B<dsa> (including unloading the ENGINE handle if the previous -method was supplied by an ENGINE). - -DSA_new_method() returns NULL and sets an error code that can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation -fails. Otherwise it returns a pointer to the newly allocated structure. - -=head1 NOTES - -As of version 0.9.7, DSA_METHOD implementations are grouped together with other -algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a -default ENGINE is specified for DSA functionality using an ENGINE API function, -that will override any DSA defaults set using the DSA API (ie. -DSA_set_default_method()). For this reason, the ENGINE API is the recommended way -to control default implementations for use in DSA and other cryptographic -algorithms. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)> - -=head1 HISTORY - -DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), -DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. - -DSA_set_default_openssl_method() and DSA_get_default_openssl_method() replaced -DSA_set_default_method() and DSA_get_default_method() respectively, and -DSA_set_method() and DSA_new_method() were altered to use B<ENGINE>s rather than -B<DSA_METHOD>s during development of the engine version of OpenSSL 0.9.6. For -0.9.7, the handling of defaults in the ENGINE API was restructured so that this -change was reversed, and behaviour of the other functions resembled more closely -the previous behaviour. The behaviour of defaults in the ENGINE API now -transparently overrides the behaviour of defaults in the DSA API without -requiring changing these function prototypes. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_sign.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_sign.pod deleted file mode 100644 index 97389e8ec..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_sign.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - int DSA_sign(int type, const unsigned char *dgst, int len, - unsigned char *sigret, unsigned int *siglen, DSA *dsa); - - int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, - BIGNUM **rp); - - int DSA_verify(int type, const unsigned char *dgst, int len, - unsigned char *sigbuf, int siglen, DSA *dsa); - -=head1 DESCRIPTION - -DSA_sign() computes a digital signature on the B<len> byte message -digest B<dgst> using the private key B<dsa> and places its ASN.1 DER -encoding at B<sigret>. The length of the signature is places in -*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory. - -DSA_sign_setup() may be used to precompute part of the signing -operation in case signature generation is time-critical. It expects -B<dsa> to contain DSA parameters. It places the precomputed values -in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing -the old ones unless *B<kinvp> and *B<rp> are NULL. These values may -be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>. -B<ctx> is a pre-allocated B<BN_CTX> or NULL. - -DSA_verify() verifies that the signature B<sigbuf> of size B<siglen> -matches a given message digest B<dgst> of size B<len>. -B<dsa> is the signer's public key. - -The B<type> parameter is ignored. - -The PRNG must be seeded before DSA_sign() (or DSA_sign_setup()) -is called. - -=head1 RETURN VALUES - -DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error. -DSA_verify() returns 1 for a valid signature, 0 for an incorrect -signature and -1 on error. The error codes can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 CONFORMING TO - -US Federal Information Processing Standard FIPS 186 (Digital Signature -Standard, DSS), ANSI X9.30 - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DSA_do_sign(3)|DSA_do_sign(3)> - -=head1 HISTORY - -DSA_sign() and DSA_verify() are available in all versions of SSLeay. -DSA_sign_setup() was added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/DSA_size.pod b/sys/src/ape/lib/openssl/doc/crypto/DSA_size.pod deleted file mode 100644 index ba4f65036..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/DSA_size.pod +++ /dev/null @@ -1,33 +0,0 @@ -=pod - -=head1 NAME - -DSA_size - get DSA signature size - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - - int DSA_size(const DSA *dsa); - -=head1 DESCRIPTION - -This function returns the size of an ASN.1 encoded DSA signature in -bytes. It can be used to determine how much memory must be allocated -for a DSA signature. - -B<dsa-E<gt>q> must not be B<NULL>. - -=head1 RETURN VALUE - -The size in bytes. - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<DSA_sign(3)|DSA_sign(3)> - -=head1 HISTORY - -DSA_size() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_GET_LIB.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_GET_LIB.pod deleted file mode 100644 index 2a129da03..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_GET_LIB.pod +++ /dev/null @@ -1,51 +0,0 @@ -=pod - -=head1 NAME - -ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON - get library, function and -reason code - -=head1 SYNOPSIS - - #include <openssl/err.h> - - int ERR_GET_LIB(unsigned long e); - - int ERR_GET_FUNC(unsigned long e); - - int ERR_GET_REASON(unsigned long e); - -=head1 DESCRIPTION - -The error code returned by ERR_get_error() consists of a library -number, function code and reason code. ERR_GET_LIB(), ERR_GET_FUNC() -and ERR_GET_REASON() can be used to extract these. - -The library number and function code describe where the error -occurred, the reason code is the information about what went wrong. - -Each sub-library of OpenSSL has a unique library number; function and -reason codes are unique within each sub-library. Note that different -libraries may use the same value to signal different functions and -reasons. - -B<ERR_R_...> reason codes such as B<ERR_R_MALLOC_FAILURE> are globally -unique. However, when checking for sub-library specific reason codes, -be sure to also compare the library number. - -ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are macros. - -=head1 RETURN VALUES - -The library number, function code and reason code respectively. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are available in -all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_clear_error.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_clear_error.pod deleted file mode 100644 index 566e1f4e3..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_clear_error.pod +++ /dev/null @@ -1,29 +0,0 @@ -=pod - -=head1 NAME - -ERR_clear_error - clear the error queue - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_clear_error(void); - -=head1 DESCRIPTION - -ERR_clear_error() empties the current thread's error queue. - -=head1 RETURN VALUES - -ERR_clear_error() has no return value. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -ERR_clear_error() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_error_string.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_error_string.pod deleted file mode 100644 index cdfa7fe1f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_error_string.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -ERR_error_string, ERR_error_string_n, ERR_lib_error_string, -ERR_func_error_string, ERR_reason_error_string - obtain human-readable -error message - -=head1 SYNOPSIS - - #include <openssl/err.h> - - char *ERR_error_string(unsigned long e, char *buf); - void ERR_error_string_n(unsigned long e, char *buf, size_t len); - - const char *ERR_lib_error_string(unsigned long e); - const char *ERR_func_error_string(unsigned long e); - const char *ERR_reason_error_string(unsigned long e); - -=head1 DESCRIPTION - -ERR_error_string() generates a human-readable string representing the -error code I<e>, and places it at I<buf>. I<buf> must be at least 120 -bytes long. If I<buf> is B<NULL>, the error string is placed in a -static buffer. -ERR_error_string_n() is a variant of ERR_error_string() that writes -at most I<len> characters (including the terminating 0) -and truncates the string if necessary. -For ERR_error_string_n(), I<buf> may not be B<NULL>. - -The string will have the following format: - - error:[error code]:[library name]:[function name]:[reason string] - -I<error code> is an 8 digit hexadecimal number, I<library name>, -I<function name> and I<reason string> are ASCII text. - -ERR_lib_error_string(), ERR_func_error_string() and -ERR_reason_error_string() return the library name, function -name and reason string respectively. - -The OpenSSL error strings should be loaded by calling -L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL -applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> -first. -If there is no text string registered for the given error code, -the error string will contain the numeric code. - -L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print -all error codes currently in the queue. - -=head1 RETURN VALUES - -ERR_error_string() returns a pointer to a static buffer containing the -string if I<buf> B<== NULL>, I<buf> otherwise. - -ERR_lib_error_string(), ERR_func_error_string() and -ERR_reason_error_string() return the strings, and B<NULL> if -none is registered for the error code. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, -L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, -L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> -L<ERR_print_errors(3)|ERR_print_errors(3)> - -=head1 HISTORY - -ERR_error_string() is available in all versions of SSLeay and OpenSSL. -ERR_error_string_n() was added in OpenSSL 0.9.6. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_get_error.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_get_error.pod deleted file mode 100644 index 34443045f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_get_error.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -ERR_get_error, ERR_peek_error, ERR_peek_last_error, -ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, -ERR_get_error_line_data, ERR_peek_error_line_data, -ERR_peek_last_error_line_data - obtain error code and data - -=head1 SYNOPSIS - - #include <openssl/err.h> - - unsigned long ERR_get_error(void); - unsigned long ERR_peek_error(void); - unsigned long ERR_peek_last_error(void); - - unsigned long ERR_get_error_line(const char **file, int *line); - unsigned long ERR_peek_error_line(const char **file, int *line); - unsigned long ERR_peek_last_error_line(const char **file, int *line); - - unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); - unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); - unsigned long ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags); - -=head1 DESCRIPTION - -ERR_get_error() returns the earliest error code from the thread's error -queue and removes the entry. This function can be called repeatedly -until there are no more error codes to return. - -ERR_peek_error() returns the earliest error code from the thread's -error queue without modifying it. - -ERR_peek_last_error() returns the latest error code from the thread's -error queue without modifying it. - -See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about -location and reason of the error, and -L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error -messages. - -ERR_get_error_line(), ERR_peek_error_line() and -ERR_peek_last_error_line() are the same as the above, but they -additionally store the file name and line number where -the error occurred in *B<file> and *B<line>, unless these are B<NULL>. - -ERR_get_error_line_data(), ERR_peek_error_line_data() and -ERR_get_last_error_line_data() store additional data and flags -associated with the error code in *B<data> -and *B<flags>, unless these are B<NULL>. *B<data> contains a string -if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), -*B<flags>&B<ERR_TXT_MALLOCED> is true. - -=head1 RETURN VALUES - -The error code, or 0 if there is no error in the queue. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, -L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> - -=head1 HISTORY - -ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and -ERR_peek_error_line() are available in all versions of SSLeay and -OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() -were added in SSLeay 0.9.0. -ERR_peek_last_error(), ERR_peek_last_error_line() and -ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_load_crypto_strings.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_load_crypto_strings.pod deleted file mode 100644 index 9bdec75a4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_load_crypto_strings.pod +++ /dev/null @@ -1,46 +0,0 @@ -=pod - -=head1 NAME - -ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings - -load and free error strings - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_load_crypto_strings(void); - void ERR_free_strings(void); - - #include <openssl/ssl.h> - - void SSL_load_error_strings(void); - -=head1 DESCRIPTION - -ERR_load_crypto_strings() registers the error strings for all -B<libcrypto> functions. SSL_load_error_strings() does the same, -but also registers the B<libssl> error strings. - -One of these functions should be called before generating -textual error messages. However, this is not required when memory -usage is an issue. - -ERR_free_strings() frees all previously loaded error strings. - -=head1 RETURN VALUES - -ERR_load_crypto_strings(), SSL_load_error_strings() and -ERR_free_strings() return no values. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)> - -=head1 HISTORY - -ERR_load_error_strings(), SSL_load_error_strings() and -ERR_free_strings() are available in all versions of SSLeay and -OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_load_strings.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_load_strings.pod deleted file mode 100644 index 5acdd0edb..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_load_strings.pod +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -=head1 NAME - -ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load -arbitrary error strings - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_load_strings(int lib, ERR_STRING_DATA str[]); - - int ERR_get_next_error_library(void); - - unsigned long ERR_PACK(int lib, int func, int reason); - -=head1 DESCRIPTION - -ERR_load_strings() registers error strings for library number B<lib>. - -B<str> is an array of error string data: - - typedef struct ERR_string_data_st - { - unsigned long error; - char *string; - } ERR_STRING_DATA; - -The error code is generated from the library number and a function and -reason code: B<error> = ERR_PACK(B<lib>, B<func>, B<reason>). -ERR_PACK() is a macro. - -The last entry in the array is {0,0}. - -ERR_get_next_error_library() can be used to assign library numbers -to user libraries at runtime. - -=head1 RETURN VALUE - -ERR_load_strings() returns no value. ERR_PACK() return the error code. -ERR_get_next_error_library() returns a new library number. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> - -=head1 HISTORY - -ERR_load_error_strings() and ERR_PACK() are available in all versions -of SSLeay and OpenSSL. ERR_get_next_error_library() was added in -SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_print_errors.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_print_errors.pod deleted file mode 100644 index b100a5fa2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_print_errors.pod +++ /dev/null @@ -1,51 +0,0 @@ -=pod - -=head1 NAME - -ERR_print_errors, ERR_print_errors_fp - print error messages - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_print_errors(BIO *bp); - void ERR_print_errors_fp(FILE *fp); - -=head1 DESCRIPTION - -ERR_print_errors() is a convenience function that prints the error -strings for all errors that OpenSSL has recorded to B<bp>, thus -emptying the error queue. - -ERR_print_errors_fp() is the same, except that the output goes to a -B<FILE>. - - -The error strings will have the following format: - - [pid]:error:[error code]:[library name]:[function name]:[reason string]:[file name]:[line]:[optional text message] - -I<error code> is an 8 digit hexadecimal number. I<library name>, -I<function name> and I<reason string> are ASCII text, as is I<optional -text message> if one was set for the respective error code. - -If there is no text string registered for the given error code, -the error string will contain the numeric code. - -=head1 RETURN VALUES - -ERR_print_errors() and ERR_print_errors_fp() return no values. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, -L<ERR_get_error(3)|ERR_get_error(3)>, -L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, -L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> - -=head1 HISTORY - -ERR_print_errors() and ERR_print_errors_fp() -are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_put_error.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_put_error.pod deleted file mode 100644 index acd241fbe..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_put_error.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -ERR_put_error, ERR_add_error_data - record an error - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_put_error(int lib, int func, int reason, const char *file, - int line); - - void ERR_add_error_data(int num, ...); - -=head1 DESCRIPTION - -ERR_put_error() adds an error code to the thread's error queue. It -signals that the error of reason code B<reason> occurred in function -B<func> of library B<lib>, in line number B<line> of B<file>. -This function is usually called by a macro. - -ERR_add_error_data() associates the concatenation of its B<num> string -arguments with the error code added last. - -L<ERR_load_strings(3)|ERR_load_strings(3)> can be used to register -error strings so that the application can a generate human-readable -error messages for the error code. - -=head1 RETURN VALUES - -ERR_put_error() and ERR_add_error_data() return -no values. - -=head1 SEE ALSO - -L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> - -=head1 HISTORY - -ERR_put_error() is available in all versions of SSLeay and OpenSSL. -ERR_add_error_data() was added in SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_remove_state.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_remove_state.pod deleted file mode 100644 index 72925fb9f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_remove_state.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -ERR_remove_state - free a thread's error queue - -=head1 SYNOPSIS - - #include <openssl/err.h> - - void ERR_remove_state(unsigned long pid); - -=head1 DESCRIPTION - -ERR_remove_state() frees the error queue associated with thread B<pid>. -If B<pid> == 0, the current thread will have its error queue removed. - -Since error queue data structures are allocated automatically for new -threads, they must be freed when threads are terminated in order to -avoid memory leaks. - -=head1 RETURN VALUE - -ERR_remove_state() returns no value. - -=head1 SEE ALSO - -L<err(3)|err(3)> - -=head1 HISTORY - -ERR_remove_state() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ERR_set_mark.pod b/sys/src/ape/lib/openssl/doc/crypto/ERR_set_mark.pod deleted file mode 100644 index d3ca4f2e7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ERR_set_mark.pod +++ /dev/null @@ -1,38 +0,0 @@ -=pod - -=head1 NAME - -ERR_set_mark, ERR_pop_to_mark - set marks and pop errors until mark - -=head1 SYNOPSIS - - #include <openssl/err.h> - - int ERR_set_mark(void); - - int ERR_pop_to_mark(void); - -=head1 DESCRIPTION - -ERR_set_mark() sets a mark on the current topmost error record if there -is one. - -ERR_pop_to_mark() will pop the top of the error stack until a mark is found. -The mark is then removed. If there is no mark, the whole stack is removed. - -=head1 RETURN VALUES - -ERR_set_mark() returns 0 if the error stack is empty, otherwise 1. - -ERR_pop_to_mark() returns 0 if there was no mark in the error stack, which -implies that the stack became empty, otherwise 1. - -=head1 SEE ALSO - -L<err(3)|err(3)> - -=head1 HISTORY - -ERR_set_mark() and ERR_pop_to_mark() were added in OpenSSL 0.9.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_BytesToKey.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_BytesToKey.pod deleted file mode 100644 index d375c46e0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_BytesToKey.pod +++ /dev/null @@ -1,67 +0,0 @@ -=pod - -=head1 NAME - -EVP_BytesToKey - password based encryption routine - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, - const unsigned char *salt, - const unsigned char *data, int datal, int count, - unsigned char *key,unsigned char *iv); - -=head1 DESCRIPTION - -EVP_BytesToKey() derives a key and IV from various parameters. B<type> is -the cipher to derive the key and IV for. B<md> is the message digest to use. -The B<salt> paramter is used as a salt in the derivation: it should point to -an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing -B<datal> bytes which is used to derive the keying data. B<count> is the -iteration count to use. The derived key and IV will be written to B<key> -and B<iv> respectively. - -=head1 NOTES - -A typical application of this function is to derive keying material for an -encryption algorithm from a password in the B<data> parameter. - -Increasing the B<count> parameter slows down the algorithm which makes it -harder for an attacker to peform a brute force attack using a large number -of candidate passwords. - -If the total key and IV length is less than the digest length and -B<MD5> is used then the derivation algorithm is compatible with PKCS#5 v1.5 -otherwise a non standard extension is used to derive the extra data. - -Newer applications should use more standard algorithms such as PKCS#5 -v2.0 for key derivation. - -=head1 KEY DERIVATION ALGORITHM - -The key and IV is derived by concatenating D_1, D_2, etc until -enough data is available for the key and IV. D_i is defined as: - - D_i = HASH^count(D_(i-1) || data || salt) - -where || denotes concatentaion, D_0 is empty, HASH is the digest -algorithm in use, HASH^1(data) is simply HASH(data), HASH^2(data) -is HASH(HASH(data)) and so on. - -The initial bytes are used for the key and the subsequent bytes for -the IV. - -=head1 RETURN VALUES - -EVP_BytesToKey() returns the size of the derived key in bytes. - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> - -=head1 HISTORY - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_DigestInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_DigestInit.pod deleted file mode 100644 index 130cd7f60..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_DigestInit.pod +++ /dev/null @@ -1,256 +0,0 @@ -=pod - -=head1 NAME - -EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, -EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, -EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, -EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, -EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, -EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj - -EVP digest routines - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - void EVP_MD_CTX_init(EVP_MD_CTX *ctx); - EVP_MD_CTX *EVP_MD_CTX_create(void); - - int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); - int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); - int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); - - int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); - void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); - - int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); - - int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); - int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); - - int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); - - #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ - - - #define EVP_MD_type(e) ((e)->type) - #define EVP_MD_pkey_type(e) ((e)->pkey_type) - #define EVP_MD_size(e) ((e)->md_size) - #define EVP_MD_block_size(e) ((e)->block_size) - - #define EVP_MD_CTX_md(e) (e)->digest) - #define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest) - #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) - #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) - - const EVP_MD *EVP_md_null(void); - const EVP_MD *EVP_md2(void); - const EVP_MD *EVP_md5(void); - const EVP_MD *EVP_sha(void); - const EVP_MD *EVP_sha1(void); - const EVP_MD *EVP_dss(void); - const EVP_MD *EVP_dss1(void); - const EVP_MD *EVP_mdc2(void); - const EVP_MD *EVP_ripemd160(void); - - const EVP_MD *EVP_get_digestbyname(const char *name); - #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) - #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) - -=head1 DESCRIPTION - -The EVP digest routines are a high level interface to message digests. - -EVP_MD_CTX_init() initializes digest contet B<ctx>. - -EVP_MD_CTX_create() allocates, initializes and returns a digest contet. - -EVP_DigestInit_ex() sets up digest context B<ctx> to use a digest -B<type> from ENGINE B<impl>. B<ctx> must be initialized before calling this -function. B<type> will typically be supplied by a functionsuch as EVP_sha1(). -If B<impl> is NULL then the default implementation of digest B<type> is used. - -EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the -digest context B<ctx>. This function can be called several times on the -same B<ctx> to hash additional data. - -EVP_DigestFinal_ex() retrieves the digest value from B<ctx> and places -it in B<md>. If the B<s> parameter is not NULL then the number of -bytes of data written (i.e. the length of the digest) will be written -to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. -After calling EVP_DigestFinal_ex() no additional calls to EVP_DigestUpdate() -can be made, but EVP_DigestInit_ex() can be called to initialize a new -digest operation. - -EVP_MD_CTX_cleanup() cleans up digest context B<ctx>, it should be called -after a digest context is no longer needed. - -EVP_MD_CTX_destroy() cleans up digest context B<ctx> and frees up the -space allocated to it, it should be called only on a context created -using EVP_MD_CTX_create(). - -EVP_MD_CTX_copy_ex() can be used to copy the message digest state from -B<in> to B<out>. This is useful if large amounts of data are to be -hashed which only differ in the last few bytes. B<out> must be initialized -before calling this function. - -EVP_DigestInit() behaves in the same way as EVP_DigestInit_ex() except -the passed context B<ctx> does not have to be initialized, and it always -uses the default digest implementation. - -EVP_DigestFinal() is similar to EVP_DigestFinal_ex() except the digest -contet B<ctx> is automatically cleaned up. - -EVP_MD_CTX_copy() is similar to EVP_MD_CTX_copy_ex() except the destination -B<out> does not have to be initialized. - -EVP_MD_size() and EVP_MD_CTX_size() return the size of the message digest -when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure, i.e. the size of the -hash. - -EVP_MD_block_size() and EVP_MD_CTX_block_size() return the block size of the -message digest when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure. - -EVP_MD_type() and EVP_MD_CTX_type() return the NID of the OBJECT IDENTIFIER -representing the given message digest when passed an B<EVP_MD> structure. -For example EVP_MD_type(EVP_sha1()) returns B<NID_sha1>. This function is -normally used when setting ASN1 OIDs. - -EVP_MD_CTX_md() returns the B<EVP_MD> structure corresponding to the passed -B<EVP_MD_CTX>. - -EVP_MD_pkey_type() returns the NID of the public key signing algorithm associated -with this digest. For example EVP_sha1() is associated with RSA so this will -return B<NID_sha1WithRSAEncryption>. This "link" between digests and signature -algorithms may not be retained in future versions of OpenSSL. - -EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_mdc2() and EVP_ripemd160() -return B<EVP_MD> structures for the MD2, MD5, SHA, SHA1, MDC2 and RIPEMD160 digest -algorithms respectively. The associated signature algorithm is RSA in each case. - -EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest -algorithms but using DSS (DSA) for the signature algorithm. - -EVP_md_null() is a "null" message digest that does nothing: i.e. the hash it -returns is of zero length. - -EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() -return an B<EVP_MD> structure when passed a digest name, a digest NID or -an ASN1_OBJECT structure respectively. The digest table must be initialized -using, for example, OpenSSL_add_all_digests() for these functions to work. - -=head1 RETURN VALUES - -EVP_DigestInit_ex(), EVP_DigestUpdate() and EVP_DigestFinal_ex() return 1 for -success and 0 for failure. - -EVP_MD_CTX_copy_ex() returns 1 if successful or 0 for failure. - -EVP_MD_type(), EVP_MD_pkey_type() and EVP_MD_type() return the NID of the -corresponding OBJECT IDENTIFIER or NID_undef if none exists. - -EVP_MD_size(), EVP_MD_block_size(), EVP_MD_CTX_size(e), EVP_MD_size(), -EVP_MD_CTX_block_size() and EVP_MD_block_size() return the digest or block -size in bytes. - -EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_dss(), -EVP_dss1(), EVP_mdc2() and EVP_ripemd160() return pointers to the -corresponding EVP_MD structures. - -EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() -return either an B<EVP_MD> structure or NULL if an error occurs. - -=head1 NOTES - -The B<EVP> interface to message digests should almost always be used in -preference to the low level interfaces. This is because the code then becomes -transparent to the digest used and much more flexible. - -SHA1 is the digest of choice for new applications. The other digest algorithms -are still in common use. - -For most applications the B<impl> parameter to EVP_DigestInit_ex() will be -set to NULL to use the default digest implementation. - -The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are -obsolete but are retained to maintain compatibility with existing code. New -applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and -EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context -instead of initializing and cleaning it up on each call and allow non default -implementations of digests to be specified. - -In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use -memory leaks will occur. - -=head1 EXAMPLE - -This example digests the data "Test Message\n" and "Hello World\n", using the -digest name passed on the command line. - - #include <stdio.h> - #include <openssl/evp.h> - - main(int argc, char *argv[]) - { - EVP_MD_CTX mdctx; - const EVP_MD *md; - char mess1[] = "Test Message\n"; - char mess2[] = "Hello World\n"; - unsigned char md_value[EVP_MAX_MD_SIZE]; - int md_len, i; - - OpenSSL_add_all_digests(); - - if(!argv[1]) { - printf("Usage: mdtest digestname\n"); - exit(1); - } - - md = EVP_get_digestbyname(argv[1]); - - if(!md) { - printf("Unknown message digest %s\n", argv[1]); - exit(1); - } - - EVP_MD_CTX_init(&mdctx); - EVP_DigestInit_ex(&mdctx, md, NULL); - EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); - EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); - EVP_DigestFinal_ex(&mdctx, md_value, &md_len); - EVP_MD_CTX_cleanup(&mdctx); - - printf("Digest is: "); - for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); - printf("\n"); - } - -=head1 BUGS - -The link between digests and signing algorithms results in a situation where -EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS -even though they are identical digests. - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, -L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, -L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> - -=head1 HISTORY - -EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are -available in all versions of SSLeay and OpenSSL. - -EVP_MD_CTX_init(), EVP_MD_CTX_create(), EVP_MD_CTX_copy_ex(), -EVP_MD_CTX_cleanup(), EVP_MD_CTX_destroy(), EVP_DigestInit_ex() -and EVP_DigestFinal_ex() were added in OpenSSL 0.9.7. - -EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), -EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were -changed to return truely const EVP_MD * in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_EncryptInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_EncryptInit.pod deleted file mode 100644 index 8271d3dfc..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_EncryptInit.pod +++ /dev/null @@ -1,511 +0,0 @@ -=pod - -=head1 NAME - -EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, -EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, -EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherUpdate, -EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, -EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX_cleanup, EVP_EncryptInit, -EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, -EVP_CipherInit, EVP_CipherFinal, EVP_get_cipherbyname, -EVP_get_cipherbynid, EVP_get_cipherbyobj, EVP_CIPHER_nid, -EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, -EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, -EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, -EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_get_app_data, -EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_flags, -EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, -EVP_CIPHER_CTX_set_padding - EVP cipher routines - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); - - int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - ENGINE *impl, unsigned char *key, unsigned char *iv); - int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); - int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - - int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - ENGINE *impl, unsigned char *key, unsigned char *iv); - int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); - int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - - int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - ENGINE *impl, unsigned char *key, unsigned char *iv, int enc); - int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); - int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - - int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char *key, unsigned char *iv); - int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - - int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char *key, unsigned char *iv); - int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - - int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char *key, unsigned char *iv, int enc); - int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - - int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding); - int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); - int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); - int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); - - const EVP_CIPHER *EVP_get_cipherbyname(const char *name); - #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) - #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) - - #define EVP_CIPHER_nid(e) ((e)->nid) - #define EVP_CIPHER_block_size(e) ((e)->block_size) - #define EVP_CIPHER_key_length(e) ((e)->key_len) - #define EVP_CIPHER_iv_length(e) ((e)->iv_len) - #define EVP_CIPHER_flags(e) ((e)->flags) - #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) - int EVP_CIPHER_type(const EVP_CIPHER *ctx); - - #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) - #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) - #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) - #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) - #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) - #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) - #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) - #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) - #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) - #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) - - int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -=head1 DESCRIPTION - -The EVP cipher routines are a high level interface to certain -symmetric ciphers. - -EVP_CIPHER_CTX_init() initializes cipher contex B<ctx>. - -EVP_EncryptInit_ex() sets up cipher context B<ctx> for encryption -with cipher B<type> from ENGINE B<impl>. B<ctx> must be initialized -before calling this function. B<type> is normally supplied -by a function such as EVP_des_cbc(). If B<impl> is NULL then the -default implementation is used. B<key> is the symmetric key to use -and B<iv> is the IV to use (if necessary), the actual number of bytes -used for the key and IV depends on the cipher. It is possible to set -all parameters to NULL except B<type> in an initial call and supply -the remaining parameters in subsequent calls, all of which have B<type> -set to NULL. This is done when the default cipher parameters are not -appropriate. - -EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and -writes the encrypted version to B<out>. This function can be called -multiple times to encrypt successive blocks of data. The amount -of data written depends on the block alignment of the encrypted data: -as a result the amount of data written may be anything from zero bytes -to (inl + cipher_block_size - 1) so B<outl> should contain sufficient -room. The actual number of bytes written is placed in B<outl>. - -If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts -the "final" data, that is any data that remains in a partial block. -It uses L<standard block padding|/NOTES> (aka PKCS padding). The encrypted -final data is written to B<out> which should have sufficient space for -one cipher block. The number of bytes written is placed in B<outl>. After -this function is called the encryption operation is finished and no further -calls to EVP_EncryptUpdate() should be made. - -If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more -data and it will return an error if any data remains in a partial block: -that is if the total data length is not a multiple of the block size. - -EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex() are the -corresponding decryption operations. EVP_DecryptFinal() will return an -error code if padding is enabled and the final block is not correctly -formatted. The parameters and restrictions are identical to the encryption -operations except that if padding is enabled the decrypted data buffer B<out> -passed to EVP_DecryptUpdate() should have sufficient room for -(B<inl> + cipher_block_size) bytes unless the cipher block size is 1 in -which case B<inl> bytes is sufficient. - -EVP_CipherInit_ex(), EVP_CipherUpdate() and EVP_CipherFinal_ex() are -functions that can be used for decryption or encryption. The operation -performed depends on the value of the B<enc> parameter. It should be set -to 1 for encryption, 0 for decryption and -1 to leave the value unchanged -(the actual value of 'enc' being supplied in a previous call). - -EVP_CIPHER_CTX_cleanup() clears all information from a cipher context -and free up any allocated memory associate with it. It should be called -after all operations using a cipher are complete so sensitive information -does not remain in memory. - -EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a -similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and -EVP_CipherInit_ex() except the B<ctx> paramter does not need to be -initialized and they always use the default cipher implementation. - -EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a -similar way to EVP_EncryptFinal_ex(), EVP_DecryptFinal_ex() and -EVP_CipherFinal_ex() except B<ctx> is automatically cleaned up -after the call. - -EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() -return an EVP_CIPHER structure when passed a cipher name, a NID or an -ASN1_OBJECT structure. - -EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return the NID of a cipher when -passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> structure. The actual NID -value is an internal value which may not have a corresponding OBJECT -IDENTIFIER. - -EVP_CIPHER_CTX_set_padding() enables or disables padding. By default -encryption operations are padded using standard block padding and the -padding is checked and removed when decrypting. If the B<pad> parameter -is zero then no padding is performed, the total amount of data encrypted -or decrypted must then be a multiple of the block size or an error will -occur. - -EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key -length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> -structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length -for all ciphers. Note: although EVP_CIPHER_key_length() is fixed for a -given cipher, the value of EVP_CIPHER_CTX_key_length() may be different -for variable key length ciphers. - -EVP_CIPHER_CTX_set_key_length() sets the key length of the cipher ctx. -If the cipher is a fixed length cipher then attempting to set the key -length to any value other than the fixed value is an error. - -EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV -length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>. -It will return zero if the cipher does not use an IV. The constant -B<EVP_MAX_IV_LENGTH> is the maximum IV length for all ciphers. - -EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block -size of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> -structure. The constant B<EVP_MAX_IV_LENGTH> is also the maximum block -length for all ciphers. - -EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the type of the passed -cipher or context. This "type" is the actual NID of the cipher OBJECT -IDENTIFIER as such it ignores the cipher parameters and 40 bit RC2 and -128 bit RC2 have the same NID. If the cipher does not have an object -identifier or does not have ASN1 support this function will return -B<NID_undef>. - -EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed -an B<EVP_CIPHER_CTX> structure. - -EVP_CIPHER_mode() and EVP_CIPHER_CTX_mode() return the block cipher mode: -EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE or -EVP_CIPH_OFB_MODE. If the cipher is a stream cipher then -EVP_CIPH_STREAM_CIPHER is returned. - -EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based -on the passed cipher. This will typically include any parameters and an -IV. The cipher IV (if any) must be set when this call is made. This call -should be made before the cipher is actually "used" (before any -EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function -may fail if the cipher does not have any ASN1 support. - -EVP_CIPHER_asn1_to_param() sets the cipher parameters based on an ASN1 -AlgorithmIdentifier "parameter". The precise effect depends on the cipher -In the case of RC2, for example, it will set the IV and effective key length. -This function should be called after the base cipher type is set but before -the key is set. For example EVP_CipherInit() will be called with the IV and -key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally -EVP_CipherInit() again with all parameters except the key set to NULL. It is -possible for this function to fail if the cipher does not have any ASN1 support -or the parameters cannot be set (for example the RC2 effective key length -is not supported. - -EVP_CIPHER_CTX_ctrl() allows various cipher specific parameters to be determined -and set. Currently only the RC2 effective key length and the number of rounds of -RC5 can be set. - -=head1 RETURN VALUES - -EVP_EncryptInit_ex(), EVP_EncryptUpdate() and EVP_EncryptFinal_ex() -return 1 for success and 0 for failure. - -EVP_DecryptInit_ex() and EVP_DecryptUpdate() return 1 for success and 0 for failure. -EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success. - -EVP_CipherInit_ex() and EVP_CipherUpdate() return 1 for success and 0 for failure. -EVP_CipherFinal_ex() returns 0 for a decryption failure or 1 for success. - -EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. - -EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() -return an B<EVP_CIPHER> structure or NULL on error. - -EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return a NID. - -EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block -size. - -EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key -length. - -EVP_CIPHER_CTX_set_padding() always returns 1. - -EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV -length or zero if the cipher does not use an IV. - -EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the NID of the cipher's -OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER. - -EVP_CIPHER_CTX_cipher() returns an B<EVP_CIPHER> structure. - -EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for -success or zero for failure. - -=head1 CIPHER LISTING - -All algorithms have a fixed key length unless otherwise stated. - -=over 4 - -=item EVP_enc_null() - -Null cipher: does nothing. - -=item EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void) - -DES in CBC, ECB, CFB and OFB modes respectively. - -=item EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void) - -Two key triple DES in CBC, ECB, CFB and OFB modes respectively. - -=item EVP_des_ede3_cbc(void), EVP_des_ede3(), EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void) - -Three key triple DES in CBC, ECB, CFB and OFB modes respectively. - -=item EVP_desx_cbc(void) - -DESX algorithm in CBC mode. - -=item EVP_rc4(void) - -RC4 stream cipher. This is a variable key length cipher with default key length 128 bits. - -=item EVP_rc4_40(void) - -RC4 stream cipher with 40 bit key length. This is obsolete and new code should use EVP_rc4() -and the EVP_CIPHER_CTX_set_key_length() function. - -=item EVP_idea_cbc() EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void) - -IDEA encryption algorithm in CBC, ECB, CFB and OFB modes respectively. - -=item EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void) - -RC2 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key -length cipher with an additional parameter called "effective key bits" or "effective key length". -By default both are set to 128 bits. - -=item EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void) - -RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits. -These are obsolete and new code should use EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and -EVP_CIPHER_CTX_ctrl() to set the key length and effective key length. - -=item EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void); - -Blowfish encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key -length cipher. - -=item EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void) - -CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key -length cipher. - -=item EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void) - -RC5 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length -cipher with an additional "number of rounds" parameter. By default the key length is set to 128 -bits and 12 rounds. - -=back - -=head1 NOTES - -Where possible the B<EVP> interface to symmetric ciphers should be used in -preference to the low level interfaces. This is because the code then becomes -transparent to the cipher used and much more flexible. - -PKCS padding works by adding B<n> padding bytes of value B<n> to make the total -length of the encrypted data a multiple of the block size. Padding is always -added so if the data is already a multiple of the block size B<n> will equal -the block size. For example if the block size is 8 and 11 bytes are to be -encrypted then 5 padding bytes of value 5 will be added. - -When decrypting the final block is checked to see if it has the correct form. - -Although the decryption operation can produce an error if padding is enabled, -it is not a strong test that the input data or key is correct. A random block -has better than 1 in 256 chance of being of the correct format and problems with -the input data earlier on will not produce a final decrypt error. - -If padding is disabled then the decryption operation will always succeed if -the total amount of data decrypted is a multiple of the block size. - -The functions EVP_EncryptInit(), EVP_EncryptFinal(), EVP_DecryptInit(), -EVP_CipherInit() and EVP_CipherFinal() are obsolete but are retained for -compatibility with existing code. New code should use EVP_EncryptInit_ex(), -EVP_EncryptFinal_ex(), EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), -EVP_CipherInit_ex() and EVP_CipherFinal_ex() because they can reuse an -existing context without allocating and freeing it up on each call. - -=head1 BUGS - -For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is -a limitation of the current RC5 code rather than the EVP interface. - -EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with -default key lengths. If custom ciphers exceed these values the results are -unpredictable. This is because it has become standard practice to define a -generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes. - -The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested -for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode. - -=head1 EXAMPLES - -Get the number of rounds used in RC5: - - int nrounds; - EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &nrounds); - -Get the RC2 effective key length: - - int key_bits; - EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &key_bits); - -Set the number of rounds used in RC5: - - int nrounds; - EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, nrounds, NULL); - -Set the effective key length used in RC2: - - int key_bits; - EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); - -Encrypt a string using blowfish: - - int do_crypt(char *outfile) - { - unsigned char outbuf[1024]; - int outlen, tmplen; - /* Bogus key and IV: we'd normally set these from - * another source. - */ - unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - unsigned char iv[] = {1,2,3,4,5,6,7,8}; - char intext[] = "Some Crypto Text"; - EVP_CIPHER_CTX ctx; - FILE *out; - EVP_CIPHER_CTX_init(&ctx); - EVP_EncryptInit_ex(&ctx, EVP_bf_cbc(), NULL, key, iv); - - if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) - { - /* Error */ - return 0; - } - /* Buffer passed to EVP_EncryptFinal() must be after data just - * encrypted to avoid overwriting it. - */ - if(!EVP_EncryptFinal_ex(&ctx, outbuf + outlen, &tmplen)) - { - /* Error */ - return 0; - } - outlen += tmplen; - EVP_CIPHER_CTX_cleanup(&ctx); - /* Need binary mode for fopen because encrypted data is - * binary data. Also cannot use strlen() on it because - * it wont be null terminated and may contain embedded - * nulls. - */ - out = fopen(outfile, "wb"); - fwrite(outbuf, 1, outlen, out); - fclose(out); - return 1; - } - -The ciphertext from the above example can be decrypted using the B<openssl> -utility with the command line: - - S<openssl bf -in cipher.bin -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 -d> - -General encryption, decryption function example using FILE I/O and RC2 with an -80 bit key: - - int do_crypt(FILE *in, FILE *out, int do_encrypt) - { - /* Allow enough space in output buffer for additional block */ - inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH]; - int inlen, outlen; - /* Bogus key and IV: we'd normally set these from - * another source. - */ - unsigned char key[] = "0123456789"; - unsigned char iv[] = "12345678"; - /* Don't set key or IV because we will modify the parameters */ - EVP_CIPHER_CTX_init(&ctx); - EVP_CipherInit_ex(&ctx, EVP_rc2(), NULL, NULL, NULL, do_encrypt); - EVP_CIPHER_CTX_set_key_length(&ctx, 10); - /* We finished modifying parameters so now we can set key and IV */ - EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt); - - for(;;) - { - inlen = fread(inbuf, 1, 1024, in); - if(inlen <= 0) break; - if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) - { - /* Error */ - EVP_CIPHER_CTX_cleanup(&ctx); - return 0; - } - fwrite(outbuf, 1, outlen, out); - } - if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) - { - /* Error */ - EVP_CIPHER_CTX_cleanup(&ctx); - return 0; - } - fwrite(outbuf, 1, outlen, out); - - EVP_CIPHER_CTX_cleanup(&ctx); - return 1; - } - - -=head1 SEE ALSO - -L<evp(3)|evp(3)> - -=head1 HISTORY - -EVP_CIPHER_CTX_init(), EVP_EncryptInit_ex(), EVP_EncryptFinal_ex(), -EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex(), -EVP_CipherFinal_ex() and EVP_CIPHER_CTX_set_padding() appeared in -OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_OpenInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_OpenInit.pod deleted file mode 100644 index 2e710da94..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_OpenInit.pod +++ /dev/null @@ -1,63 +0,0 @@ -=pod - -=head1 NAME - -EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, - int ekl,unsigned char *iv,EVP_PKEY *priv); - int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); - int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -=head1 DESCRIPTION - -The EVP envelope routines are a high level interface to envelope -decryption. They decrypt a public key encrypted symmetric key and -then decrypt data using it. - -EVP_OpenInit() initializes a cipher context B<ctx> for decryption -with cipher B<type>. It decrypts the encrypted symmetric key of length -B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. -The IV is supplied in the B<iv> parameter. - -EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties -as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as -documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual -page. - -=head1 NOTES - -It is possible to call EVP_OpenInit() twice in the same way as -EVP_DecryptInit(). The first call should have B<priv> set to NULL -and (after setting any cipher parameters) it should be called again -with B<type> set to NULL. - -If the cipher passed in the B<type> parameter is a variable length -cipher then the key length will be set to the value of the recovered -key length. If the cipher is a fixed length cipher then the recovered -key length must match the fixed cipher length. - -=head1 RETURN VALUES - -EVP_OpenInit() returns 0 on error or a non zero integer (actually the -recovered secret key size) if successful. - -EVP_OpenUpdate() returns 1 for success or 0 for failure. - -EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success. - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, -L<EVP_SealInit(3)|EVP_SealInit(3)> - -=head1 HISTORY - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_new.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_new.pod deleted file mode 100644 index 10687e458..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_new.pod +++ /dev/null @@ -1,47 +0,0 @@ -=pod - -=head1 NAME - -EVP_PKEY_new, EVP_PKEY_free - private key allocation functions. - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - EVP_PKEY *EVP_PKEY_new(void); - void EVP_PKEY_free(EVP_PKEY *key); - - -=head1 DESCRIPTION - -The EVP_PKEY_new() function allocates an empty B<EVP_PKEY> -structure which is used by OpenSSL to store private keys. - -EVP_PKEY_free() frees up the private key B<key>. - -=head1 NOTES - -The B<EVP_PKEY> structure is used by various OpenSSL functions -which require a general private key without reference to any -particular algorithm. - -The structure returned by EVP_PKEY_new() is empty. To add a -private key to this empty structure the functions described in -L<EVP_PKEY_set1_RSA(3)|EVP_PKEY_set1_RSA(3)> should be used. - -=head1 RETURN VALUES - -EVP_PKEY_new() returns either the newly allocated B<EVP_PKEY> -structure of B<NULL> if an error occurred. - -EVP_PKEY_free() does not return a value. - -=head1 SEE ALSO - -L<EVP_PKEY_set1_RSA(3)|EVP_PKEY_set1_RSA(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_set1_RSA.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_set1_RSA.pod deleted file mode 100644 index 2db692e27..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_PKEY_set1_RSA.pod +++ /dev/null @@ -1,80 +0,0 @@ -=pod - -=head1 NAME - -EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, -EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, -EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, -EVP_PKEY_type - EVP_PKEY assignment functions. - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key); - int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key); - int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key); - int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key); - - RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); - DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); - DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey); - EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); - - int EVP_PKEY_assign_RSA(EVP_PKEY *pkey,RSA *key); - int EVP_PKEY_assign_DSA(EVP_PKEY *pkey,DSA *key); - int EVP_PKEY_assign_DH(EVP_PKEY *pkey,DH *key); - int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey,EC_KEY *key); - - int EVP_PKEY_type(int type); - -=head1 DESCRIPTION - -EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and -EVP_PKEY_set1_EC_KEY() set the key referenced by B<pkey> to B<key>. - -EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and -EVP_PKEY_get1_EC_KEY() return the referenced key in B<pkey> or -B<NULL> if the key is not of the correct type. - -EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH() -and EVP_PKEY_assign_EC_KEY() also set the referenced key to B<key> -however these use the supplied B<key> internally and so B<key> -will be freed when the parent B<pkey> is freed. - -EVP_PKEY_type() returns the type of key corresponding to the value -B<type>. The type of a key can be obtained with -EVP_PKEY_type(pkey->type). The return value will be EVP_PKEY_RSA, -EVP_PKEY_DSA, EVP_PKEY_DH or EVP_PKEY_EC for the corresponding -key types or NID_undef if the key type is unassigned. - -=head1 NOTES - -In accordance with the OpenSSL naming convention the key obtained -from or assigned to the B<pkey> using the B<1> functions must be -freed as well as B<pkey>. - -EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH() -EVP_PKEY_assign_EC_KEY() are implemented as macros. - -=head1 RETURN VALUES - -EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and -EVP_PKEY_set1_EC_KEY() return 1 for success or 0 for failure. - -EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and -EVP_PKEY_get1_EC_KEY() return the referenced key or B<NULL> if -an error occurred. - -EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH() -and EVP_PKEY_assign_EC_KEY() return 1 for success and 0 for failure. - -=head1 SEE ALSO - -L<EVP_PKEY_new(3)|EVP_PKEY_new(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_SealInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_SealInit.pod deleted file mode 100644 index 7d793e19e..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_SealInit.pod +++ /dev/null @@ -1,85 +0,0 @@ -=pod - -=head1 NAME - -EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char **ek, int *ekl, unsigned char *iv, - EVP_PKEY **pubk, int npubk); - int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); - int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -=head1 DESCRIPTION - -The EVP envelope routines are a high level interface to envelope -encryption. They generate a random key and IV (if required) then -"envelope" it by using public key encryption. Data can then be -encrypted using this key. - -EVP_SealInit() initializes a cipher context B<ctx> for encryption -with cipher B<type> using a random secret key and IV. B<type> is normally -supplied by a function such as EVP_des_cbc(). The secret key is encrypted -using one or more public keys, this allows the same encrypted data to be -decrypted using any of the corresponding private keys. B<ek> is an array of -buffers where the public key encrypted secret key will be written, each buffer -must contain enough room for the corresponding encrypted key: that is -B<ek[i]> must have room for B<EVP_PKEY_size(pubk[i])> bytes. The actual -size of each encrypted secret key is written to the array B<ekl>. B<pubk> is -an array of B<npubk> public keys. - -The B<iv> parameter is a buffer where the generated IV is written to. It must -contain enough room for the corresponding cipher's IV, as determined by (for -example) EVP_CIPHER_iv_length(type). - -If the cipher does not require an IV then the B<iv> parameter is ignored -and can be B<NULL>. - -EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties -as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as -documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual -page. - -=head1 RETURN VALUES - -EVP_SealInit() returns 0 on error or B<npubk> if successful. - -EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for -failure. - -=head1 NOTES - -Because a random secret key is generated the random number generator -must be seeded before calling EVP_SealInit(). - -The public key must be RSA because it is the only OpenSSL public key -algorithm that supports key transport. - -Envelope encryption is the usual method of using public key encryption -on large amounts of data, this is because public key encryption is slow -but symmetric encryption is fast. So symmetric encryption is used for -bulk encryption and the small random symmetric key used is transferred -using public key encryption. - -It is possible to call EVP_SealInit() twice in the same way as -EVP_EncryptInit(). The first call should have B<npubk> set to 0 -and (after setting any cipher parameters) it should be called again -with B<type> set to NULL. - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, -L<EVP_OpenInit(3)|EVP_OpenInit(3)> - -=head1 HISTORY - -EVP_SealFinal() did not return a value before OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_SignInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_SignInit.pod deleted file mode 100644 index b6e62ce7f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_SignInit.pod +++ /dev/null @@ -1,95 +0,0 @@ -=pod - -=head1 NAME - -EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); - int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); - int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); - - void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); - - int EVP_PKEY_size(EVP_PKEY *pkey); - -=head1 DESCRIPTION - -The EVP signature routines are a high level interface to digital -signatures. - -EVP_SignInit_ex() sets up signing context B<ctx> to use digest -B<type> from ENGINE B<impl>. B<ctx> must be initialized with -EVP_MD_CTX_init() before calling this function. - -EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the -signature context B<ctx>. This function can be called several times on the -same B<ctx> to include additional data. - -EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> and -places the signature in B<sig>. The number of bytes of data written (i.e. the -length of the signature) will be written to the integer at B<s>, at most -EVP_PKEY_size(pkey) bytes will be written. - -EVP_SignInit() initializes a signing context B<ctx> to use the default -implementation of digest B<type>. - -EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual -signature returned by EVP_SignFinal() may be smaller. - -=head1 RETURN VALUES - -EVP_SignInit_ex(), EVP_SignUpdate() and EVP_SignFinal() return 1 -for success and 0 for failure. - -EVP_PKEY_size() returns the maximum size of a signature in bytes. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 NOTES - -The B<EVP> interface to digital signatures should almost always be used in -preference to the low level interfaces. This is because the code then becomes -transparent to the algorithm used and much more flexible. - -Due to the link between message digests and public key algorithms the correct -digest algorithm must be used with the correct public key type. A list of -algorithms and associated public key algorithms appears in -L<EVP_DigestInit(3)|EVP_DigestInit(3)>. - -When signing with DSA private keys the random number generator must be seeded -or the operation will fail. The random number generator does not need to be -seeded for RSA signatures. - -The call to EVP_SignFinal() internally finalizes a copy of the digest context. -This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called -later to digest and sign additional data. - -Since only a copy of the digest context is ever finalized the context must -be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak -will occur. - -=head1 BUGS - -Older versions of this documentation wrongly stated that calls to -EVP_SignUpdate() could not be made after calling EVP_SignFinal(). - -=head1 SEE ALSO - -L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, -L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, -L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, -L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, -L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> - -=head1 HISTORY - -EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are -available in all versions of SSLeay and OpenSSL. - -EVP_SignInit_ex() was added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/EVP_VerifyInit.pod b/sys/src/ape/lib/openssl/doc/crypto/EVP_VerifyInit.pod deleted file mode 100644 index b6afaedee..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/EVP_VerifyInit.pod +++ /dev/null @@ -1,86 +0,0 @@ -=pod - -=head1 NAME - -EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification functions - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); - int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); - int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey); - - int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); - -=head1 DESCRIPTION - -The EVP signature verification routines are a high level interface to digital -signatures. - -EVP_VerifyInit_ex() sets up verification context B<ctx> to use digest -B<type> from ENGINE B<impl>. B<ctx> must be initialized by calling -EVP_MD_CTX_init() before calling this function. - -EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the -verification context B<ctx>. This function can be called several times on the -same B<ctx> to include additional data. - -EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> -and against the B<siglen> bytes at B<sigbuf>. - -EVP_VerifyInit() initializes verification context B<ctx> to use the default -implementation of digest B<type>. - -=head1 RETURN VALUES - -EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for -failure. - -EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some -other error occurred. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 NOTES - -The B<EVP> interface to digital signatures should almost always be used in -preference to the low level interfaces. This is because the code then becomes -transparent to the algorithm used and much more flexible. - -Due to the link between message digests and public key algorithms the correct -digest algorithm must be used with the correct public key type. A list of -algorithms and associated public key algorithms appears in -L<EVP_DigestInit(3)|EVP_DigestInit(3)>. - -The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. -This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called -later to digest and verify additional data. - -Since only a copy of the digest context is ever finalized the context must -be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak -will occur. - -=head1 BUGS - -Older versions of this documentation wrongly stated that calls to -EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, -L<EVP_SignInit(3)|EVP_SignInit(3)>, -L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, -L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, -L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, -L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> - -=head1 HISTORY - -EVP_VerifyInit(), EVP_VerifyUpdate() and EVP_VerifyFinal() are -available in all versions of SSLeay and OpenSSL. - -EVP_VerifyInit_ex() was added in OpenSSL 0.9.7 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OBJ_nid2obj.pod b/sys/src/ape/lib/openssl/doc/crypto/OBJ_nid2obj.pod deleted file mode 100644 index 7dcc07923..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OBJ_nid2obj.pod +++ /dev/null @@ -1,149 +0,0 @@ -=pod - -=head1 NAME - -OBJ_nid2obj, OBJ_nid2ln, OBJ_nid2sn, OBJ_obj2nid, OBJ_txt2nid, OBJ_ln2nid, OBJ_sn2nid, -OBJ_cmp, OBJ_dup, OBJ_txt2obj, OBJ_obj2txt, OBJ_create, OBJ_cleanup - ASN1 object utility -functions - -=head1 SYNOPSIS - - ASN1_OBJECT * OBJ_nid2obj(int n); - const char * OBJ_nid2ln(int n); - const char * OBJ_nid2sn(int n); - - int OBJ_obj2nid(const ASN1_OBJECT *o); - int OBJ_ln2nid(const char *ln); - int OBJ_sn2nid(const char *sn); - - int OBJ_txt2nid(const char *s); - - ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); - int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); - - int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); - ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o); - - int OBJ_create(const char *oid,const char *sn,const char *ln); - void OBJ_cleanup(void); - -=head1 DESCRIPTION - -The ASN1 object utility functions process ASN1_OBJECT structures which are -a representation of the ASN1 OBJECT IDENTIFIER (OID) type. - -OBJ_nid2obj(), OBJ_nid2ln() and OBJ_nid2sn() convert the NID B<n> to -an ASN1_OBJECT structure, its long name and its short name respectively, -or B<NULL> is an error occurred. - -OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() return the corresponding NID -for the object B<o>, the long name <ln> or the short name <sn> respectively -or NID_undef if an error occurred. - -OBJ_txt2nid() returns NID corresponding to text string <s>. B<s> can be -a long name, a short name or the numerical respresentation of an object. - -OBJ_txt2obj() converts the text string B<s> into an ASN1_OBJECT structure. -If B<no_name> is 0 then long names and short names will be interpreted -as well as numerical forms. If B<no_name> is 1 only the numerical form -is acceptable. - -OBJ_obj2txt() converts the B<ASN1_OBJECT> B<a> into a textual representation. -The representation is written as a null terminated string to B<buf> -at most B<buf_len> bytes are written, truncating the result if necessary. -The total amount of space required is returned. If B<no_name> is 0 then -if the object has a long or short name then that will be used, otherwise -the numerical form will be used. If B<no_name> is 1 then the numerical -form will always be used. - -OBJ_cmp() compares B<a> to B<b>. If the two are identical 0 is returned. - -OBJ_dup() returns a copy of B<o>. - -OBJ_create() adds a new object to the internal table. B<oid> is the -numerical form of the object, B<sn> the short name and B<ln> the -long name. A new NID is returned for the created object. - -OBJ_cleanup() cleans up OpenSSLs internal object table: this should -be called before an application exits if any new objects were added -using OBJ_create(). - -=head1 NOTES - -Objects in OpenSSL can have a short name, a long name and a numerical -identifier (NID) associated with them. A standard set of objects is -represented in an internal table. The appropriate values are defined -in the header file B<objects.h>. - -For example the OID for commonName has the following definitions: - - #define SN_commonName "CN" - #define LN_commonName "commonName" - #define NID_commonName 13 - -New objects can be added by calling OBJ_create(). - -Table objects have certain advantages over other objects: for example -their NIDs can be used in a C language switch statement. They are -also static constant structures which are shared: that is there -is only a single constant structure for each table object. - -Objects which are not in the table have the NID value NID_undef. - -Objects do not need to be in the internal tables to be processed, -the functions OBJ_txt2obj() and OBJ_obj2txt() can process the numerical -form of an OID. - -=head1 EXAMPLES - -Create an object for B<commonName>: - - ASN1_OBJECT *o; - o = OBJ_nid2obj(NID_commonName); - -Check if an object is B<commonName> - - if (OBJ_obj2nid(obj) == NID_commonName) - /* Do something */ - -Create a new NID and initialize an object from it: - - int new_nid; - ASN1_OBJECT *obj; - new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier"); - - obj = OBJ_nid2obj(new_nid); - -Create a new object directly: - - obj = OBJ_txt2obj("1.2.3.4", 1); - -=head1 BUGS - -OBJ_obj2txt() is awkward and messy to use: it doesn't follow the -convention of other OpenSSL functions where the buffer can be set -to B<NULL> to determine the amount of data that should be written. -Instead B<buf> must point to a valid buffer and B<buf_len> should -be set to a positive value. A buffer length of 80 should be more -than enough to handle any OID encountered in practice. - -=head1 RETURN VALUES - -OBJ_nid2obj() returns an B<ASN1_OBJECT> structure or B<NULL> is an -error occurred. - -OBJ_nid2ln() and OBJ_nid2sn() returns a valid string or B<NULL> -on error. - -OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() and OBJ_txt2nid() return -a NID or B<NID_undef> on error. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_Applink.pod b/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_Applink.pod deleted file mode 100644 index e54de12cc..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_Applink.pod +++ /dev/null @@ -1,21 +0,0 @@ -=pod - -=head1 NAME - -OPENSSL_Applink - glue between OpenSSL BIO and Win32 compiler run-time - -=head1 SYNOPSIS - - __declspec(dllexport) void **OPENSSL_Applink(); - -=head1 DESCRIPTION - -OPENSSL_Applink is application-side interface which provides a glue -between OpenSSL BIO layer and Win32 compiler run-time environment. -Even though it appears at application side, it's essentially OpenSSL -private interface. For this reason application developers are not -expected to implement it, but to compile provided module with -compiler of their choice and link it into the target application. -The referred module is available as <openssl>/ms/applink.c. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_VERSION_NUMBER.pod b/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_VERSION_NUMBER.pod deleted file mode 100644 index c39ac35e7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_VERSION_NUMBER.pod +++ /dev/null @@ -1,101 +0,0 @@ -=pod - -=head1 NAME - -OPENSSL_VERSION_NUMBER, SSLeay, SSLeay_version - get OpenSSL version number - -=head1 SYNOPSIS - - #include <openssl/opensslv.h> - #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL - - #include <openssl/crypto.h> - long SSLeay(void); - const char *SSLeay_version(int t); - -=head1 DESCRIPTION - -OPENSSL_VERSION_NUMBER is a numeric release version identifier: - - MMNNFFPPS: major minor fix patch status - -The status nibble has one of the values 0 for development, 1 to e for betas -1 to 14, and f for release. - -for example - - 0x000906000 == 0.9.6 dev - 0x000906023 == 0.9.6b beta 3 - 0x00090605f == 0.9.6e release - -Versions prior to 0.9.3 have identifiers E<lt> 0x0930. -Versions between 0.9.3 and 0.9.5 had a version identifier with this -interpretation: - - MMNNFFRBB major minor fix final beta/patch - -for example - - 0x000904100 == 0.9.4 release - 0x000905000 == 0.9.5 dev - -Version 0.9.5a had an interim interpretation that is like the current one, -except the patch level got the highest bit set, to keep continuity. The -number was therefore 0x0090581f. - - -For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. - -SSLeay() returns this number. The return value can be compared to the -macro to make sure that the correct version of the library has been -loaded, especially when using DLLs on Windows systems. - -SSLeay_version() returns different strings depending on B<t>: - -=over 4 - -=item SSLEAY_VERSION - -The text variant of the version number and the release date. For example, -"OpenSSL 0.9.5a 1 Apr 2000". - -=item SSLEAY_CFLAGS - -The compiler flags set for the compilation process in the form -"compiler: ..." if available or "compiler: information not available" -otherwise. - -=item SSLEAY_BUILT_ON - -The date of the build process in the form "built on: ..." if available -or "built on: date not available" otherwise. - -=item SSLEAY_PLATFORM - -The "Configure" target of the library build in the form "platform: ..." -if available or "platform: information not available" otherwise. - -=item SSLEAY_DIR - -The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "..."" -if available or "OPENSSLDIR: N/A" otherwise. - -=back - -For an unknown B<t>, the text "not available" is returned. - -=head1 RETURN VALUE - -The version number. - -=head1 SEE ALSO - -L<crypto(3)|crypto(3)> - -=head1 HISTORY - -SSLeay() and SSLEAY_VERSION_NUMBER are available in all versions of SSLeay and OpenSSL. -OPENSSL_VERSION_NUMBER is available in all versions of OpenSSL. -B<SSLEAY_DIR> was added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_config.pod b/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_config.pod deleted file mode 100644 index e7bba2aac..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_config.pod +++ /dev/null @@ -1,82 +0,0 @@ -=pod - -=head1 NAME - -OPENSSL_config, OPENSSL_no_config - simple OpenSSL configuration functions - -=head1 SYNOPSIS - - #include <openssl/conf.h> - - void OPENSSL_config(const char *config_name); - void OPENSSL_no_config(void); - -=head1 DESCRIPTION - -OPENSSL_config() configures OpenSSL using the standard B<openssl.cnf> -configuration file name using B<config_name>. If B<config_name> is NULL then -the default name B<openssl_conf> will be used. Any errors are ignored. Further -calls to OPENSSL_config() will have no effect. The configuration file format -is documented in the L<conf(5)|conf(5)> manual page. - -OPENSSL_no_config() disables configuration. If called before OPENSSL_config() -no configuration takes place. - -=head1 NOTES - -It is B<strongly> recommended that B<all> new applications call OPENSSL_config() -or the more sophisticated functions such as CONF_modules_load() during -initialization (that is before starting any threads). By doing this -an application does not need to keep track of all configuration options -and some new functionality can be supported automatically. - -It is also possible to automatically call OPENSSL_config() when an application -calls OPENSSL_add_all_algorithms() by compiling an application with the -preprocessor symbol B<OPENSSL_LOAD_CONF> #define'd. In this way configuration -can be added without source changes. - -The environment variable B<OPENSSL_CONF> can be set to specify the location -of the configuration file. - -Currently ASN1 OBJECTs and ENGINE configuration can be performed future -versions of OpenSSL will add new configuration options. - -There are several reasons why calling the OpenSSL configuration routines is -advisable. For example new ENGINE functionality was added to OpenSSL 0.9.7. -In OpenSSL 0.9.7 control functions can be supported by ENGINEs, this can be -used (among other things) to load dynamic ENGINEs from shared libraries (DSOs). -However very few applications currently support the control interface and so -very few can load and use dynamic ENGINEs. Equally in future more sophisticated -ENGINEs will require certain control operations to customize them. If an -application calls OPENSSL_config() it doesn't need to know or care about -ENGINE control operations because they can be performed by editing a -configuration file. - -Applications should free up configuration at application closedown by calling -CONF_modules_free(). - -=head1 RESTRICTIONS - -The OPENSSL_config() function is designed to be a very simple "call it and -forget it" function. As a result its behaviour is somewhat limited. It ignores -all errors silently and it can only load from the standard configuration file -location for example. - -It is however B<much> better than nothing. Applications which need finer -control over their configuration functionality should use the configuration -functions such as CONF_load_modules() directly. - -=head1 RETURN VALUES - -Neither OPENSSL_config() nor OPENSSL_no_config() return a value. - -=head1 SEE ALSO - -L<conf(5)|conf(5)>, L<CONF_load_modules_file(3)|CONF_load_modules_file(3)>, -L<CONF_modules_free(3),CONF_modules_free(3)> - -=head1 HISTORY - -OPENSSL_config() and OPENSSL_no_config() first appeared in OpenSSL 0.9.7 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_ia32cap.pod b/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_ia32cap.pod deleted file mode 100644 index 121a8ddee..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_ia32cap.pod +++ /dev/null @@ -1,35 +0,0 @@ -=pod - -=head1 NAME - -OPENSSL_ia32cap - finding the IA-32 processor capabilities - -=head1 SYNOPSIS - - unsigned long *OPENSSL_ia32cap_loc(void); - #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) - -=head1 DESCRIPTION - -Value returned by OPENSSL_ia32cap_loc() is address of a variable -containing IA-32 processor capabilities bit vector as it appears in EDX -register after executing CPUID instruction with EAX=1 input value (see -Intel Application Note #241618). Naturally it's meaningful on IA-32[E] -platforms only. The variable is normally set up automatically upon -toolkit initialization, but can be manipulated afterwards to modify -crypto library behaviour. For the moment of this writing three bits are -significant, namely bit #28 denoting Hyperthreading, which is used to -distinguish Intel P4 core, bit #26 denoting SSE2 support, and bit #4 -denoting presence of Time-Stamp Counter. Clearing bit #26 at run-time -for example disables high-performance SSE2 code present in the crypto -library. You might have to do this if target OpenSSL application is -executed on SSE2 capable CPU, but under control of OS which does not -support SSE2 extentions. Even though you can manipulate the value -programmatically, you most likely will find it more appropriate to set -up an environment variable with the same name prior starting target -application, e.g. 'env OPENSSL_ia32cap=0x10 apps/openssl', to achieve -same effect without modifying the application source code. -Alternatively you can reconfigure the toolkit with no-sse2 option and -recompile. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_load_builtin_modules.pod b/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_load_builtin_modules.pod deleted file mode 100644 index f14dfaf00..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OPENSSL_load_builtin_modules.pod +++ /dev/null @@ -1,51 +0,0 @@ -=pod - -=head1 NAME - -OPENSSL_load_builtin_modules - add standard configuration modules - -=head1 SYNOPSIS - - #include <openssl/conf.h> - - void OPENSSL_load_builtin_modules(void); - void ASN1_add_oid_module(void); - ENGINE_add_conf_module(); - -=head1 DESCRIPTION - -The function OPENSSL_load_builtin_modules() adds all the standard OpenSSL -configuration modules to the internal list. They can then be used by the -OpenSSL configuration code. - -ASN1_add_oid_module() adds just the ASN1 OBJECT module. - -ENGINE_add_conf_module() adds just the ENGINE configuration module. - -=head1 NOTES - -If the simple configuration function OPENSSL_config() is called then -OPENSSL_load_builtin_modules() is called automatically. - -Applications which use the configuration functions directly will need to -call OPENSSL_load_builtin_modules() themselves I<before> any other -configuration code. - -Applications should call OPENSSL_load_builtin_modules() to load all -configuration modules instead of adding modules selectively: otherwise -functionality may be missing from the application if an when new -modules are added. - -=head1 RETURN VALUE - -None of the functions return a value. - -=head1 SEE ALSO - -L<conf(3)|conf(3)>, L<OPENSSL_config(3)|OPENSSL_config(3)> - -=head1 HISTORY - -These functions first appeared in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/OpenSSL_add_all_algorithms.pod b/sys/src/ape/lib/openssl/doc/crypto/OpenSSL_add_all_algorithms.pod deleted file mode 100644 index e63411b5b..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/OpenSSL_add_all_algorithms.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests - -add algorithms to internal table - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - void OpenSSL_add_all_algorithms(void); - void OpenSSL_add_all_ciphers(void); - void OpenSSL_add_all_digests(void); - - void EVP_cleanup(void); - -=head1 DESCRIPTION - -OpenSSL keeps an internal table of digest algorithms and ciphers. It uses -this table to lookup ciphers via functions such as EVP_get_cipher_byname(). - -OpenSSL_add_all_digests() adds all digest algorithms to the table. - -OpenSSL_add_all_algorithms() adds all algorithms to the table (digests and -ciphers). - -OpenSSL_add_all_ciphers() adds all encryption algorithms to the table including -password based encryption algorithms. - -EVP_cleanup() removes all ciphers and digests from the table. - -=head1 RETURN VALUES - -None of the functions return a value. - -=head1 NOTES - -A typical application will call OpenSSL_add_all_algorithms() initially and -EVP_cleanup() before exiting. - -An application does not need to add algorithms to use them explicitly, for example -by EVP_sha1(). It just needs to add them if it (or any of the functions it calls) -needs to lookup algorithms. - -The cipher and digest lookup functions are used in many parts of the library. If -the table is not initialized several functions will misbehave and complain they -cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries. -This is a common query in the OpenSSL mailing lists. - -Calling OpenSSL_add_all_algorithms() links in all algorithms: as a result a -statically linked executable can be quite large. If this is important it is possible -to just add the required ciphers and digests. - -=head1 BUGS - -Although the functions do not return error codes it is possible for them to fail. -This will only happen as a result of a memory allocation failure so this is not -too much of a problem in practice. - -=head1 SEE ALSO - -L<evp(3)|evp(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS12_create.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS12_create.pod deleted file mode 100644 index de7cab2bd..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS12_create.pod +++ /dev/null @@ -1,75 +0,0 @@ -=pod - -=head1 NAME - -PKCS12_create - create a PKCS#12 structure - -=head1 SYNOPSIS - - #include <openssl/pkcs12.h> - - PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, STACK_OF(X509) *ca, - int nid_key, int nid_cert, int iter, int mac_iter, int keytype); - -=head1 DESCRIPTION - -PKCS12_create() creates a PKCS#12 structure. - -B<pass> is the passphrase to use. B<name> is the B<friendlyName> to use for -the supplied certifictate and key. B<pkey> is the private key to include in -the structure and B<cert> its corresponding certificates. B<ca>, if not B<NULL> -is an optional set of certificates to also include in the structure. - -B<nid_key> and B<nid_cert> are the encryption algorithms that should be used -for the key and certificate respectively. B<iter> is the encryption algorithm -iteration count to use and B<mac_iter> is the MAC iteration count to use. -B<keytype> is the type of key. - -=head1 NOTES - -The parameters B<nid_key>, B<nid_cert>, B<iter>, B<mac_iter> and B<keytype> -can all be set to zero and sensible defaults will be used. - -These defaults are: 40 bit RC2 encryption for certificates, triple DES -encryption for private keys, a key iteration count of PKCS12_DEFAULT_ITER -(currently 2048) and a MAC iteration count of 1. - -The default MAC iteration count is 1 in order to retain compatibility with -old software which did not interpret MAC iteration counts. If such compatibility -is not required then B<mac_iter> should be set to PKCS12_DEFAULT_ITER. - -B<keytype> adds a flag to the store private key. This is a non standard extension -that is only currently interpreted by MSIE. If set to zero the flag is omitted, -if set to B<KEY_SIG> the key can be used for signing only, if set to B<KEY_EX> -it can be used for signing and encryption. This option was useful for old -export grade software which could use signing only keys of arbitrary size but -had restrictions on the permissible sizes of keys which could be used for -encryption. - -=head1 NEW FUNCTIONALITY IN OPENSSL 0.9.8 - -Some additional functionality was added to PKCS12_create() in OpenSSL -0.9.8. These extensions are detailed below. - -If a certificate contains an B<alias> or B<keyid> then this will be -used for the corresponding B<friendlyName> or B<localKeyID> in the -PKCS12 structure. - -Either B<pkey>, B<cert> or both can be B<NULL> to indicate that no key or -certficate is required. In previous versions both had to be present or -a fatal error is returned. - -B<nid_key> or B<nid_cert> can be set to -1 indicating that no encryption -should be used. - -B<mac_iter> can be set to -1 and the MAC will then be omitted entirely. - -=head1 SEE ALSO - -L<d2i_PKCS12(3)|d2i_PKCS12(3)> - -=head1 HISTORY - -PKCS12_create was added in OpenSSL 0.9.3 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS12_parse.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS12_parse.pod deleted file mode 100644 index 51344f883..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS12_parse.pod +++ /dev/null @@ -1,50 +0,0 @@ -=pod - -=head1 NAME - -PKCS12_parse - parse a PKCS#12 structure - -=head1 SYNOPSIS - - #include <openssl/pkcs12.h> - -int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); - -=head1 DESCRIPTION - -PKCS12_parse() parses a PKCS12 structure. - -B<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use. -If successful the private key will be written to B<*pkey>, the corresponding -certificate to B<*cert> and any additional certificates to B<*ca>. - -=head1 NOTES - -The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> -in which case additional certificates will be discarded. B<*ca> can also -be a valid STACK in which case additional certificates are appended to -B<*ca>. If B<*ca> is B<NULL> a new STACK will be allocated. - -The B<friendlyName> and B<localKeyID> attributes (if present) on each certificate -will be stored in the B<alias> and B<keyid> attributes of the B<X509> structure. - -=head1 BUGS - -Only a single private key and corresponding certificate is returned by this function. -More complex PKCS#12 files with multiple private keys will only return the first -match. - -Only B<friendlyName> and B<localKeyID> attributes are currently stored in certificates. -Other attributes are discarded. - -Attributes currently cannot be store in the private key B<EVP_PKEY> structure. - -=head1 SEE ALSO - -L<d2i_PKCS12(3)|d2i_PKCS12(3)> - -=head1 HISTORY - -PKCS12_parse was added in OpenSSL 0.9.3 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_decrypt.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS7_decrypt.pod deleted file mode 100644 index b0ca067b8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_decrypt.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure - -=head1 SYNOPSIS - -int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); - -=head1 DESCRIPTION - -PKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData -structure. B<pkey> is the private key of the recipient, B<cert> is the -recipients certificate, B<data> is a BIO to write the content to and -B<flags> is an optional set of flags. - -=head1 NOTES - -OpenSSL_add_all_algorithms() (or equivalent) should be called before using this -function or errors about unknown algorithms will occur. - -Although the recipients certificate is not needed to decrypt the data it is needed -to locate the appropriate (of possible several) recipients in the PKCS#7 structure. - -The following flags can be passed in the B<flags> parameter. - -If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted -from the content. If the content is not of type B<text/plain> then an error is -returned. - -=head1 RETURN VALUES - -PKCS7_decrypt() returns either 1 for success or 0 for failure. -The error can be obtained from ERR_get_error(3) - -=head1 BUGS - -PKCS7_decrypt() must be passed the correct recipient key and certificate. It would -be better if it could look up the correct key and certificate from a database. - -The lack of single pass processing and need to hold all data in memory as -mentioned in PKCS7_sign() also applies to PKCS7_verify(). - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> - -=head1 HISTORY - -PKCS7_decrypt() was added to OpenSSL 0.9.5 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_encrypt.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS7_encrypt.pod deleted file mode 100644 index 1a507b22a..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_encrypt.pod +++ /dev/null @@ -1,65 +0,0 @@ -=pod - -=head1 NAME - -PKCS7_encrypt - create a PKCS#7 envelopedData structure - -=head1 SYNOPSIS - -PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags); - -=head1 DESCRIPTION - -PKCS7_encrypt() creates and returns a PKCS#7 envelopedData structure. B<certs> -is a list of recipient certificates. B<in> is the content to be encrypted. -B<cipher> is the symmetric cipher to use. B<flags> is an optional set of flags. - -=head1 NOTES - -Only RSA keys are supported in PKCS#7 and envelopedData so the recipient certificates -supplied to this function must all contain RSA public keys, though they do not have to -be signed using the RSA algorithm. - -EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because -most clients will support it. - -Some old "export grade" clients may only support weak encryption using 40 or 64 bit -RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() respectively. - -The algorithm passed in the B<cipher> parameter must support ASN1 encoding of its -parameters. - -Many browsers implement a "sign and encrypt" option which is simply an S/MIME -envelopedData containing an S/MIME signed message. This can be readily produced -by storing the S/MIME signed message in a memory BIO and passing it to -PKCS7_encrypt(). - -The following flags can be passed in the B<flags> parameter. - -If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended -to the data. - -Normally the supplied content is translated into MIME canonical format (as required -by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occurs. This -option should be used if the supplied data is in binary format otherwise the translation -will corrupt it. If B<PKCS7_BINARY> is set then B<PKCS7_TEXT> is ignored. - -=head1 RETURN VALUES - -PKCS7_encrypt() returns either a valid PKCS7 structure or NULL if an error occurred. -The error can be obtained from ERR_get_error(3). - -=head1 BUGS - -The lack of single pass processing and need to hold all data in memory as -mentioned in PKCS7_sign() also applies to PKCS7_verify(). - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_decrypt(3)|PKCS7_decrypt(3)> - -=head1 HISTORY - -PKCS7_decrypt() was added to OpenSSL 0.9.5 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_sign.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS7_sign.pod deleted file mode 100644 index ffd0c734b..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_sign.pod +++ /dev/null @@ -1,101 +0,0 @@ -=pod - -=head1 NAME - -PKCS7_sign - create a PKCS#7 signedData structure - -=head1 SYNOPSIS - -PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags); - -=head1 DESCRIPTION - -PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert> -is the certificate to sign with, B<pkey> is the corresponsding private key. -B<certs> is an optional additional set of certificates to include in the -PKCS#7 structure (for example any intermediate CAs in the chain). - -The data to be signed is read from BIO B<data>. - -B<flags> is an optional set of flags. - -=head1 NOTES - -Any of the following flags (ored together) can be passed in the B<flags> parameter. - -Many S/MIME clients expect the signed content to include valid MIME headers. If -the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended -to the data. - -If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the -PKCS7 structure, the signer's certificate must still be supplied in the B<signcert> -parameter though. This can reduce the size of the signature if the signers certificate -can be obtained by other means: for example a previously signed message. - -The data being signed is included in the PKCS7 structure, unless B<PKCS7_DETACHED> -is set in which case it is omitted. This is used for PKCS7 detached signatures -which are used in S/MIME plaintext signed messages for example. - -Normally the supplied content is translated into MIME canonical format (as required -by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occurs. This -option should be used if the supplied data is in binary format otherwise the translation -will corrupt it. - -The signedData structure includes several PKCS#7 autenticatedAttributes including -the signing time, the PKCS#7 content type and the supported list of ciphers in -an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no authenticatedAttributes -will be used. If B<PKCS7_NOSMIMECAP> is set then just the SMIMECapabilities are -omitted. - -If present the SMIMECapabilities attribute indicates support for the following -algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any -of these algorithms is disabled then it will not be included. - -If the flags B<PKCS7_PARTSIGN> is set then the returned B<PKCS7> structure -is just initialized ready to perform the signing operation. The signing -is however B<not> performed and the data to be signed is not read from -the B<data> parameter. Signing is deferred until after the data has been -written. In this way data can be signed in a single pass. Currently the -flag B<PKCS7_DETACHED> B<must> also be set. - -=head1 NOTES - -Currently the flag B<PKCS7_PARTSIGN> is only supported for detached -data. If this flag is set the returned B<PKCS7> structure is B<not> -complete and outputting its contents via a function that does not -properly finalize the B<PKCS7> structure will give unpredictable -results. - -At present only the SMIME_write_PKCS7() function properly finalizes the -structure. - -=head1 BUGS - -PKCS7_sign() is somewhat limited. It does not support multiple signers, some -advanced attributes such as counter signatures are not supported. - -The SHA1 digest algorithm is currently always used. - -When the signed data is not detached it will be stored in memory within the -B<PKCS7> structure. This effectively limits the size of messages which can be -signed due to memory restraints. There should be a way to sign data without -having to hold it all in memory, this would however require fairly major -revisions of the OpenSSL ASN1 code. - - -=head1 RETURN VALUES - -PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error occurred. -The error can be obtained from ERR_get_error(3). - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_verify(3)|PKCS7_verify(3)> - -=head1 HISTORY - -PKCS7_sign() was added to OpenSSL 0.9.5 - -The B<PKCS7_PARTSIGN> flag was added in OpenSSL 0.9.8 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_verify.pod b/sys/src/ape/lib/openssl/doc/crypto/PKCS7_verify.pod deleted file mode 100644 index 3490b5dc8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/PKCS7_verify.pod +++ /dev/null @@ -1,116 +0,0 @@ -=pod - -=head1 NAME - -PKCS7_verify - verify a PKCS#7 signedData structure - -=head1 SYNOPSIS - -int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags); - -STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); - -=head1 DESCRIPTION - -PKCS7_verify() verifies a PKCS#7 signedData structure. B<p7> is the PKCS7 -structure to verify. B<certs> is a set of certificates in which to search for -the signer's certificate. B<store> is a trusted certficate store (used for -chain verification). B<indata> is the signed data if the content is not -present in B<p7> (that is it is detached). The content is written to B<out> -if it is not NULL. - -B<flags> is an optional set of flags, which can be used to modify the verify -operation. - -PKCS7_get0_signers() retrieves the signer's certificates from B<p7>, it does -B<not> check their validity or whether any signatures are valid. The B<certs> -and B<flags> parameters have the same meanings as in PKCS7_verify(). - -=head1 VERIFY PROCESS - -Normally the verify process proceeds as follows. - -Initially some sanity checks are performed on B<p7>. The type of B<p7> must -be signedData. There must be at least one signature on the data and if -the content is detached B<indata> cannot be B<NULL>. - -An attempt is made to locate all the signer's certificates, first looking in -the B<certs> parameter (if it is not B<NULL>) and then looking in any certificates -contained in the B<p7> structure itself. If any signer's certificates cannot be -located the operation fails. - -Each signer's certificate is chain verified using the B<smimesign> purpose and -the supplied trusted certificate store. Any internal certificates in the message -are used as untrusted CAs. If any chain verify fails an error code is returned. - -Finally the signed content is read (and written to B<out> is it is not NULL) and -the signature's checked. - -If all signature's verify correctly then the function is successful. - -Any of the following flags (ored together) can be passed in the B<flags> parameter -to change the default verify behaviour. Only the flag B<PKCS7_NOINTERN> is -meaningful to PKCS7_get0_signers(). - -If B<PKCS7_NOINTERN> is set the certificates in the message itself are not -searched when locating the signer's certificate. This means that all the signers -certificates must be in the B<certs> parameter. - -If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted -from the content. If the content is not of type B<text/plain> then an error is -returned. - -If B<PKCS7_NOVERIFY> is set the signer's certificates are not chain verified. - -If B<PKCS7_NOCHAIN> is set then the certificates contained in the message are -not used as untrusted CAs. This means that the whole verify chain (apart from -the signer's certificate) must be contained in the trusted store. - -If B<PKCS7_NOSIGS> is set then the signatures on the data are not checked. - -=head1 NOTES - -One application of B<PKCS7_NOINTERN> is to only accept messages signed by -a small number of certificates. The acceptable certificates would be passed -in the B<certs> parameter. In this case if the signer is not one of the -certificates supplied in B<certs> then the verify will fail because the -signer cannot be found. - -Care should be taken when modifying the default verify behaviour, for example -setting B<PKCS7_NOVERIFY|PKCS7_NOSIGS> will totally disable all verification -and any signed message will be considered valid. This combination is however -useful if one merely wishes to write the content to B<out> and its validity -is not considered important. - -Chain verification should arguably be performed using the signing time rather -than the current time. However since the signing time is supplied by the -signer it cannot be trusted without additional evidence (such as a trusted -timestamp). - -=head1 RETURN VALUES - -PKCS7_verify() returns 1 for a successful verification and zero or a negative -value if an error occurs. - -PKCS7_get0_signers() returns all signers or B<NULL> if an error occurred. - -The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 BUGS - -The trusted certificate store is not searched for the signers certificate, -this is primarily due to the inadequacies of the current B<X509_STORE> -functionality. - -The lack of single pass processing and need to hold all data in memory as -mentioned in PKCS7_sign() also applies to PKCS7_verify(). - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)> - -=head1 HISTORY - -PKCS7_verify() was added to OpenSSL 0.9.5 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_add.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_add.pod deleted file mode 100644 index 67c66f3e0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_add.pod +++ /dev/null @@ -1,77 +0,0 @@ -=pod - -=head1 NAME - -RAND_add, RAND_seed, RAND_status, RAND_event, RAND_screen - add -entropy to the PRNG - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - void RAND_seed(const void *buf, int num); - - void RAND_add(const void *buf, int num, double entropy); - - int RAND_status(void); - - int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam); - void RAND_screen(void); - -=head1 DESCRIPTION - -RAND_add() mixes the B<num> bytes at B<buf> into the PRNG state. Thus, -if the data at B<buf> are unpredictable to an adversary, this -increases the uncertainty about the state and makes the PRNG output -less predictable. Suitable input comes from user interaction (random -key presses, mouse movements) and certain hardware events. The -B<entropy> argument is (the lower bound of) an estimate of how much -randomness is contained in B<buf>, measured in bytes. Details about -sources of randomness and how to estimate their entropy can be found -in the literature, e.g. RFC 1750. - -RAND_add() may be called with sensitive data such as user entered -passwords. The seed values cannot be recovered from the PRNG output. - -OpenSSL makes sure that the PRNG state is unique for each thread. On -systems that provide C</dev/urandom>, the randomness device is used -to seed the PRNG transparently. However, on all other systems, the -application is responsible for seeding the PRNG by calling RAND_add(), -L<RAND_egd(3)|RAND_egd(3)> -or L<RAND_load_file(3)|RAND_load_file(3)>. - -RAND_seed() is equivalent to RAND_add() when B<num == entropy>. - -RAND_event() collects the entropy from Windows events such as mouse -movements and other user interaction. It should be called with the -B<iMsg>, B<wParam> and B<lParam> arguments of I<all> messages sent to -the window procedure. It will estimate the entropy contained in the -event message (if any), and add it to the PRNG. The program can then -process the messages as usual. - -The RAND_screen() function is available for the convenience of Windows -programmers. It adds the current contents of the screen to the PRNG. -For applications that can catch Windows events, seeding the PRNG by -calling RAND_event() is a significantly better source of -randomness. It should be noted that both methods cannot be used on -servers that run without user interaction. - -=head1 RETURN VALUES - -RAND_status() and RAND_event() return 1 if the PRNG has been seeded -with enough data, 0 otherwise. - -The other functions do not return values. - -=head1 SEE ALSO - -L<rand(3)|rand(3)>, L<RAND_egd(3)|RAND_egd(3)>, -L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> - -=head1 HISTORY - -RAND_seed() and RAND_screen() are available in all versions of SSLeay -and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL -0.9.5, RAND_event() in OpenSSL 0.9.5a. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_bytes.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_bytes.pod deleted file mode 100644 index 1a9b91e28..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_bytes.pod +++ /dev/null @@ -1,50 +0,0 @@ -=pod - -=head1 NAME - -RAND_bytes, RAND_pseudo_bytes - generate random data - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - int RAND_bytes(unsigned char *buf, int num); - - int RAND_pseudo_bytes(unsigned char *buf, int num); - -=head1 DESCRIPTION - -RAND_bytes() puts B<num> cryptographically strong pseudo-random bytes -into B<buf>. An error occurs if the PRNG has not been seeded with -enough randomness to ensure an unpredictable byte sequence. - -RAND_pseudo_bytes() puts B<num> pseudo-random bytes into B<buf>. -Pseudo-random byte sequences generated by RAND_pseudo_bytes() will be -unique if they are of sufficient length, but are not necessarily -unpredictable. They can be used for non-cryptographic purposes and for -certain purposes in cryptographic protocols, but usually not for key -generation etc. - -The contents of B<buf> is mixed into the entropy pool before retrieving -the new pseudo-random bytes unless disabled at compile time (see FAQ). - -=head1 RETURN VALUES - -RAND_bytes() returns 1 on success, 0 otherwise. The error code can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. RAND_pseudo_bytes() returns 1 if the -bytes generated are cryptographically strong, 0 otherwise. Both -functions return -1 if they are not supported by the current RAND -method. - -=head1 SEE ALSO - -L<rand(3)|rand(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, -L<RAND_add(3)|RAND_add(3)> - -=head1 HISTORY - -RAND_bytes() is available in all versions of SSLeay and OpenSSL. It -has a return value since OpenSSL 0.9.5. RAND_pseudo_bytes() was added -in OpenSSL 0.9.5. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_cleanup.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_cleanup.pod deleted file mode 100644 index 3a8f0749a..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_cleanup.pod +++ /dev/null @@ -1,29 +0,0 @@ -=pod - -=head1 NAME - -RAND_cleanup - erase the PRNG state - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - void RAND_cleanup(void); - -=head1 DESCRIPTION - -RAND_cleanup() erases the memory used by the PRNG. - -=head1 RETURN VALUE - -RAND_cleanup() returns no value. - -=head1 SEE ALSO - -L<rand(3)|rand(3)> - -=head1 HISTORY - -RAND_cleanup() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_egd.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_egd.pod deleted file mode 100644 index 079838ea2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_egd.pod +++ /dev/null @@ -1,85 +0,0 @@ -=pod - -=head1 NAME - -RAND_egd - query entropy gathering daemon - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - int RAND_egd(const char *path); - int RAND_egd_bytes(const char *path, int bytes); - - int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); - -=head1 DESCRIPTION - -RAND_egd() queries the entropy gathering daemon EGD on socket B<path>. -It queries 255 bytes and uses L<RAND_add(3)|RAND_add(3)> to seed the -OpenSSL built-in PRNG. RAND_egd(path) is a wrapper for -RAND_egd_bytes(path, 255); - -RAND_egd_bytes() queries the entropy gathering daemon EGD on socket B<path>. -It queries B<bytes> bytes and uses L<RAND_add(3)|RAND_add(3)> to seed the -OpenSSL built-in PRNG. -This function is more flexible than RAND_egd(). -When only one secret key must -be generated, it is not necessary to request the full amount 255 bytes from -the EGD socket. This can be advantageous, since the amount of entropy -that can be retrieved from EGD over time is limited. - -RAND_query_egd_bytes() performs the actual query of the EGD daemon on socket -B<path>. If B<buf> is given, B<bytes> bytes are queried and written into -B<buf>. If B<buf> is NULL, B<bytes> bytes are queried and used to seed the -OpenSSL built-in PRNG using L<RAND_add(3)|RAND_add(3)>. - -=head1 NOTES - -On systems without /dev/*random devices providing entropy from the kernel, -the EGD entropy gathering daemon can be used to collect entropy. It provides -a socket interface through which entropy can be gathered in chunks up to -255 bytes. Several chunks can be queried during one connection. - -EGD is available from http://www.lothar.com/tech/crypto/ (C<perl -Makefile.PL; make; make install> to install). It is run as B<egd> -I<path>, where I<path> is an absolute path designating a socket. When -RAND_egd() is called with that path as an argument, it tries to read -random bytes that EGD has collected. The read is performed in -non-blocking mode. - -Alternatively, the EGD-interface compatible daemon PRNGD can be used. It is -available from -http://prngd.sourceforge.net/ . -PRNGD does employ an internal PRNG itself and can therefore never run -out of entropy. - -OpenSSL automatically queries EGD when entropy is requested via RAND_bytes() -or the status is checked via RAND_status() for the first time, if the socket -is located at /var/run/egd-pool, /dev/egd-pool or /etc/egd-pool. - -=head1 RETURN VALUE - -RAND_egd() and RAND_egd_bytes() return the number of bytes read from the -daemon on success, and -1 if the connection failed or the daemon did not -return enough data to fully seed the PRNG. - -RAND_query_egd_bytes() returns the number of bytes read from the daemon on -success, and -1 if the connection failed. The PRNG state is not considered. - -=head1 SEE ALSO - -L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, -L<RAND_cleanup(3)|RAND_cleanup(3)> - -=head1 HISTORY - -RAND_egd() is available since OpenSSL 0.9.5. - -RAND_egd_bytes() is available since OpenSSL 0.9.6. - -RAND_query_egd_bytes() is available since OpenSSL 0.9.7. - -The automatic query of /var/run/egd-pool et al was added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_load_file.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_load_file.pod deleted file mode 100644 index d8c134e62..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_load_file.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - const char *RAND_file_name(char *buf, size_t num); - - int RAND_load_file(const char *filename, long max_bytes); - - int RAND_write_file(const char *filename); - -=head1 DESCRIPTION - -RAND_file_name() generates a default path for the random seed -file. B<buf> points to a buffer of size B<num> in which to store the -filename. The seed file is $RANDFILE if that environment variable is -set, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is -too small for the path name, an error occurs. - -RAND_load_file() reads a number of bytes from file B<filename> and -adds them to the PRNG. If B<max_bytes> is non-negative, -up to to B<max_bytes> are read; starting with OpenSSL 0.9.5, -if B<max_bytes> is -1, the complete file is read. - -RAND_write_file() writes a number of random bytes (currently 1024) to -file B<filename> which can be used to initialize the PRNG by calling -RAND_load_file() in a later session. - -=head1 RETURN VALUES - -RAND_load_file() returns the number of bytes read. - -RAND_write_file() returns the number of bytes written, and -1 if the -bytes written were generated without appropriate seed. - -RAND_file_name() returns a pointer to B<buf> on success, and NULL on -error. - -=head1 SEE ALSO - -L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> - -=head1 HISTORY - -RAND_load_file(), RAND_write_file() and RAND_file_name() are available in -all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RAND_set_rand_method.pod b/sys/src/ape/lib/openssl/doc/crypto/RAND_set_rand_method.pod deleted file mode 100644 index c9bb6d9f2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RAND_set_rand_method.pod +++ /dev/null @@ -1,83 +0,0 @@ -=pod - -=head1 NAME - -RAND_set_rand_method, RAND_get_rand_method, RAND_SSLeay - select RAND method - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - void RAND_set_rand_method(const RAND_METHOD *meth); - - const RAND_METHOD *RAND_get_rand_method(void); - - RAND_METHOD *RAND_SSLeay(void); - -=head1 DESCRIPTION - -A B<RAND_METHOD> specifies the functions that OpenSSL uses for random number -generation. By modifying the method, alternative implementations such as -hardware RNGs may be used. IMPORTANT: See the NOTES section for important -information about how these RAND API functions are affected by the use of -B<ENGINE> API calls. - -Initially, the default RAND_METHOD is the OpenSSL internal implementation, as -returned by RAND_SSLeay(). - -RAND_set_default_method() makes B<meth> the method for PRNG use. B<NB>: This is -true only whilst no ENGINE has been set as a default for RAND, so this function -is no longer recommended. - -RAND_get_default_method() returns a pointer to the current RAND_METHOD. -However, the meaningfulness of this result is dependant on whether the ENGINE -API is being used, so this function is no longer recommended. - -=head1 THE RAND_METHOD STRUCTURE - - typedef struct rand_meth_st - { - void (*seed)(const void *buf, int num); - int (*bytes)(unsigned char *buf, int num); - void (*cleanup)(void); - void (*add)(const void *buf, int num, int entropy); - int (*pseudorand)(unsigned char *buf, int num); - int (*status)(void); - } RAND_METHOD; - -The components point to the implementation of RAND_seed(), -RAND_bytes(), RAND_cleanup(), RAND_add(), RAND_pseudo_rand() -and RAND_status(). -Each component may be NULL if the function is not implemented. - -=head1 RETURN VALUES - -RAND_set_rand_method() returns no value. RAND_get_rand_method() and -RAND_SSLeay() return pointers to the respective methods. - -=head1 NOTES - -As of version 0.9.7, RAND_METHOD implementations are grouped together with other -algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a -default ENGINE is specified for RAND functionality using an ENGINE API function, -that will override any RAND defaults set using the RAND API (ie. -RAND_set_rand_method()). For this reason, the ENGINE API is the recommended way -to control default implementations for use in RAND and other cryptographic -algorithms. - -=head1 SEE ALSO - -L<rand(3)|rand(3)>, L<engine(3)|engine(3)> - -=head1 HISTORY - -RAND_set_rand_method(), RAND_get_rand_method() and RAND_SSLeay() are -available in all versions of OpenSSL. - -In the engine version of version 0.9.6, RAND_set_rand_method() was altered to -take an ENGINE pointer as its argument. As of version 0.9.7, that has been -reverted as the ENGINE API transparently overrides RAND defaults if used, -otherwise RAND API functions work as before. RAND_set_rand_engine() was also -introduced in version 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_blinding_on.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_blinding_on.pod deleted file mode 100644 index fd2c69abd..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_blinding_on.pod +++ /dev/null @@ -1,43 +0,0 @@ -=pod - -=head1 NAME - -RSA_blinding_on, RSA_blinding_off - protect the RSA operation from timing attacks - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); - - void RSA_blinding_off(RSA *rsa); - -=head1 DESCRIPTION - -RSA is vulnerable to timing attacks. In a setup where attackers can -measure the time of RSA decryption or signature operations, blinding -must be used to protect the RSA operation from that attack. - -RSA_blinding_on() turns blinding on for key B<rsa> and generates a -random blinding factor. B<ctx> is B<NULL> or a pre-allocated and -initialized B<BN_CTX>. The random number generator must be seeded -prior to calling RSA_blinding_on(). - -RSA_blinding_off() turns blinding off and frees the memory used for -the blinding factor. - -=head1 RETURN VALUES - -RSA_blinding_on() returns 1 on success, and 0 if an error occurred. - -RSA_blinding_off() returns no value. - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)>, L<rand(3)|rand(3)> - -=head1 HISTORY - -RSA_blinding_on() and RSA_blinding_off() appeared in SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_check_key.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_check_key.pod deleted file mode 100644 index a5198f3db..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_check_key.pod +++ /dev/null @@ -1,67 +0,0 @@ -=pod - -=head1 NAME - -RSA_check_key - validate private RSA keys - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_check_key(RSA *rsa); - -=head1 DESCRIPTION - -This function validates RSA keys. It checks that B<p> and B<q> are -in fact prime, and that B<n = p*q>. - -It also checks that B<d*e = 1 mod (p-1*q-1)>, -and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>. - -As such, this function can not be used with any arbitrary RSA key object, -even if it is otherwise fit for regular RSA operation. See B<NOTES> for more -information. - -=head1 RETURN VALUE - -RSA_check_key() returns 1 if B<rsa> is a valid RSA key, and 0 otherwise. --1 is returned if an error occurs while checking the key. - -If the key is invalid or an error occurred, the reason code can be -obtained using L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 NOTES - -This function does not work on RSA public keys that have only the modulus -and public exponent elements populated. It performs integrity checks on all -the RSA key material, so the RSA key structure must contain all the private -key data too. - -Unlike most other RSA functions, this function does B<not> work -transparently with any underlying ENGINE implementation because it uses the -key data in the RSA structure directly. An ENGINE implementation can -override the way key data is stored and handled, and can even provide -support for HSM keys - in which case the RSA structure may contain B<no> -key data at all! If the ENGINE in question is only being used for -acceleration or analysis purposes, then in all likelihood the RSA key data -is complete and untouched, but this can't be assumed in the general case. - -=head1 BUGS - -A method of verifying the RSA key using opaque RSA API functions might need -to be considered. Right now RSA_check_key() simply uses the RSA structure -elements directly, bypassing the RSA_METHOD table altogether (and -completely violating encapsulation and object-orientation in the process). -The best fix will probably be to introduce a "check_key()" handler to the -RSA_METHOD function table so that alternative implementations can also -provide their own verifiers. - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -RSA_check_key() appeared in OpenSSL 0.9.4. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_generate_key.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_generate_key.pod deleted file mode 100644 index 52dbb14a5..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_generate_key.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -RSA_generate_key - generate RSA key pair - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - RSA *RSA_generate_key(int num, unsigned long e, - void (*callback)(int,int,void *), void *cb_arg); - -=head1 DESCRIPTION - -RSA_generate_key() generates a key pair and returns it in a newly -allocated B<RSA> structure. The pseudo-random number generator must -be seeded prior to calling RSA_generate_key(). - -The modulus size will be B<num> bits, and the public exponent will be -B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure. -The exponent is an odd number, typically 3, 17 or 65537. - -A callback function may be used to provide feedback about the -progress of the key generation. If B<callback> is not B<NULL>, it -will be called as follows: - -=over 4 - -=item * - -While a random prime number is generated, it is called as -described in L<BN_generate_prime(3)|BN_generate_prime(3)>. - -=item * - -When the n-th randomly generated prime is rejected as not -suitable for the key, B<callback(2, n, cb_arg)> is called. - -=item * - -When a random p has been found with p-1 relatively prime to B<e>, -it is called as B<callback(3, 0, cb_arg)>. - -=back - -The process is then repeated for prime q with B<callback(3, 1, cb_arg)>. - -=head1 RETURN VALUE - -If key generation fails, RSA_generate_key() returns B<NULL>; the -error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 BUGS - -B<callback(2, x, cb_arg)> is used with two different meanings. - -RSA_generate_key() goes into an infinite loop for illegal input values. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, -L<RSA_free(3)|RSA_free(3)> - -=head1 HISTORY - -The B<cb_arg> argument was added in SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_get_ex_new_index.pod deleted file mode 100644 index 7d0fd1f91..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_get_ex_new_index.pod +++ /dev/null @@ -1,120 +0,0 @@ -=pod - -=head1 NAME - -RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specific data to RSA structures - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int RSA_set_ex_data(RSA *r, int idx, void *arg); - - void *RSA_get_ex_data(RSA *r, int idx); - - typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); - -=head1 DESCRIPTION - -Several OpenSSL structures can have application specific data attached to them. -This has several potential uses, it can be used to cache data associated with -a structure (for example the hash of some part of the structure) or some -additional data (for example a handle to the data in an external library). - -Since the application data can be anything at all it is passed and retrieved -as a B<void *> type. - -The B<RSA_get_ex_new_index()> function is initially called to "register" some -new application specific data. It takes three optional function pointers which -are called when the parent structure (in this case an RSA structure) is -initially created, when it is copied and when it is freed up. If any or all of -these function pointer arguments are not used they should be set to NULL. The -precise manner in which these function pointers are called is described in more -detail below. B<RSA_get_ex_new_index()> also takes additional long and pointer -parameters which will be passed to the supplied functions but which otherwise -have no special meaning. It returns an B<index> which should be stored -(typically in a static variable) and passed used in the B<idx> parameter in -the remaining functions. Each successful call to B<RSA_get_ex_new_index()> -will return an index greater than any previously returned, this is important -because the optional functions are called in order of increasing index value. - -B<RSA_set_ex_data()> is used to set application specific data, the data is -supplied in the B<arg> parameter and its precise meaning is up to the -application. - -B<RSA_get_ex_data()> is used to retrieve application specific data. The data -is returned to the application, this will be the same value as supplied to -a previous B<RSA_set_ex_data()> call. - -B<new_func()> is called when a structure is initially allocated (for example -with B<RSA_new()>. The parent structure members will not have any meaningful -values at this point. This function will typically be used to allocate any -application specific structure. - -B<free_func()> is called when a structure is being freed up. The dynamic parent -structure members should not be accessed because they will be freed up when -this function is called. - -B<new_func()> and B<free_func()> take the same parameters. B<parent> is a -pointer to the parent RSA structure. B<ptr> is a the application specific data -(this wont be of much use in B<new_func()>. B<ad> is a pointer to the -B<CRYPTO_EX_DATA> structure from the parent RSA structure: the functions -B<CRYPTO_get_ex_data()> and B<CRYPTO_set_ex_data()> can be called to manipulate -it. The B<idx> parameter is the index: this will be the same value returned by -B<RSA_get_ex_new_index()> when the functions were initially registered. Finally -the B<argl> and B<argp> parameters are the values originally passed to the same -corresponding parameters when B<RSA_get_ex_new_index()> was called. - -B<dup_func()> is called when a structure is being copied. Pointers to the -destination and source B<CRYPTO_EX_DATA> structures are passed in the B<to> and -B<from> parameters respectively. The B<from_d> parameter is passed a pointer to -the source application data when the function is called, when the function returns -the value is copied to the destination: the application can thus modify the data -pointed to by B<from_d> and have different values in the source and destination. -The B<idx>, B<argl> and B<argp> parameters are the same as those in B<new_func()> -and B<free_func()>. - -=head1 RETURN VALUES - -B<RSA_get_ex_new_index()> returns a new index or -1 on failure (note 0 is a valid -index value). - -B<RSA_set_ex_data()> returns 1 on success or 0 on failure. - -B<RSA_get_ex_data()> returns the application data or 0 on failure. 0 may also -be valid application data but currently it can only fail if given an invalid B<idx> -parameter. - -B<new_func()> and B<dup_func()> should return 0 for failure and 1 for success. - -On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 BUGS - -B<dup_func()> is currently never called. - -The return value of B<new_func()> is ignored. - -The B<new_func()> function isn't very useful because no meaningful values are -present in the parent RSA structure when it is called. - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)>, L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> - -=head1 HISTORY - -RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() are -available since SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_new.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_new.pod deleted file mode 100644 index 3d15b9282..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_new.pod +++ /dev/null @@ -1,41 +0,0 @@ -=pod - -=head1 NAME - -RSA_new, RSA_free - allocate and free RSA objects - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - RSA * RSA_new(void); - - void RSA_free(RSA *rsa); - -=head1 DESCRIPTION - -RSA_new() allocates and initializes an B<RSA> structure. It is equivalent to -calling RSA_new_method(NULL). - -RSA_free() frees the B<RSA> structure and its components. The key is -erased before the memory is returned to the system. - -=head1 RETURN VALUES - -If the allocation fails, RSA_new() returns B<NULL> and sets an error -code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns -a pointer to the newly allocated structure. - -RSA_free() returns no value. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<rsa(3)|rsa(3)>, -L<RSA_generate_key(3)|RSA_generate_key(3)>, -L<RSA_new_method(3)|RSA_new_method(3)> - -=head1 HISTORY - -RSA_new() and RSA_free() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_padding_add_PKCS1_type_1.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_padding_add_PKCS1_type_1.pod deleted file mode 100644 index b8f678fe7..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_padding_add_PKCS1_type_1.pod +++ /dev/null @@ -1,124 +0,0 @@ -=pod - -=head1 NAME - -RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1, -RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, -RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, -RSA_padding_add_SSLv23, RSA_padding_check_SSLv23, -RSA_padding_add_none, RSA_padding_check_none - asymmetric encryption -padding - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, - unsigned char *f, int fl); - - int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, - unsigned char *f, int fl, int rsa_len); - - int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, - unsigned char *f, int fl); - - int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, - unsigned char *f, int fl, int rsa_len); - - int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, - unsigned char *f, int fl, unsigned char *p, int pl); - - int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, - unsigned char *f, int fl, int rsa_len, unsigned char *p, int pl); - - int RSA_padding_add_SSLv23(unsigned char *to, int tlen, - unsigned char *f, int fl); - - int RSA_padding_check_SSLv23(unsigned char *to, int tlen, - unsigned char *f, int fl, int rsa_len); - - int RSA_padding_add_none(unsigned char *to, int tlen, - unsigned char *f, int fl); - - int RSA_padding_check_none(unsigned char *to, int tlen, - unsigned char *f, int fl, int rsa_len); - -=head1 DESCRIPTION - -The RSA_padding_xxx_xxx() functions are called from the RSA encrypt, -decrypt, sign and verify functions. Normally they should not be called -from application programs. - -However, they can also be called directly to implement padding for other -asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and -RSA_padding_check_PKCS1_OAEP() may be used in an application combined -with B<RSA_NO_PADDING> in order to implement OAEP with an encoding -parameter. - -RSA_padding_add_xxx() encodes B<fl> bytes from B<f> so as to fit into -B<tlen> bytes and stores the result at B<to>. An error occurs if B<fl> -does not meet the size requirements of the encoding method. - -The following encoding methods are implemented: - -=over 4 - -=item PKCS1_type_1 - -PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures - -=item PKCS1_type_2 - -PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2) - -=item PKCS1_OAEP - -PKCS #1 v2.0 EME-OAEP - -=item SSLv23 - -PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification - -=item none - -simply copy the data - -=back - -The random number generator must be seeded prior to calling -RSA_padding_add_xxx(). - -RSA_padding_check_xxx() verifies that the B<fl> bytes at B<f> contain -a valid encoding for a B<rsa_len> byte RSA key in the respective -encoding method and stores the recovered data of at most B<tlen> bytes -(for B<RSA_NO_PADDING>: of size B<tlen>) -at B<to>. - -For RSA_padding_xxx_OAEP(), B<p> points to the encoding parameter -of length B<pl>. B<p> may be B<NULL> if B<pl> is 0. - -=head1 RETURN VALUES - -The RSA_padding_add_xxx() functions return 1 on success, 0 on error. -The RSA_padding_check_xxx() functions return the length of the -recovered data, -1 on error. Error codes can be obtained by calling -L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>, -L<RSA_private_decrypt(3)|RSA_private_decrypt(3)>, -L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)> - -=head1 HISTORY - -RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(), -RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(), -RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(), -RSA_padding_add_none() and RSA_padding_check_none() appeared in -SSLeay 0.9.0. - -RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were -added in OpenSSL 0.9.2b. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_print.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_print.pod deleted file mode 100644 index c971e91f4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_print.pod +++ /dev/null @@ -1,49 +0,0 @@ -=pod - -=head1 NAME - -RSA_print, RSA_print_fp, -DSAparams_print, DSAparams_print_fp, DSA_print, DSA_print_fp, -DHparams_print, DHparams_print_fp - print cryptographic parameters - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_print(BIO *bp, RSA *x, int offset); - int RSA_print_fp(FILE *fp, RSA *x, int offset); - - #include <openssl/dsa.h> - - int DSAparams_print(BIO *bp, DSA *x); - int DSAparams_print_fp(FILE *fp, DSA *x); - int DSA_print(BIO *bp, DSA *x, int offset); - int DSA_print_fp(FILE *fp, DSA *x, int offset); - - #include <openssl/dh.h> - - int DHparams_print(BIO *bp, DH *x); - int DHparams_print_fp(FILE *fp, DH *x); - -=head1 DESCRIPTION - -A human-readable hexadecimal output of the components of the RSA -key, DSA parameters or key or DH parameters is printed to B<bp> or B<fp>. - -The output lines are indented by B<offset> spaces. - -=head1 RETURN VALUES - -These functions return 1 on success, 0 on error. - -=head1 SEE ALSO - -L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<rsa(3)|rsa(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)> - -=head1 HISTORY - -RSA_print(), RSA_print_fp(), DSA_print(), DSA_print_fp(), DH_print(), -DH_print_fp() are available in all versions of SSLeay and OpenSSL. -DSAparams_print() and DSAparams_print_fp() were added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_private_encrypt.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_private_encrypt.pod deleted file mode 100644 index 746a80c79..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_private_encrypt.pod +++ /dev/null @@ -1,70 +0,0 @@ -=pod - -=head1 NAME - -RSA_private_encrypt, RSA_public_decrypt - low level signature operations - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_private_encrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - int RSA_public_decrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - -=head1 DESCRIPTION - -These functions handle RSA signatures at a low level. - -RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a -message digest with an algorithm identifier) using the private key -B<rsa> and stores the signature in B<to>. B<to> must point to -B<RSA_size(rsa)> bytes of memory. - -B<padding> denotes one of the following modes: - -=over 4 - -=item RSA_PKCS1_PADDING - -PKCS #1 v1.5 padding. This function does not handle the -B<algorithmIdentifier> specified in PKCS #1. When generating or -verifying PKCS #1 signatures, L<RSA_sign(3)|RSA_sign(3)> and L<RSA_verify(3)|RSA_verify(3)> should be -used. - -=item RSA_NO_PADDING - -Raw RSA signature. This mode should I<only> be used to implement -cryptographically sound padding modes in the application code. -Signing user data directly with RSA is insecure. - -=back - -RSA_public_decrypt() recovers the message digest from the B<flen> -bytes long signature at B<from> using the signer's public key -B<rsa>. B<to> must point to a memory section large enough to hold the -message digest (which is smaller than B<RSA_size(rsa) - -11>). B<padding> is the padding mode that was used to sign the data. - -=head1 RETURN VALUES - -RSA_private_encrypt() returns the size of the signature (i.e., -RSA_size(rsa)). RSA_public_decrypt() returns the size of the -recovered message digest. - -On error, -1 is returned; the error codes can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<rsa(3)|rsa(3)>, -L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)> - -=head1 HISTORY - -The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is -available since SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_public_encrypt.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_public_encrypt.pod deleted file mode 100644 index ab0fe3b2c..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_public_encrypt.pod +++ /dev/null @@ -1,84 +0,0 @@ -=pod - -=head1 NAME - -RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_public_encrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - int RSA_private_decrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - -=head1 DESCRIPTION - -RSA_public_encrypt() encrypts the B<flen> bytes at B<from> (usually a -session key) using the public key B<rsa> and stores the ciphertext in -B<to>. B<to> must point to RSA_size(B<rsa>) bytes of memory. - -B<padding> denotes one of the following modes: - -=over 4 - -=item RSA_PKCS1_PADDING - -PKCS #1 v1.5 padding. This currently is the most widely used mode. - -=item RSA_PKCS1_OAEP_PADDING - -EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty -encoding parameter. This mode is recommended for all new applications. - -=item RSA_SSLV23_PADDING - -PKCS #1 v1.5 padding with an SSL-specific modification that denotes -that the server is SSL3 capable. - -=item RSA_NO_PADDING - -Raw RSA encryption. This mode should I<only> be used to implement -cryptographically sound padding modes in the application code. -Encrypting user data directly with RSA is insecure. - -=back - -B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 -based padding modes, less than RSA_size(B<rsa>) - 41 for -RSA_PKCS1_OAEP_PADDING and exactly RSA_size(B<rsa>) for RSA_NO_PADDING. -The random number generator must be seeded prior to calling -RSA_public_encrypt(). - -RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the -private key B<rsa> and stores the plaintext in B<to>. B<to> must point -to a memory section large enough to hold the decrypted data (which is -smaller than RSA_size(B<rsa>)). B<padding> is the padding mode that -was used to encrypt the data. - -=head1 RETURN VALUES - -RSA_public_encrypt() returns the size of the encrypted data (i.e., -RSA_size(B<rsa>)). RSA_private_decrypt() returns the size of the -recovered plaintext. - -On error, -1 is returned; the error codes can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 CONFORMING TO - -SSL, PKCS #1 v2.0 - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, -L<RSA_size(3)|RSA_size(3)> - -=head1 HISTORY - -The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is -available since SSLeay 0.9.0, OAEP was added in OpenSSL 0.9.2b. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_set_method.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_set_method.pod deleted file mode 100644 index 0a305f6b1..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_set_method.pod +++ /dev/null @@ -1,202 +0,0 @@ -=pod - -=head1 NAME - -RSA_set_default_method, RSA_get_default_method, RSA_set_method, -RSA_get_method, RSA_PKCS1_SSLeay, RSA_null_method, RSA_flags, -RSA_new_method - select RSA method - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - void RSA_set_default_method(const RSA_METHOD *meth); - - RSA_METHOD *RSA_get_default_method(void); - - int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - - RSA_METHOD *RSA_get_method(const RSA *rsa); - - RSA_METHOD *RSA_PKCS1_SSLeay(void); - - RSA_METHOD *RSA_null_method(void); - - int RSA_flags(const RSA *rsa); - - RSA *RSA_new_method(RSA_METHOD *method); - -=head1 DESCRIPTION - -An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA -operations. By modifying the method, alternative implementations such as -hardware accelerators may be used. IMPORTANT: See the NOTES section for -important information about how these RSA API functions are affected by the -use of B<ENGINE> API calls. - -Initially, the default RSA_METHOD is the OpenSSL internal implementation, -as returned by RSA_PKCS1_SSLeay(). - -RSA_set_default_method() makes B<meth> the default method for all RSA -structures created later. B<NB>: This is true only whilst no ENGINE has -been set as a default for RSA, so this function is no longer recommended. - -RSA_get_default_method() returns a pointer to the current default -RSA_METHOD. However, the meaningfulness of this result is dependant on -whether the ENGINE API is being used, so this function is no longer -recommended. - -RSA_set_method() selects B<meth> to perform all operations using the key -B<rsa>. This will replace the RSA_METHOD used by the RSA key and if the -previous method was supplied by an ENGINE, the handle to that ENGINE will -be released during the change. It is possible to have RSA keys that only -work with certain RSA_METHOD implementations (eg. from an ENGINE module -that supports embedded hardware-protected keys), and in such cases -attempting to change the RSA_METHOD for the key can have unexpected -results. - -RSA_get_method() returns a pointer to the RSA_METHOD being used by B<rsa>. -This method may or may not be supplied by an ENGINE implementation, but if -it is, the return value can only be guaranteed to be valid as long as the -RSA key itself is valid and does not have its implementation changed by -RSA_set_method(). - -RSA_flags() returns the B<flags> that are set for B<rsa>'s current -RSA_METHOD. See the BUGS section. - -RSA_new_method() allocates and initializes an RSA structure so that -B<engine> will be used for the RSA operations. If B<engine> is NULL, the -default ENGINE for RSA operations is used, and if no default ENGINE is set, -the RSA_METHOD controlled by RSA_set_default_method() is used. - -RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. - -RSA_new_method() allocates and initializes an B<RSA> structure so that -B<method> will be used for the RSA operations. If B<method> is B<NULL>, -the default method is used. - -=head1 THE RSA_METHOD STRUCTURE - - typedef struct rsa_meth_st - { - /* name of the implementation */ - const char *name; - - /* encrypt */ - int (*rsa_pub_enc)(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - /* verify arbitrary data */ - int (*rsa_pub_dec)(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - /* sign arbitrary data */ - int (*rsa_priv_enc)(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - /* decrypt */ - int (*rsa_priv_dec)(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - - /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some - implementations) */ - int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); - - /* compute r = a ^ p mod m (May be NULL for some implementations) */ - int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); - - /* called at RSA_new */ - int (*init)(RSA *rsa); - - /* called at RSA_free */ - int (*finish)(RSA *rsa); - - /* RSA_FLAG_EXT_PKEY - rsa_mod_exp is called for private key - * operations, even if p,q,dmp1,dmq1,iqmp - * are NULL - * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify - * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match - */ - int flags; - - char *app_data; /* ?? */ - - /* sign. For backward compatibility, this is used only - * if (flags & RSA_FLAG_SIGN_VER) - */ - int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); - - /* verify. For backward compatibility, this is used only - * if (flags & RSA_FLAG_SIGN_VER) - */ - int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len, - unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - - } RSA_METHOD; - -=head1 RETURN VALUES - -RSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_method() -and RSA_get_method() return pointers to the respective RSA_METHODs. - -RSA_set_default_method() returns no value. - -RSA_set_method() returns a pointer to the old RSA_METHOD implementation -that was replaced. However, this return value should probably be ignored -because if it was supplied by an ENGINE, the pointer could be invalidated -at any time if the ENGINE is unloaded (in fact it could be unloaded as a -result of the RSA_set_method() function releasing its handle to the -ENGINE). For this reason, the return type may be replaced with a B<void> -declaration in a future release. - -RSA_new_method() returns NULL and sets an error code that can be obtained -by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise -it returns a pointer to the newly allocated structure. - -=head1 NOTES - -As of version 0.9.7, RSA_METHOD implementations are grouped together with -other algorithmic APIs (eg. DSA_METHOD, EVP_CIPHER, etc) into B<ENGINE> -modules. If a default ENGINE is specified for RSA functionality using an -ENGINE API function, that will override any RSA defaults set using the RSA -API (ie. RSA_set_default_method()). For this reason, the ENGINE API is the -recommended way to control default implementations for use in RSA and other -cryptographic algorithms. - -=head1 BUGS - -The behaviour of RSA_flags() is a mis-feature that is left as-is for now -to avoid creating compatibility problems. RSA functionality, such as the -encryption functions, are controlled by the B<flags> value in the RSA key -itself, not by the B<flags> value in the RSA_METHOD attached to the RSA key -(which is what this function returns). If the flags element of an RSA key -is changed, the changes will be honoured by RSA functionality but will not -be reflected in the return value of the RSA_flags() function - in effect -RSA_flags() behaves more like an RSA_default_flags() function (which does -not currently exist). - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)> - -=head1 HISTORY - -RSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8. -RSA_get_default_method(), RSA_set_method() and RSA_get_method() as -well as the rsa_sign and rsa_verify components of RSA_METHOD were -added in OpenSSL 0.9.4. - -RSA_set_default_openssl_method() and RSA_get_default_openssl_method() -replaced RSA_set_default_method() and RSA_get_default_method() -respectively, and RSA_set_method() and RSA_new_method() were altered to use -B<ENGINE>s rather than B<RSA_METHOD>s during development of the engine -version of OpenSSL 0.9.6. For 0.9.7, the handling of defaults in the ENGINE -API was restructured so that this change was reversed, and behaviour of the -other functions resembled more closely the previous behaviour. The -behaviour of defaults in the ENGINE API now transparently overrides the -behaviour of defaults in the RSA API without requiring changing these -function prototypes. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_sign.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_sign.pod deleted file mode 100644 index 8553be8e9..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_sign.pod +++ /dev/null @@ -1,62 +0,0 @@ -=pod - -=head1 NAME - -RSA_sign, RSA_verify - RSA signatures - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_sign(int type, const unsigned char *m, unsigned int m_len, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); - - int RSA_verify(int type, const unsigned char *m, unsigned int m_len, - unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - -=head1 DESCRIPTION - -RSA_sign() signs the message digest B<m> of size B<m_len> using the -private key B<rsa> as specified in PKCS #1 v2.0. It stores the -signature in B<sigret> and the signature size in B<siglen>. B<sigret> -must point to RSA_size(B<rsa>) bytes of memory. - -B<type> denotes the message digest algorithm that was used to generate -B<m>. It usually is one of B<NID_sha1>, B<NID_ripemd160> and B<NID_md5>; -see L<objects(3)|objects(3)> for details. If B<type> is B<NID_md5_sha1>, -an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding -and no algorithm identifier) is created. - -RSA_verify() verifies that the signature B<sigbuf> of size B<siglen> -matches a given message digest B<m> of size B<m_len>. B<type> denotes -the message digest algorithm that was used to generate the signature. -B<rsa> is the signer's public key. - -=head1 RETURN VALUES - -RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1 -on successful verification, 0 otherwise. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 BUGS - -Certain signatures with an improper algorithm identifier are accepted -for compatibility with SSLeay 0.4.5 :-) - -=head1 CONFORMING TO - -SSL, PKCS #1 v2.0 - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<objects(3)|objects(3)>, -L<rsa(3)|rsa(3)>, L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, -L<RSA_public_decrypt(3)|RSA_public_decrypt(3)> - -=head1 HISTORY - -RSA_sign() and RSA_verify() are available in all versions of SSLeay -and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod deleted file mode 100644 index e70380bbf..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING - RSA signatures - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m, - unsigned int m_len, unsigned char *sigret, unsigned int *siglen, - RSA *rsa); - - int RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m, - unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, - RSA *rsa); - -=head1 DESCRIPTION - -RSA_sign_ASN1_OCTET_STRING() signs the octet string B<m> of size -B<m_len> using the private key B<rsa> represented in DER using PKCS #1 -padding. It stores the signature in B<sigret> and the signature size -in B<siglen>. B<sigret> must point to B<RSA_size(rsa)> bytes of -memory. - -B<dummy> is ignored. - -The random number generator must be seeded prior to calling RSA_sign_ASN1_OCTET_STRING(). - -RSA_verify_ASN1_OCTET_STRING() verifies that the signature B<sigbuf> -of size B<siglen> is the DER representation of a given octet string -B<m> of size B<m_len>. B<dummy> is ignored. B<rsa> is the signer's -public key. - -=head1 RETURN VALUES - -RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise. -RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0 -otherwise. - -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 BUGS - -These functions serve no recognizable purpose. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<objects(3)|objects(3)>, -L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<RSA_sign(3)|RSA_sign(3)>, -L<RSA_verify(3)|RSA_verify(3)> - -=head1 HISTORY - -RSA_sign_ASN1_OCTET_STRING() and RSA_verify_ASN1_OCTET_STRING() were -added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/RSA_size.pod b/sys/src/ape/lib/openssl/doc/crypto/RSA_size.pod deleted file mode 100644 index 5b7f835f9..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/RSA_size.pod +++ /dev/null @@ -1,33 +0,0 @@ -=pod - -=head1 NAME - -RSA_size - get RSA modulus size - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - - int RSA_size(const RSA *rsa); - -=head1 DESCRIPTION - -This function returns the RSA modulus size in bytes. It can be used to -determine how much memory must be allocated for an RSA encrypted -value. - -B<rsa-E<gt>n> must not be B<NULL>. - -=head1 RETURN VALUE - -The size in bytes. - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)> - -=head1 HISTORY - -RSA_size() is available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/SMIME_read_PKCS7.pod b/sys/src/ape/lib/openssl/doc/crypto/SMIME_read_PKCS7.pod deleted file mode 100644 index ffafa3788..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/SMIME_read_PKCS7.pod +++ /dev/null @@ -1,71 +0,0 @@ -=pod - -=head1 NAME - -SMIME_read_PKCS7 - parse S/MIME message. - -=head1 SYNOPSIS - -PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont); - -=head1 DESCRIPTION - -SMIME_read_PKCS7() parses a message in S/MIME format. - -B<in> is a BIO to read the message from. - -If cleartext signing is used then the content is saved in -a memory bio which is written to B<*bcont>, otherwise -B<*bcont> is set to B<NULL>. - -The parsed PKCS#7 structure is returned or B<NULL> if an -error occurred. - -=head1 NOTES - -If B<*bcont> is not B<NULL> then the message is clear text -signed. B<*bcont> can then be passed to PKCS7_verify() with -the B<PKCS7_DETACHED> flag set. - -Otherwise the type of the returned structure can be determined -using PKCS7_type(). - -To support future functionality if B<bcont> is not B<NULL> -B<*bcont> should be initialized to B<NULL>. For example: - - BIO *cont = NULL; - PKCS7 *p7; - - p7 = SMIME_read_PKCS7(in, &cont); - -=head1 BUGS - -The MIME parser used by SMIME_read_PKCS7() is somewhat primitive. -While it will handle most S/MIME messages more complex compound -formats may not work. - -The parser assumes that the PKCS7 structure is always base64 -encoded and will not handle the case where it is in binary format -or uses quoted printable format. - -The use of a memory BIO to hold the signed content limits the size -of message which can be processed due to memory restraints: a -streaming single pass option should be available. - -=head1 RETURN VALUES - -SMIME_read_PKCS7() returns a valid B<PKCS7> structure or B<NULL> -is an error occurred. The error can be obtained from ERR_get_error(3). - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_type(3)|PKCS7_type(3)> -L<SMIME_read_PKCS7(3)|SMIME_read_PKCS7(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, -L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> -L<PKCS7_decrypt(3)|PKCS7_decrypt(3)> - -=head1 HISTORY - -SMIME_read_PKCS7() was added to OpenSSL 0.9.5 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/SMIME_write_PKCS7.pod b/sys/src/ape/lib/openssl/doc/crypto/SMIME_write_PKCS7.pod deleted file mode 100644 index 61945b388..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/SMIME_write_PKCS7.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format. - -=head1 SYNOPSIS - -int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags); - -=head1 DESCRIPTION - -SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7 -structure to produce an S/MIME message. - -B<out> is the BIO to write the data to. B<p7> is the appropriate -B<PKCS7> structure. If cleartext signing (B<multipart/signed>) is -being used then the signed data must be supplied in the B<data> -argument. B<flags> is an optional set of flags. - -=head1 NOTES - -The following flags can be passed in the B<flags> parameter. - -If B<PKCS7_DETACHED> is set then cleartext signing will be used, -this option only makes sense for signedData where B<PKCS7_DETACHED> -is also set when PKCS7_sign() is also called. - -If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> -are added to the content, this only makes sense if B<PKCS7_DETACHED> -is also set. - -If the B<PKCS7_PARTSIGN> flag is set the signed data is finalized -and output along with the content. This flag should only be set -if B<PKCS7_DETACHED> is also set and the previous call to PKCS7_sign() -also set these flags. - -If cleartext signing is being used and B<PKCS7_PARTSIGN> not set then -the data must be read twice: once to compute the signature in PKCS7_sign() -and once to output the S/MIME message. - -=head1 BUGS - -SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there -should be an option to disable this. - -=head1 RETURN VALUES - -SMIME_write_PKCS7() returns 1 for success or 0 for failure. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, -L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> -L<PKCS7_decrypt(3)|PKCS7_decrypt(3)> - -=head1 HISTORY - -SMIME_write_PKCS7() was added to OpenSSL 0.9.5 - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod b/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod deleted file mode 100644 index 11b35f6fd..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod +++ /dev/null @@ -1,72 +0,0 @@ -=pod - -=head1 NAME - -X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, -X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, -X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, -X509_NAME_ENTRY_create_by_OBJ - X509_NAME_ENTRY utility functions - -=head1 SYNOPSIS - -ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); - -int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj); -int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, const unsigned char *bytes, int len); - -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field, int type, const unsigned char *bytes, int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type,unsigned char *bytes, int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); - -=head1 DESCRIPTION - -X509_NAME_ENTRY_get_object() retrieves the field name of B<ne> in -and B<ASN1_OBJECT> structure. - -X509_NAME_ENTRY_get_data() retrieves the field value of B<ne> in -and B<ASN1_STRING> structure. - -X509_NAME_ENTRY_set_object() sets the field name of B<ne> to B<obj>. - -X509_NAME_ENTRY_set_data() sets the field value of B<ne> to string type -B<type> and value determined by B<bytes> and B<len>. - -X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() -and X509_NAME_ENTRY_create_by_OBJ() create and return an -B<X509_NAME_ENTRY> structure. - -=head1 NOTES - -X509_NAME_ENTRY_get_object() and X509_NAME_ENTRY_get_data() can be -used to examine an B<X509_NAME_ENTRY> function as returned by -X509_NAME_get_entry() for example. - -X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID(), -and X509_NAME_ENTRY_create_by_OBJ() create and return an - -X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_OBJ(), -X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_set_data() -are seldom used in practice because B<X509_NAME_ENTRY> structures -are almost always part of B<X509_NAME> structures and the -corresponding B<X509_NAME> functions are typically used to -create and add new entries in a single operation. - -The arguments of these functions support similar options to the similarly -named ones of the corresponding B<X509_NAME> functions such as -X509_NAME_add_entry_by_txt(). So for example B<type> can be set to -B<MBSTRING_ASC> but in the case of X509_set_data() the field name must be -set first so the relevant field information can be looked up internally. - -=head1 RETURN VALUES - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)>, -L<OBJ_nid2obj(3),OBJ_nid2obj(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod b/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod deleted file mode 100644 index e2ab4b0d2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod +++ /dev/null @@ -1,114 +0,0 @@ -=pod - -=head1 NAME - -X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, X509_NAME_add_entry_by_NID, -X509_NAME_add_entry, X509_NAME_delete_entry - X509_NAME modification functions - -=head1 SYNOPSIS - -int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); - -int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); - -int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); - -int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, int loc, int set); - -X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); - -=head1 DESCRIPTION - -X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and -X509_NAME_add_entry_by_NID() add a field whose name is defined -by a string B<field>, an object B<obj> or a NID B<nid> respectively. -The field value to be added is in B<bytes> of length B<len>. If -B<len> is -1 then the field length is calculated internally using -strlen(bytes). - -The type of field is determined by B<type> which can either be a -definition of the type of B<bytes> (such as B<MBSTRING_ASC>) or a -standard ASN1 type (such as B<V_ASN1_IA5STRING>). The new entry is -added to a position determined by B<loc> and B<set>. - -X509_NAME_add_entry() adds a copy of B<X509_NAME_ENTRY> structure B<ne> -to B<name>. The new entry is added to a position determined by B<loc> -and B<set>. Since a copy of B<ne> is added B<ne> must be freed up after -the call. - -X509_NAME_delete_entry() deletes an entry from B<name> at position -B<loc>. The deleted entry is returned and must be freed up. - -=head1 NOTES - -The use of string types such as B<MBSTRING_ASC> or B<MBSTRING_UTF8> -is strongly recommened for the B<type> parameter. This allows the -internal code to correctly determine the type of the field and to -apply length checks according to the relevant standards. This is -done using ASN1_STRING_set_by_NID(). - -If instead an ASN1 type is used no checks are performed and the -supplied data in B<bytes> is used directly. - -In X509_NAME_add_entry_by_txt() the B<field> string represents -the field name using OBJ_txt2obj(field, 0). - -The B<loc> and B<set> parameters determine where a new entry should -be added. For almost all applications B<loc> can be set to -1 and B<set> -to 0. This adds a new entry to the end of B<name> as a single valued -RelativeDistinguishedName (RDN). - -B<loc> actually determines the index where the new entry is inserted: -if it is -1 it is appended. - -B<set> determines how the new type is added. If it is zero a -new RDN is created. - -If B<set> is -1 or 1 it is added to the previous or next RDN -structure respectively. This will then be a multivalued RDN: -since multivalues RDNs are very seldom used B<set> is almost -always set to zero. - -=head1 EXAMPLES - -Create an B<X509_NAME> structure: - -"C=UK, O=Disorganized Organization, CN=Joe Bloggs" - - X509_NAME *nm; - nm = X509_NAME_new(); - if (nm == NULL) - /* Some error */ - if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, - "C", "UK", -1, -1, 0)) - /* Error */ - if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, - "O", "Disorganized Organization", -1, -1, 0)) - /* Error */ - if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, - "CN", "Joe Bloggs", -1, -1, 0)) - /* Error */ - -=head1 RETURN VALUES - -X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), -X509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for -success of 0 if an error occurred. - -X509_NAME_delete_entry() returns either the deleted B<X509_NAME_ENTRY> -structure of B<NULL> if an error occurred. - -=head1 BUGS - -B<type> can still be set to B<V_ASN1_APP_CHOOSE> to use a -different algorithm to determine field types. Since this form does -not understand multicharacter types, performs no length checks and -can result in invalid field types its use is strongly discouraged. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)> - -=head1 HISTORY - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod b/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod deleted file mode 100644 index 333323d73..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod +++ /dev/null @@ -1,106 +0,0 @@ -=pod - -=head1 NAME - -X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, -X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ - -X509_NAME lookup and enumeration functions - -=head1 SYNOPSIS - -int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); -int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, int lastpos); - -int X509_NAME_entry_count(X509_NAME *name); -X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); - -int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf,int len); -int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,int len); - -=head1 DESCRIPTION - -These functions allow an B<X509_NAME> structure to be examined. The -B<X509_NAME> structure is the same as the B<Name> type defined in -RFC2459 (and elsewhere) and used for example in certificate subject -and issuer names. - -X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() retrieve -the next index matching B<nid> or B<obj> after B<lastpos>. B<lastpos> -should initially be set to -1. If there are no more entries -1 is returned. - -X509_NAME_entry_count() returns the total number of entries in B<name>. - -X509_NAME_get_entry() retrieves the B<X509_NAME_ENTRY> from B<name> -corresponding to index B<loc>. Acceptable values for B<loc> run from -0 to (X509_NAME_entry_count(name) - 1). The value returned is an -internal pointer which must not be freed. - -X509_NAME_get_text_by_NID(), X509_NAME_get_text_by_OBJ() retrieve -the "text" from the first entry in B<name> which matches B<nid> or -B<obj>, if no such entry exists -1 is returned. At most B<len> bytes -will be written and the text written to B<buf> will be null -terminated. The length of the output string written is returned -excluding the terminating null. If B<buf> is <NULL> then the amount -of space needed in B<buf> (excluding the final null) is returned. - -=head1 NOTES - -X509_NAME_get_text_by_NID() and X509_NAME_get_text_by_OBJ() are -legacy functions which have various limitations which make them -of minimal use in practice. They can only find the first matching -entry and will copy the contents of the field verbatim: this can -be highly confusing if the target is a muticharacter string type -like a BMPString or a UTF8String. - -For a more general solution X509_NAME_get_index_by_NID() or -X509_NAME_get_index_by_OBJ() should be used followed by -X509_NAME_get_entry() on any matching indices and then the -various B<X509_NAME_ENTRY> utility functions on the result. - -=head1 EXAMPLES - -Process all entries: - - int i; - X509_NAME_ENTRY *e; - - for (i = 0; i < X509_NAME_entry_count(nm); i++) - { - e = X509_NAME_get_entry(nm, i); - /* Do something with e */ - } - -Process all commonName entries: - - int loc; - X509_NAME_ENTRY *e; - - loc = -1; - for (;;) - { - lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); - if (lastpos == -1) - break; - e = X509_NAME_get_entry(nm, lastpos); - /* Do something with e */ - } - -=head1 RETURN VALUES - -X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() -return the index of the next matching entry or -1 if not found. - -X509_NAME_entry_count() returns the total number of entries. - -X509_NAME_get_entry() returns an B<X509_NAME> pointer to the -requested entry or B<NULL> if the index is invalid. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_print_ex.pod b/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_print_ex.pod deleted file mode 100644 index 2579a5dc9..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/X509_NAME_print_ex.pod +++ /dev/null @@ -1,105 +0,0 @@ -=pod - -=head1 NAME - -X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print, -X509_NAME_oneline - X509_NAME printing routines. - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); - int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); - char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); - int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); - -=head1 DESCRIPTION - -X509_NAME_print_ex() prints a human readable version of B<nm> to BIO B<out>. Each -line (for multiline formats) is indented by B<indent> spaces. The output format -can be extensively customised by use of the B<flags> parameter. - -X509_NAME_print_ex_fp() is identical to X509_NAME_print_ex() except the output is -written to FILE pointer B<fp>. - -X509_NAME_oneline() prints an ASCII version of B<a> to B<buf>. At most B<size> -bytes will be written. If B<buf> is B<NULL> then a buffer is dynamically allocated -and returned, otherwise B<buf> is returned. - -X509_NAME_print() prints out B<name> to B<bp> indenting each line by B<obase> -characters. Multiple lines are used if the output (including indent) exceeds -80 characters. - -=head1 NOTES - -The functions X509_NAME_oneline() and X509_NAME_print() are legacy functions which -produce a non standard output form, they don't handle multi character fields and -have various quirks and inconsistencies. Their use is strongly discouraged in new -applications. - -Although there are a large number of possible flags for most purposes -B<XN_FLAG_ONELINE>, B<XN_FLAG_MULTILINE> or B<XN_FLAG_RFC2253> will suffice. -As noted on the L<ASN1_STRING_print_ex(3)|ASN1_STRING_print_ex(3)> manual page -for UTF8 terminals the B<ASN1_STRFLGS_ESC_MSB> should be unset: so for example -B<XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB> would be used. - -The complete set of the flags supported by X509_NAME_print_ex() is listed below. - -Several options can be ored together. - -The options B<XN_FLAG_SEP_COMMA_PLUS>, B<XN_FLAG_SEP_CPLUS_SPC>, -B<XN_FLAG_SEP_SPLUS_SPC> and B<XN_FLAG_SEP_MULTILINE> determine the field separators -to use. Two distinct separators are used between distinct RelativeDistinguishedName -components and separate values in the same RDN for a multi-valued RDN. Multi-valued -RDNs are currently very rare so the second separator will hardly ever be used. - -B<XN_FLAG_SEP_COMMA_PLUS> uses comma and plus as separators. B<XN_FLAG_SEP_CPLUS_SPC> -uses comma and plus with spaces: this is more readable that plain comma and plus. -B<XN_FLAG_SEP_SPLUS_SPC> uses spaced semicolon and plus. B<XN_FLAG_SEP_MULTILINE> uses -spaced newline and plus respectively. - -If B<XN_FLAG_DN_REV> is set the whole DN is printed in reversed order. - -The fields B<XN_FLAG_FN_SN>, B<XN_FLAG_FN_LN>, B<XN_FLAG_FN_OID>, -B<XN_FLAG_FN_NONE> determine how a field name is displayed. It will -use the short name (e.g. CN) the long name (e.g. commonName) always -use OID numerical form (normally OIDs are only used if the field name is not -recognised) and no field name respectively. - -If B<XN_FLAG_SPC_EQ> is set then spaces will be placed around the '=' character -separating field names and values. - -If B<XN_FLAG_DUMP_UNKNOWN_FIELDS> is set then the encoding of unknown fields is -printed instead of the values. - -If B<XN_FLAG_FN_ALIGN> is set then field names are padded to 20 characters: this -is only of use for multiline format. - -Additionally all the options supported by ASN1_STRING_print_ex() can be used to -control how each field value is displayed. - -In addition a number options can be set for commonly used formats. - -B<XN_FLAG_RFC2253> sets options which produce an output compatible with RFC2253 it -is equivalent to: - B<ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS> - - -B<XN_FLAG_ONELINE> is a more readable one line format which is the same as: - B<ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN> - -B<XN_FLAG_MULTILINE> is a multiline format which is the same as: - B<ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN> - -B<XN_FLAG_COMPAT> uses a format identical to X509_NAME_print(): in fact it calls X509_NAME_print() internally. - -=head1 SEE ALSO - -L<ASN1_STRING_print_ex(3)|ASN1_STRING_print_ex(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/X509_new.pod b/sys/src/ape/lib/openssl/doc/crypto/X509_new.pod deleted file mode 100644 index fd5fc65ce..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/X509_new.pod +++ /dev/null @@ -1,37 +0,0 @@ -=pod - -=head1 NAME - -X509_new, X509_free - X509 certificate ASN1 allocation functions - -=head1 SYNOPSIS - - X509 *X509_new(void); - void X509_free(X509 *a); - -=head1 DESCRIPTION - -The X509 ASN1 allocation routines, allocate and free an -X509 structure, which represents an X509 certificate. - -X509_new() allocates and initializes a X509 structure. - -X509_free() frees up the B<X509> structure B<a>. - -=head1 RETURN VALUES - -If the allocation fails, X509_new() returns B<NULL> and sets an error -code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. -Otherwise it returns a pointer to the newly allocated structure. - -X509_free() returns no value. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -X509_new() and X509_free() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/bio.pod b/sys/src/ape/lib/openssl/doc/crypto/bio.pod deleted file mode 100644 index f9239226f..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/bio.pod +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -=head1 NAME - -bio - I/O abstraction - -=head1 SYNOPSIS - - #include <openssl/bio.h> - -TBA - - -=head1 DESCRIPTION - -A BIO is an I/O abstraction, it hides many of the underlying I/O -details from an application. If an application uses a BIO for its -I/O it can transparently handle SSL connections, unencrypted network -connections and file I/O. - -There are two type of BIO, a source/sink BIO and a filter BIO. - -As its name implies a source/sink BIO is a source and/or sink of data, -examples include a socket BIO and a file BIO. - -A filter BIO takes data from one BIO and passes it through to -another, or the application. The data may be left unmodified (for -example a message digest BIO) or translated (for example an -encryption BIO). The effect of a filter BIO may change according -to the I/O operation it is performing: for example an encryption -BIO will encrypt data if it is being written to and decrypt data -if it is being read from. - -BIOs can be joined together to form a chain (a single BIO is a chain -with one component). A chain normally consist of one source/sink -BIO and one or more filter BIOs. Data read from or written to the -first BIO then traverses the chain to the end (normally a source/sink -BIO). - -=head1 SEE ALSO - -L<BIO_ctrl(3)|BIO_ctrl(3)>, -L<BIO_f_base64(3)|BIO_f_base64(3)>, L<BIO_f_buffer(3)|BIO_f_buffer(3)>, -L<BIO_f_cipher(3)|BIO_f_cipher(3)>, L<BIO_f_md(3)|BIO_f_md(3)>, -L<BIO_f_null(3)|BIO_f_null(3)>, L<BIO_f_ssl(3)|BIO_f_ssl(3)>, -L<BIO_find_type(3)|BIO_find_type(3)>, L<BIO_new(3)|BIO_new(3)>, -L<BIO_new_bio_pair(3)|BIO_new_bio_pair(3)>, -L<BIO_push(3)|BIO_push(3)>, L<BIO_read(3)|BIO_read(3)>, -L<BIO_s_accept(3)|BIO_s_accept(3)>, L<BIO_s_bio(3)|BIO_s_bio(3)>, -L<BIO_s_connect(3)|BIO_s_connect(3)>, L<BIO_s_fd(3)|BIO_s_fd(3)>, -L<BIO_s_file(3)|BIO_s_file(3)>, L<BIO_s_mem(3)|BIO_s_mem(3)>, -L<BIO_s_null(3)|BIO_s_null(3)>, L<BIO_s_socket(3)|BIO_s_socket(3)>, -L<BIO_set_callback(3)|BIO_set_callback(3)>, -L<BIO_should_retry(3)|BIO_should_retry(3)> diff --git a/sys/src/ape/lib/openssl/doc/crypto/blowfish.pod b/sys/src/ape/lib/openssl/doc/crypto/blowfish.pod deleted file mode 100644 index 5b2d274c1..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/blowfish.pod +++ /dev/null @@ -1,112 +0,0 @@ -=pod - -=head1 NAME - -blowfish, BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt, -BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption - -=head1 SYNOPSIS - - #include <openssl/blowfish.h> - - void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - - void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - BF_KEY *key, int enc); - void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, BF_KEY *schedule, unsigned char *ivec, int enc); - void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, BF_KEY *schedule, unsigned char *ivec, int *num, - int enc); - void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, BF_KEY *schedule, unsigned char *ivec, int *num); - const char *BF_options(void); - - void BF_encrypt(BF_LONG *data,const BF_KEY *key); - void BF_decrypt(BF_LONG *data,const BF_KEY *key); - -=head1 DESCRIPTION - -This library implements the Blowfish cipher, which was invented and described -by Counterpane (see http://www.counterpane.com/blowfish.html ). - -Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. -It uses a variable size key, but typically, 128 bit (16 byte) keys are -considered good for strong encryption. Blowfish can be used in the same -modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one -of the faster block ciphers. It is quite a bit faster than DES, and much -faster than IDEA or RC2. - -Blowfish consists of a key setup phase and the actual encryption or decryption -phase. - -BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key -at B<data>. - -BF_ecb_encrypt() is the basic Blowfish encryption and decryption function. -It encrypts or decrypts the first 64 bits of B<in> using the key B<key>, -putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) -or decryption (B<BF_DECRYPT>) shall be performed. The vector pointed at by -B<in> and B<out> must be 64 bits in length, no less. If they are larger, -everything after the first 64 bits is ignored. - -The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() -all operate on variable length data. They all take an initialization vector -B<ivec> which needs to be passed along into the next call of the same function -for the same message. B<ivec> may be initialized with anything, but the -recipient needs to know what it was initialized with, or it won't be able -to decrypt. Some programs and protocols simplify this, like SSH, where -B<ivec> is simply initialized to zero. -BF_cbc_encrypt() operates on data that is a multiple of 8 bytes long, while -BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable -number of bytes (the amount does not have to be an exact multiple of 8). The -purpose of the latter two is to simulate stream ciphers, and therefore, they -need the parameter B<num>, which is a pointer to an integer where the current -offset in B<ivec> is stored between calls. This integer must be initialized -to zero when B<ivec> is initialized. - -BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It -encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>, -putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or -decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte -long initialization vector. - -BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. -It encrypts or decrypts the bytes in B<in> using the key B<schedule>, -putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) -or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an -8 byte long initialization vector. B<num> must point at an integer which must -be initially zero. - -BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. -It uses the same parameters as BF_cfb64_encrypt(), which must be initialized -the same way. - -BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish -encryption. They encrypt/decrypt the first 64 bits of the vector pointed by -B<data>, using the key B<key>. These functions should not be used unless you -implement 'modes' of Blowfish. The alternative is to use BF_ecb_encrypt(). -If you still want to use these functions, you should be aware that they take -each 32-bit chunk in host-byte order, which is little-endian on little-endian -platforms and big-endian on big-endian ones. - -=head1 RETURN VALUES - -None of the functions presented here return any value. - -=head1 NOTE - -Applications should use the higher level functions -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the -blowfish functions directly. - -=head1 SEE ALSO - -L<des_modes(7)|des_modes(7)> - -=head1 HISTORY - -The Blowfish functions are available in all versions of SSLeay and OpenSSL. - -=cut - diff --git a/sys/src/ape/lib/openssl/doc/crypto/bn.pod b/sys/src/ape/lib/openssl/doc/crypto/bn.pod deleted file mode 100644 index cd2f8e50c..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/bn.pod +++ /dev/null @@ -1,181 +0,0 @@ -=pod - -=head1 NAME - -bn - multiprecision integer arithmetics - -=head1 SYNOPSIS - - #include <openssl/bn.h> - - BIGNUM *BN_new(void); - void BN_free(BIGNUM *a); - void BN_init(BIGNUM *); - void BN_clear(BIGNUM *a); - void BN_clear_free(BIGNUM *a); - - BN_CTX *BN_CTX_new(void); - void BN_CTX_init(BN_CTX *c); - void BN_CTX_free(BN_CTX *c); - - BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); - BIGNUM *BN_dup(const BIGNUM *a); - - BIGNUM *BN_swap(BIGNUM *a, BIGNUM *b); - - int BN_num_bytes(const BIGNUM *a); - int BN_num_bits(const BIGNUM *a); - int BN_num_bits_word(BN_ULONG w); - - void BN_set_negative(BIGNUM *a, int n); - int BN_is_negative(const BIGNUM *a); - - int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); - int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); - int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); - int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); - int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, - BN_CTX *ctx); - int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - int BN_nnmod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_add(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - int BN_mod_sub(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); - int BN_mod_sqr(BIGNUM *ret, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); - int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); - - int BN_add_word(BIGNUM *a, BN_ULONG w); - int BN_sub_word(BIGNUM *a, BN_ULONG w); - int BN_mul_word(BIGNUM *a, BN_ULONG w); - BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); - BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); - - int BN_cmp(BIGNUM *a, BIGNUM *b); - int BN_ucmp(BIGNUM *a, BIGNUM *b); - int BN_is_zero(BIGNUM *a); - int BN_is_one(BIGNUM *a); - int BN_is_word(BIGNUM *a, BN_ULONG w); - int BN_is_odd(BIGNUM *a); - - int BN_zero(BIGNUM *a); - int BN_one(BIGNUM *a); - const BIGNUM *BN_value_one(void); - int BN_set_word(BIGNUM *a, unsigned long w); - unsigned long BN_get_word(BIGNUM *a); - - int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); - int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); - int BN_rand_range(BIGNUM *rnd, BIGNUM *range); - int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range); - - BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, - BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); - int BN_is_prime(const BIGNUM *p, int nchecks, - void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg); - - int BN_set_bit(BIGNUM *a, int n); - int BN_clear_bit(BIGNUM *a, int n); - int BN_is_bit_set(const BIGNUM *a, int n); - int BN_mask_bits(BIGNUM *a, int n); - int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); - int BN_lshift1(BIGNUM *r, BIGNUM *a); - int BN_rshift(BIGNUM *r, BIGNUM *a, int n); - int BN_rshift1(BIGNUM *r, BIGNUM *a); - - int BN_bn2bin(const BIGNUM *a, unsigned char *to); - BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); - char *BN_bn2hex(const BIGNUM *a); - char *BN_bn2dec(const BIGNUM *a); - int BN_hex2bn(BIGNUM **a, const char *str); - int BN_dec2bn(BIGNUM **a, const char *str); - int BN_print(BIO *fp, const BIGNUM *a); - int BN_print_fp(FILE *fp, const BIGNUM *a); - int BN_bn2mpi(const BIGNUM *a, unsigned char *to); - BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret); - - BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, - BN_CTX *ctx); - - BN_RECP_CTX *BN_RECP_CTX_new(void); - void BN_RECP_CTX_init(BN_RECP_CTX *recp); - void BN_RECP_CTX_free(BN_RECP_CTX *recp); - int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, - BN_RECP_CTX *recp, BN_CTX *ctx); - - BN_MONT_CTX *BN_MONT_CTX_new(void); - void BN_MONT_CTX_init(BN_MONT_CTX *ctx); - void BN_MONT_CTX_free(BN_MONT_CTX *mont); - int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); - BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); - int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); - int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); - int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); - - BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, - BIGNUM *mod); - void BN_BLINDING_free(BN_BLINDING *b); - int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); - int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); - int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); - int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, - BN_CTX *ctx); - int BN_BLINDING_invert_ex(BIGNUM *n,const BIGNUM *r,BN_BLINDING *b, - BN_CTX *ctx); - unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); - void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); - unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); - void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); - BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -=head1 DESCRIPTION - -This library performs arithmetic operations on integers of arbitrary -size. It was written for use in public key cryptography, such as RSA -and Diffie-Hellman. - -It uses dynamic memory allocation for storing its data structures. -That means that there is no limit on the size of the numbers -manipulated by these functions, but return values must always be -checked in case a memory allocation error has occurred. - -The basic object in this library is a B<BIGNUM>. It is used to hold a -single large integer. This type should be considered opaque and fields -should not be modified or accessed directly. - -The creation of B<BIGNUM> objects is described in L<BN_new(3)|BN_new(3)>; -L<BN_add(3)|BN_add(3)> describes most of the arithmetic operations. -Comparison is described in L<BN_cmp(3)|BN_cmp(3)>; L<BN_zero(3)|BN_zero(3)> -describes certain assignments, L<BN_rand(3)|BN_rand(3)> the generation of -random numbers, L<BN_generate_prime(3)|BN_generate_prime(3)> deals with prime -numbers and L<BN_set_bit(3)|BN_set_bit(3)> with bit operations. The conversion -of B<BIGNUM>s to external formats is described in L<BN_bn2bin(3)|BN_bn2bin(3)>. - -=head1 SEE ALSO - -L<bn_internal(3)|bn_internal(3)>, -L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, -L<BN_new(3)|BN_new(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, -L<BN_copy(3)|BN_copy(3)>, L<BN_swap(3)|BN_swap(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, -L<BN_add(3)|BN_add(3)>, L<BN_add_word(3)|BN_add_word(3)>, -L<BN_cmp(3)|BN_cmp(3)>, L<BN_zero(3)|BN_zero(3)>, L<BN_rand(3)|BN_rand(3)>, -L<BN_generate_prime(3)|BN_generate_prime(3)>, L<BN_set_bit(3)|BN_set_bit(3)>, -L<BN_bn2bin(3)|BN_bn2bin(3)>, L<BN_mod_inverse(3)|BN_mod_inverse(3)>, -L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>, -L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)>, -L<BN_BLINDING_new(3)|BN_BLINDING_new(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/bn_internal.pod b/sys/src/ape/lib/openssl/doc/crypto/bn_internal.pod deleted file mode 100644 index 891914678..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/bn_internal.pod +++ /dev/null @@ -1,226 +0,0 @@ -=pod - -=head1 NAME - -bn_mul_words, bn_mul_add_words, bn_sqr_words, bn_div_words, -bn_add_words, bn_sub_words, bn_mul_comba4, bn_mul_comba8, -bn_sqr_comba4, bn_sqr_comba8, bn_cmp_words, bn_mul_normal, -bn_mul_low_normal, bn_mul_recursive, bn_mul_part_recursive, -bn_mul_low_recursive, bn_mul_high, bn_sqr_normal, bn_sqr_recursive, -bn_expand, bn_wexpand, bn_expand2, bn_fix_top, bn_check_top, -bn_print, bn_dump, bn_set_max, bn_set_high, bn_set_low - BIGNUM -library internal functions - -=head1 SYNOPSIS - - BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); - BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, - BN_ULONG w); - void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); - BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); - BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, - int num); - BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, - int num); - - void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); - void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); - void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a); - void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a); - - int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n); - - void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, - int nb); - void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n); - void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, - int dna,int dnb,BN_ULONG *tmp); - void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, - int n, int tna,int tnb, BN_ULONG *tmp); - void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, - int n2, BN_ULONG *tmp); - void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, - int n2, BN_ULONG *tmp); - - void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp); - void bn_sqr_recursive(BN_ULONG *r, BN_ULONG *a, int n2, BN_ULONG *tmp); - - void mul(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c); - void mul_add(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c); - void sqr(BN_ULONG r0, BN_ULONG r1, BN_ULONG a); - - BIGNUM *bn_expand(BIGNUM *a, int bits); - BIGNUM *bn_wexpand(BIGNUM *a, int n); - BIGNUM *bn_expand2(BIGNUM *a, int n); - void bn_fix_top(BIGNUM *a); - - void bn_check_top(BIGNUM *a); - void bn_print(BIGNUM *a); - void bn_dump(BN_ULONG *d, int n); - void bn_set_max(BIGNUM *a); - void bn_set_high(BIGNUM *r, BIGNUM *a, int n); - void bn_set_low(BIGNUM *r, BIGNUM *a, int n); - -=head1 DESCRIPTION - -This page documents the internal functions used by the OpenSSL -B<BIGNUM> implementation. They are described here to facilitate -debugging and extending the library. They are I<not> to be used by -applications. - -=head2 The BIGNUM structure - - typedef struct bignum_st - { - int top; /* number of words used in d */ - BN_ULONG *d; /* pointer to an array containing the integer value */ - int max; /* size of the d array */ - int neg; /* sign */ - } BIGNUM; - -The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>), -least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits -in size, depending on the 'number of bits' (B<BITS2>) specified in -C<openssl/bn.h>. - -B<max> is the size of the B<d> array that has been allocated. B<top> -is the number of words being used, so for a value of 4, bn.d[0]=4 and -bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is -B<0>, the B<d> field can be B<NULL> and B<top> == B<0>. - -Various routines in this library require the use of temporary -B<BIGNUM> variables during their execution. Since dynamic memory -allocation to create B<BIGNUM>s is rather expensive when used in -conjunction with repeated subroutine calls, the B<BN_CTX> structure is -used. This structure contains B<BN_CTX_NUM> B<BIGNUM>s, see -L<BN_CTX_start(3)|BN_CTX_start(3)>. - -=head2 Low-level arithmetic operations - -These functions are implemented in C and for several platforms in -assembly language: - -bn_mul_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> word -arrays B<rp> and B<ap>. It computes B<ap> * B<w>, places the result -in B<rp>, and returns the high word (carry). - -bn_mul_add_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> -word arrays B<rp> and B<ap>. It computes B<ap> * B<w> + B<rp>, places -the result in B<rp>, and returns the high word (carry). - -bn_sqr_words(B<rp>, B<ap>, B<n>) operates on the B<num> word array -B<ap> and the 2*B<num> word array B<ap>. It computes B<ap> * B<ap> -word-wise, and places the low and high bytes of the result in B<rp>. - -bn_div_words(B<h>, B<l>, B<d>) divides the two word number (B<h>,B<l>) -by B<d> and returns the result. - -bn_add_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word -arrays B<ap>, B<bp> and B<rp>. It computes B<ap> + B<bp>, places the -result in B<rp>, and returns the high word (carry). - -bn_sub_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word -arrays B<ap>, B<bp> and B<rp>. It computes B<ap> - B<bp>, places the -result in B<rp>, and returns the carry (1 if B<bp> E<gt> B<ap>, 0 -otherwise). - -bn_mul_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and -B<b> and the 8 word array B<r>. It computes B<a>*B<b> and places the -result in B<r>. - -bn_mul_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and -B<b> and the 16 word array B<r>. It computes B<a>*B<b> and places the -result in B<r>. - -bn_sqr_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and -B<b> and the 8 word array B<r>. - -bn_sqr_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and -B<b> and the 16 word array B<r>. - -The following functions are implemented in C: - -bn_cmp_words(B<a>, B<b>, B<n>) operates on the B<n> word arrays B<a> -and B<b>. It returns 1, 0 and -1 if B<a> is greater than, equal and -less than B<b>. - -bn_mul_normal(B<r>, B<a>, B<na>, B<b>, B<nb>) operates on the B<na> -word array B<a>, the B<nb> word array B<b> and the B<na>+B<nb> word -array B<r>. It computes B<a>*B<b> and places the result in B<r>. - -bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word -arrays B<r>, B<a> and B<b>. It computes the B<n> low words of -B<a>*B<b> and places the result in B<r>. - -bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<dna>, B<dnb>, B<t>) operates -on the word arrays B<a> and B<b> of length B<n2>+B<dna> and B<n2>+B<dnb> -(B<dna> and B<dnb> are currently allowed to be 0 or negative) and the 2*B<n2> -word arrays B<r> and B<t>. B<n2> must be a power of 2. It computes -B<a>*B<b> and places the result in B<r>. - -bn_mul_part_recursive(B<r>, B<a>, B<b>, B<n>, B<tna>, B<tnb>, B<tmp>) -operates on the word arrays B<a> and B<b> of length B<n>+B<tna> and -B<n>+B<tnb> and the 4*B<n> word arrays B<r> and B<tmp>. - -bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the -B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a> -and B<b>. - -bn_mul_high(B<r>, B<a>, B<b>, B<l>, B<n2>, B<tmp>) operates on the -B<n2> word arrays B<r>, B<a>, B<b> and B<l> (?) and the 3*B<n2> word -array B<tmp>. - -BN_mul() calls bn_mul_normal(), or an optimized implementation if the -factors have the same size: bn_mul_comba8() is used if they are 8 -words long, bn_mul_recursive() if they are larger than -B<BN_MULL_SIZE_NORMAL> and the size is an exact multiple of the word -size, and bn_mul_part_recursive() for others that are larger than -B<BN_MULL_SIZE_NORMAL>. - -bn_sqr_normal(B<r>, B<a>, B<n>, B<tmp>) operates on the B<n> word array -B<a> and the 2*B<n> word arrays B<tmp> and B<r>. - -The implementations use the following macros which, depending on the -architecture, may use "long long" C operations or inline assembler. -They are defined in C<bn_lcl.h>. - -mul(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<c> and places the -low word of the result in B<r> and the high word in B<c>. - -mul_add(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<r>+B<c> and -places the low word of the result in B<r> and the high word in B<c>. - -sqr(B<r0>, B<r1>, B<a>) computes B<a>*B<a> and places the low word -of the result in B<r0> and the high word in B<r1>. - -=head2 Size changes - -bn_expand() ensures that B<b> has enough space for a B<bits> bit -number. bn_wexpand() ensures that B<b> has enough space for an -B<n> word number. If the number has to be expanded, both macros -call bn_expand2(), which allocates a new B<d> array and copies the -data. They return B<NULL> on error, B<b> otherwise. - -The bn_fix_top() macro reduces B<a-E<gt>top> to point to the most -significant non-zero word plus one when B<a> has shrunk. - -=head2 Debugging - -bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top -E<lt>= (a)-E<gt>max)>. A violation will cause the program to abort. - -bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d> -(in reverse order, i.e. most significant word first) to stderr. - -bn_set_max() makes B<a> a static number with a B<max> of its current size. -This is used by bn_set_low() and bn_set_high() to make B<r> a read-only -B<BIGNUM> that contains the B<n> low or high words of B<a>. - -If B<BN_DEBUG> is not defined, bn_check_top(), bn_print(), bn_dump() -and bn_set_max() are defined as empty macros. - -=head1 SEE ALSO - -L<bn(3)|bn(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/buffer.pod b/sys/src/ape/lib/openssl/doc/crypto/buffer.pod deleted file mode 100644 index 781f5b11e..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/buffer.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple -character arrays structure - -=head1 SYNOPSIS - - #include <openssl/buffer.h> - - BUF_MEM *BUF_MEM_new(void); - - void BUF_MEM_free(BUF_MEM *a); - - int BUF_MEM_grow(BUF_MEM *str, int len); - - char * BUF_strdup(const char *str); - -=head1 DESCRIPTION - -The buffer library handles simple character arrays. Buffers are used for -various purposes in the library, most notably memory BIOs. - -The library uses the BUF_MEM structure defined in buffer.h: - - typedef struct buf_mem_st - { - int length; /* current number of bytes */ - char *data; - int max; /* size of buffer */ - } BUF_MEM; - -B<length> is the current size of the buffer in bytes, B<max> is the amount of -memory allocated to the buffer. There are three functions which handle these -and one "miscellaneous" function. - -BUF_MEM_new() allocates a new buffer of zero size. - -BUF_MEM_free() frees up an already existing buffer. The data is zeroed -before freeing up in case the buffer contains sensitive data. - -BUF_MEM_grow() changes the size of an already existing buffer to -B<len>. Any data already in the buffer is preserved if it increases in -size. - -BUF_strdup() copies a null terminated string into a block of allocated -memory and returns a pointer to the allocated block. -Unlike the standard C library strdup() this function uses OPENSSL_malloc() and so -should be used in preference to the standard library strdup() because it can -be used for memory leak checking or replacing the malloc() function. - -The memory allocated from BUF_strdup() should be freed up using the OPENSSL_free() -function. - -=head1 RETURN VALUES - -BUF_MEM_new() returns the buffer or NULL on error. - -BUF_MEM_free() has no return value. - -BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>). - -=head1 SEE ALSO - -L<bio(3)|bio(3)> - -=head1 HISTORY - -BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all -versions of SSLeay and OpenSSL. BUF_strdup() was added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/crypto.pod b/sys/src/ape/lib/openssl/doc/crypto/crypto.pod deleted file mode 100644 index 7a527992b..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/crypto.pod +++ /dev/null @@ -1,85 +0,0 @@ -=pod - -=head1 NAME - -crypto - OpenSSL cryptographic library - -=head1 SYNOPSIS - -=head1 DESCRIPTION - -The OpenSSL B<crypto> library implements a wide range of cryptographic -algorithms used in various Internet standards. The services provided -by this library are used by the OpenSSL implementations of SSL, TLS -and S/MIME, and they have also been used to implement SSH, OpenPGP, and -other cryptographic standards. - -=head1 OVERVIEW - -B<libcrypto> consists of a number of sub-libraries that implement the -individual algorithms. - -The functionality includes symmetric encryption, public key -cryptography and key agreement, certificate handling, cryptographic -hash functions and a cryptographic pseudo-random number generator. - -=over 4 - -=item SYMMETRIC CIPHERS - -L<blowfish(3)|blowfish(3)>, L<cast(3)|cast(3)>, L<des(3)|des(3)>, -L<idea(3)|idea(3)>, L<rc2(3)|rc2(3)>, L<rc4(3)|rc4(3)>, L<rc5(3)|rc5(3)> - -=item PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT - -L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rsa(3)|rsa(3)> - -=item CERTIFICATES - -L<x509(3)|x509(3)>, L<x509v3(3)|x509v3(3)> - -=item AUTHENTICATION CODES, HASH FUNCTIONS - -L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, L<md4(3)|md4(3)>, -L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, -L<sha(3)|sha(3)> - -=item AUXILIARY FUNCTIONS - -L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)>, -L<OPENSSL_VERSION_NUMBER(3)|OPENSSL_VERSION_NUMBER(3)> - -=item INPUT/OUTPUT, DATA ENCODING - -L<asn1(3)|asn1(3)>, L<bio(3)|bio(3)>, L<evp(3)|evp(3)>, L<pem(3)|pem(3)>, -L<pkcs7(3)|pkcs7(3)>, L<pkcs12(3)|pkcs12(3)> - -=item INTERNAL FUNCTIONS - -L<bn(3)|bn(3)>, L<buffer(3)|buffer(3)>, L<lhash(3)|lhash(3)>, -L<objects(3)|objects(3)>, L<stack(3)|stack(3)>, -L<txt_db(3)|txt_db(3)> - -=back - -=head1 NOTES - -Some of the newer functions follow a naming convention using the numbers -B<0> and B<1>. For example the functions: - - int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); - int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); - -The B<0> version uses the supplied structure pointer directly -in the parent and it will be freed up when the parent is freed. -In the above example B<crl> would be freed but B<rev> would not. - -The B<1> function uses a copy of the supplied structure pointer -(or in some cases increases its link count) in the parent and -so both (B<x> and B<obj> above) should be freed up. - -=head1 SEE ALSO - -L<openssl(1)|openssl(1)>, L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_ASN1_OBJECT.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_ASN1_OBJECT.pod deleted file mode 100644 index 45bb18492..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_ASN1_OBJECT.pod +++ /dev/null @@ -1,29 +0,0 @@ -=pod - -=head1 NAME - -d2i_ASN1_OBJECT, i2d_ASN1_OBJECT - ASN1 OBJECT IDENTIFIER functions - -=head1 SYNOPSIS - - #include <openssl/objects.h> - - ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp, long length); - int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp); - -=head1 DESCRIPTION - -These functions decode and encode an ASN1 OBJECT IDENTIFIER. - -Othewise these behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_DHparams.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_DHparams.pod deleted file mode 100644 index 1e98aebec..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_DHparams.pod +++ /dev/null @@ -1,30 +0,0 @@ -=pod - -=head1 NAME - -d2i_DHparams, i2d_DHparams - PKCS#3 DH parameter functions. - -=head1 SYNOPSIS - - #include <openssl/dh.h> - - DH *d2i_DHparams(DH **a, unsigned char **pp, long length); - int i2d_DHparams(DH *a, unsigned char **pp); - -=head1 DESCRIPTION - -These functions decode and encode PKCS#3 DH parameters using the -DHparameter structure described in PKCS#3. - -Othewise these behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_DSAPublicKey.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_DSAPublicKey.pod deleted file mode 100644 index 22c1b50f2..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_DSAPublicKey.pod +++ /dev/null @@ -1,83 +0,0 @@ -=pod - -=head1 NAME - -d2i_DSAPublicKey, i2d_DSAPublicKey, d2i_DSAPrivateKey, i2d_DSAPrivateKey, -d2i_DSA_PUBKEY, i2d_DSA_PUBKEY, d2i_DSA_SIG, i2d_DSA_SIG - DSA key encoding -and parsing functions. - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - #include <openssl/x509.h> - - DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); - - int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); - - DSA * d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); - - int i2d_DSA_PUBKEY(const DSA *a, unsigned char **pp); - - DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); - - int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); - - DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); - - int i2d_DSAparams(const DSA *a, unsigned char **pp); - - DSA * d2i_DSA_SIG(DSA_SIG **a, const unsigned char **pp, long length); - - int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); - -=head1 DESCRIPTION - -d2i_DSAPublicKey() and i2d_DSAPublicKey() decode and encode the DSA public key -components structure. - -d2i_DSA_PUBKEY() and i2d_DSA_PUBKEY() decode and encode an DSA public key using -a SubjectPublicKeyInfo (certificate public key) structure. - -d2i_DSAPrivateKey(), i2d_DSAPrivateKey() decode and encode the DSA private key -components. - -d2i_DSAparams(), i2d_DSAparams() decode and encode the DSA parameters using -a B<Dss-Parms> structure as defined in RFC2459. - -d2i_DSA_SIG(), i2d_DSA_SIG() decode and encode a DSA signature using a -B<Dss-Sig-Value> structure as defined in RFC2459. - -The usage of all of these functions is similar to the d2i_X509() and -i2d_X509() described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 NOTES - -The B<DSA> structure passed to the private key encoding functions should have -all the private key components present. - -The data encoded by the private key functions is unencrypted and therefore -offers no private key security. - -The B<DSA_PUBKEY> functions should be used in preference to the B<DSAPublicKey> -functions when encoding public keys because they use a standard format. - -The B<DSAPublicKey> functions use an non standard format the actual data encoded -depends on the value of the B<write_params> field of the B<a> key parameter. -If B<write_params> is zero then only the B<pub_key> field is encoded as an -B<INTEGER>. If B<write_params> is 1 then a B<SEQUENCE> consisting of the -B<p>, B<q>, B<g> and B<pub_key> respectively fields are encoded. - -The B<DSAPrivateKey> functions also use a non standard structure consiting -consisting of a SEQUENCE containing the B<p>, B<q>, B<g> and B<pub_key> and -B<priv_key> fields respectively. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_PKCS8PrivateKey.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_PKCS8PrivateKey.pod deleted file mode 100644 index a54b77908..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_PKCS8PrivateKey.pod +++ /dev/null @@ -1,56 +0,0 @@ -=pod - -=head1 NAME - -d2i_PKCS8PrivateKey_bio, d2i_PKCS8PrivateKey_fp, -i2d_PKCS8PrivateKey_bio, i2d_PKCS8PrivateKey_fp, -i2d_PKCS8PrivateKey_nid_bio, i2d_PKCS8PrivateKey_nid_fp - PKCS#8 format private key functions - -=head1 SYNOPSIS - - #include <openssl/evp.h> - - EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); - EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); - - int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - -=head1 DESCRIPTION - -The PKCS#8 functions encode and decode private keys in PKCS#8 format using both -PKCS#5 v1.5 and PKCS#5 v2.0 password based encryption algorithms. - -Other than the use of DER as opposed to PEM these functions are identical to the -corresponding B<PEM> function as described in the L<pem(3)|pem(3)> manual page. - -=head1 NOTES - -Before using these functions L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)> -should be called to initialize the internal algorithm lookup tables otherwise errors about -unknown algorithms will occur if an attempt is made to decrypt a private key. - -These functions are currently the only way to store encrypted private keys using DER format. - -Currently all the functions use BIOs or FILE pointers, there are no functions which -work directly on memory: this can be readily worked around by converting the buffers -to memory BIOs, see L<BIO_s_mem(3)|BIO_s_mem(3)> for details. - -=head1 SEE ALSO - -L<pem(3)|pem(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_RSAPublicKey.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_RSAPublicKey.pod deleted file mode 100644 index 279b29c87..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_RSAPublicKey.pod +++ /dev/null @@ -1,67 +0,0 @@ -=pod - -=head1 NAME - -d2i_RSAPublicKey, i2d_RSAPublicKey, d2i_RSAPrivateKey, i2d_RSAPrivateKey, -d2i_RSA_PUBKEY, i2d_RSA_PUBKEY, i2d_Netscape_RSA, -d2i_Netscape_RSA - RSA public and private key encoding functions. - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - #include <openssl/x509.h> - - RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length); - - int i2d_RSAPublicKey(RSA *a, unsigned char **pp); - - RSA * d2i_RSA_PUBKEY(RSA **a, unsigned char **pp, long length); - - int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); - - RSA * d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length); - - int i2d_RSAPrivateKey(RSA *a, unsigned char **pp); - - int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); - - RSA * d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); - -=head1 DESCRIPTION - -d2i_RSAPublicKey() and i2d_RSAPublicKey() decode and encode a PKCS#1 RSAPublicKey -structure. - -d2i_RSA_PUBKEY() and i2d_RSA_PUBKEY() decode and encode an RSA public key using -a SubjectPublicKeyInfo (certificate public key) structure. - -d2i_RSAPrivateKey(), i2d_RSAPrivateKey() decode and encode a PKCS#1 RSAPrivateKey -structure. - -d2i_Netscape_RSA(), i2d_Netscape_RSA() decode and encode an RSA private key in -NET format. - -The usage of all of these functions is similar to the d2i_X509() and -i2d_X509() described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 NOTES - -The B<RSA> structure passed to the private key encoding functions should have -all the PKCS#1 private key components present. - -The data encoded by the private key functions is unencrypted and therefore -offers no private key security. - -The NET format functions are present to provide compatibility with certain very -old software. This format has some severe security weaknesses and should be -avoided if possible. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509.pod deleted file mode 100644 index 5bfa18afb..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509.pod +++ /dev/null @@ -1,231 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio, -i2d_X509_fp - X509 encode and decode functions - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509 *d2i_X509(X509 **px, const unsigned char **in, int len); - int i2d_X509(X509 *x, unsigned char **out); - - X509 *d2i_X509_bio(BIO *bp, X509 **x); - X509 *d2i_X509_fp(FILE *fp, X509 **x); - - int i2d_X509_bio(X509 *x, BIO *bp); - int i2d_X509_fp(X509 *x, FILE *fp); - -=head1 DESCRIPTION - -The X509 encode and decode routines encode and parse an -B<X509> structure, which represents an X509 certificate. - -d2i_X509() attempts to decode B<len> bytes at B<*in>. If -successful a pointer to the B<X509> structure is returned. If an error -occurred then B<NULL> is returned. If B<px> is not B<NULL> then the -returned structure is written to B<*px>. If B<*px> is not B<NULL> -then it is assumed that B<*px> contains a valid B<X509> -structure and an attempt is made to reuse it. If the call is -successful B<*in> is incremented to the byte following the -parsed data. - -i2d_X509() encodes the structure pointed to by B<x> into DER format. -If B<out> is not B<NULL> is writes the DER encoded data to the buffer -at B<*out>, and increments it to point after the data just written. -If the return value is negative an error occurred, otherwise it -returns the length of the encoded data. - -For OpenSSL 0.9.7 and later if B<*out> is B<NULL> memory will be -allocated for a buffer and the encoded data written to it. In this -case B<*out> is not incremented and it points to the start of the -data just written. - -d2i_X509_bio() is similar to d2i_X509() except it attempts -to parse data from BIO B<bp>. - -d2i_X509_fp() is similar to d2i_X509() except it attempts -to parse data from FILE pointer B<fp>. - -i2d_X509_bio() is similar to i2d_X509() except it writes -the encoding of the structure B<x> to BIO B<bp> and it -returns 1 for success and 0 for failure. - -i2d_X509_fp() is similar to i2d_X509() except it writes -the encoding of the structure B<x> to BIO B<bp> and it -returns 1 for success and 0 for failure. - -=head1 NOTES - -The letters B<i> and B<d> in for example B<i2d_X509> stand for -"internal" (that is an internal C structure) and "DER". So that -B<i2d_X509> converts from internal to DER. - -The functions can also understand B<BER> forms. - -The actual X509 structure passed to i2d_X509() must be a valid -populated B<X509> structure it can B<not> simply be fed with an -empty structure such as that returned by X509_new(). - -The encoded data is in binary form and may contain embedded zeroes. -Therefore any FILE pointers or BIOs should be opened in binary mode. -Functions such as B<strlen()> will B<not> return the correct length -of the encoded structure. - -The ways that B<*in> and B<*out> are incremented after the operation -can trap the unwary. See the B<WARNINGS> section for some common -errors. - -The reason for the auto increment behaviour is to reflect a typical -usage of ASN1 functions: after one structure is encoded or decoded -another will processed after it. - -=head1 EXAMPLES - -Allocate and encode the DER encoding of an X509 structure: - - int len; - unsigned char *buf, *p; - - len = i2d_X509(x, NULL); - - buf = OPENSSL_malloc(len); - - if (buf == NULL) - /* error */ - - p = buf; - - i2d_X509(x, &p); - -If you are using OpenSSL 0.9.7 or later then this can be -simplified to: - - - int len; - unsigned char *buf; - - buf = NULL; - - len = i2d_X509(x, &buf); - - if (len < 0) - /* error */ - -Attempt to decode a buffer: - - X509 *x; - - unsigned char *buf, *p; - - int len; - - /* Something to setup buf and len */ - - p = buf; - - x = d2i_X509(NULL, &p, len); - - if (x == NULL) - /* Some error */ - -Alternative technique: - - X509 *x; - - unsigned char *buf, *p; - - int len; - - /* Something to setup buf and len */ - - p = buf; - - x = NULL; - - if(!d2i_X509(&x, &p, len)) - /* Some error */ - - -=head1 WARNINGS - -The use of temporary variable is mandatory. A common -mistake is to attempt to use a buffer directly as follows: - - int len; - unsigned char *buf; - - len = i2d_X509(x, NULL); - - buf = OPENSSL_malloc(len); - - if (buf == NULL) - /* error */ - - i2d_X509(x, &buf); - - /* Other stuff ... */ - - OPENSSL_free(buf); - -This code will result in B<buf> apparently containing garbage because -it was incremented after the call to point after the data just written. -Also B<buf> will no longer contain the pointer allocated by B<OPENSSL_malloc()> -and the subsequent call to B<OPENSSL_free()> may well crash. - -The auto allocation feature (setting buf to NULL) only works on OpenSSL -0.9.7 and later. Attempts to use it on earlier versions will typically -cause a segmentation violation. - -Another trap to avoid is misuse of the B<xp> argument to B<d2i_X509()>: - - X509 *x; - - if (!d2i_X509(&x, &p, len)) - /* Some error */ - -This will probably crash somewhere in B<d2i_X509()>. The reason for this -is that the variable B<x> is uninitialized and an attempt will be made to -interpret its (invalid) value as an B<X509> structure, typically causing -a segmentation violation. If B<x> is set to NULL first then this will not -happen. - -=head1 BUGS - -In some versions of OpenSSL the "reuse" behaviour of d2i_X509() when -B<*px> is valid is broken and some parts of the reused structure may -persist if they are not present in the new one. As a result the use -of this "reuse" behaviour is strongly discouraged. - -i2d_X509() will not return an error in many versions of OpenSSL, -if mandatory fields are not initialized due to a programming error -then the encoded structure may contain invalid data or omit the -fields entirely and will not be parsed by d2i_X509(). This may be -fixed in future so code should not assume that i2d_X509() will -always succeed. - -=head1 RETURN VALUES - -d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B<X509> structure -or B<NULL> if an error occurs. The error code that can be obtained by -L<ERR_get_error(3)|ERR_get_error(3)>. - -i2d_X509(), i2d_X509_bio() and i2d_X509_fp() return a the number of bytes -successfully encoded or a negative value if an error occurs. The error code -can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -i2d_X509_bio() and i2d_X509_fp() returns 1 for success and 0 if an error -occurs The error code can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 SEE ALSO - -L<ERR_get_error(3)|ERR_get_error(3)> - -=head1 HISTORY - -d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio and i2d_X509_fp -are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_ALGOR.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_ALGOR.pod deleted file mode 100644 index 9e5cd92ca..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_ALGOR.pod +++ /dev/null @@ -1,30 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509_ALGOR, i2d_X509_ALGOR - AlgorithmIdentifier functions. - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, unsigned char **pp, long length); - int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **pp); - -=head1 DESCRIPTION - -These functions decode and encode an B<X509_ALGOR> structure which is -equivalent to the B<AlgorithmIdentifier> structure. - -Othewise these behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_CRL.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_CRL.pod deleted file mode 100644 index e7295a5d6..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_CRL.pod +++ /dev/null @@ -1,37 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509_CRL, i2d_X509_CRL, d2i_X509_CRL_bio, d2i_509_CRL_fp, -i2d_X509_CRL_bio, i2d_X509_CRL_fp - PKCS#10 certificate request functions. - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509_CRL *d2i_X509_CRL(X509_CRL **a, const unsigned char **pp, long length); - int i2d_X509_CRL(X509_CRL *a, unsigned char **pp); - - X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); - X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **x); - - int i2d_X509_CRL_bio(X509_CRL *x, BIO *bp); - int i2d_X509_CRL_fp(X509_CRL *x, FILE *fp); - -=head1 DESCRIPTION - -These functions decode and encode an X509 CRL (certificate revocation -list). - -Othewise the functions behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_NAME.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_NAME.pod deleted file mode 100644 index 343ffe151..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_NAME.pod +++ /dev/null @@ -1,31 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509_NAME, i2d_X509_NAME - X509_NAME encoding functions - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length); - int i2d_X509_NAME(X509_NAME *a, unsigned char **pp); - -=head1 DESCRIPTION - -These functions decode and encode an B<X509_NAME> structure which is the -the same as the B<Name> type defined in RFC2459 (and elsewhere) and used -for example in certificate subject and issuer names. - -Othewise the functions behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_REQ.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_REQ.pod deleted file mode 100644 index ae32a3891..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_REQ.pod +++ /dev/null @@ -1,36 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509_REQ, i2d_X509_REQ, d2i_X509_REQ_bio, d2i_X509_REQ_fp, -i2d_X509_REQ_bio, i2d_X509_REQ_fp - PKCS#10 certificate request functions. - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **pp, long length); - int i2d_X509_REQ(X509_REQ *a, unsigned char **pp); - - X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); - X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **x); - - int i2d_X509_REQ_bio(X509_REQ *x, BIO *bp); - int i2d_X509_REQ_fp(X509_REQ *x, FILE *fp); - -=head1 DESCRIPTION - -These functions decode and encode a PKCS#10 certificate request. - -Othewise these behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_SIG.pod b/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_SIG.pod deleted file mode 100644 index e48fd79a5..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/d2i_X509_SIG.pod +++ /dev/null @@ -1,30 +0,0 @@ -=pod - -=head1 NAME - -d2i_X509_SIG, i2d_X509_SIG - DigestInfo functions. - -=head1 SYNOPSIS - - #include <openssl/x509.h> - - X509_SIG *d2i_X509_SIG(X509_SIG **a, unsigned char **pp, long length); - int i2d_X509_SIG(X509_SIG *a, unsigned char **pp); - -=head1 DESCRIPTION - -These functions decode and encode an X509_SIG structure which is -equivalent to the B<DigestInfo> structure defined in PKCS#1 and PKCS#7. - -Othewise these behave in a similar way to d2i_X509() and i2d_X509() -described in the L<d2i_X509(3)|d2i_X509(3)> manual page. - -=head1 SEE ALSO - -L<d2i_X509(3)|d2i_X509(3)> - -=head1 HISTORY - -TBA - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/des.pod b/sys/src/ape/lib/openssl/doc/crypto/des.pod deleted file mode 100644 index 6f0cf1cc5..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/des.pod +++ /dev/null @@ -1,358 +0,0 @@ -=pod - -=head1 NAME - -DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked, -DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key, -DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt, -DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt, -DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt, -DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt, -DES_ede3_cbcm_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt, -DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys, -DES_fcrypt, DES_crypt, DES_enc_read, DES_enc_write - DES encryption - -=head1 SYNOPSIS - - #include <openssl/des.h> - - void DES_random_key(DES_cblock *ret); - - int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); - int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); - int DES_set_key_checked(const_DES_cblock *key, - DES_key_schedule *schedule); - void DES_set_key_unchecked(const_DES_cblock *key, - DES_key_schedule *schedule); - - void DES_set_odd_parity(DES_cblock *key); - int DES_is_weak_key(const_DES_cblock *key); - - void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc); - void DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, int enc); - void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); - - void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - int enc); - void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); - void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *schedule, - DES_cblock *ivec); - void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - int enc); - void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - int *num, int enc); - void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - int *num); - - void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - const_DES_cblock *inw, const_DES_cblock *outw, int enc); - - void DES_ede2_cbc_encrypt(const unsigned char *input, - unsigned char *output, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_cblock *ivec, int enc); - void DES_ede2_cfb64_encrypt(const unsigned char *in, - unsigned char *out, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_cblock *ivec, int *num, int enc); - void DES_ede2_ofb64_encrypt(const unsigned char *in, - unsigned char *out, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_cblock *ivec, int *num); - - void DES_ede3_cbc_encrypt(const unsigned char *input, - unsigned char *output, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, - int enc); - void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, - int enc); - void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc); - void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num); - - DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec); - DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed); - void DES_string_to_key(const char *str, DES_cblock *key); - void DES_string_to_2keys(const char *str, DES_cblock *key1, - DES_cblock *key2); - - char *DES_fcrypt(const char *buf, const char *salt, char *ret); - char *DES_crypt(const char *buf, const char *salt); - - int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, - DES_cblock *iv); - int DES_enc_write(int fd, const void *buf, int len, - DES_key_schedule *sched, DES_cblock *iv); - -=head1 DESCRIPTION - -This library contains a fast implementation of the DES encryption -algorithm. - -There are two phases to the use of DES encryption. The first is the -generation of a I<DES_key_schedule> from a key, the second is the -actual encryption. A DES key is of type I<DES_cblock>. This type is -consists of 8 bytes with odd parity. The least significant bit in -each byte is the parity bit. The key schedule is an expanded form of -the key; it is used to speed the encryption process. - -DES_random_key() generates a random key. The PRNG must be seeded -prior to using this function (see L<rand(3)|rand(3)>). If the PRNG -could not generate a secure key, 0 is returned. - -Before a DES key can be used, it must be converted into the -architecture dependent I<DES_key_schedule> via the -DES_set_key_checked() or DES_set_key_unchecked() function. - -DES_set_key_checked() will check that the key passed is of odd parity -and is not a week or semi-weak key. If the parity is wrong, then -1 -is returned. If the key is a weak key, then -2 is returned. If an -error is returned, the key schedule is not generated. - -DES_set_key() works like -DES_set_key_checked() if the I<DES_check_key> flag is non-zero, -otherwise like DES_set_key_unchecked(). These functions are available -for compatibility; it is recommended to use a function that does not -depend on a global variable. - -DES_set_odd_parity() sets the parity of the passed I<key> to odd. - -DES_is_weak_key() returns 1 is the passed key is a weak key, 0 if it -is ok. The probability that a randomly generated key is weak is -1/2^52, so it is not really worth checking for them. - -The following routines mostly operate on an input and output stream of -I<DES_cblock>s. - -DES_ecb_encrypt() is the basic DES encryption routine that encrypts or -decrypts a single 8-byte I<DES_cblock> in I<electronic code book> -(ECB) mode. It always transforms the input data, pointed to by -I<input>, into the output data, pointed to by the I<output> argument. -If the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input> -(cleartext) is encrypted in to the I<output> (ciphertext) using the -key_schedule specified by the I<schedule> argument, previously set via -I<DES_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now -ciphertext) is decrypted into the I<output> (now cleartext). Input -and output may overlap. DES_ecb_encrypt() does not return a value. - -DES_ecb3_encrypt() encrypts/decrypts the I<input> block by using -three-key Triple-DES encryption in ECB mode. This involves encrypting -the input with I<ks1>, decrypting with the key schedule I<ks2>, and -then encrypting with I<ks3>. This routine greatly reduces the chances -of brute force breaking of DES and has the advantage of if I<ks1>, -I<ks2> and I<ks3> are the same, it is equivalent to just encryption -using ECB mode and I<ks1> as the key. - -The macro DES_ecb2_encrypt() is provided to perform two-key Triple-DES -encryption by using I<ks1> for the final encryption. - -DES_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining> -(CBC) mode of DES. If the I<encrypt> argument is non-zero, the -routine cipher-block-chain encrypts the cleartext data pointed to by -the I<input> argument into the ciphertext pointed to by the I<output> -argument, using the key schedule provided by the I<schedule> argument, -and initialization vector provided by the I<ivec> argument. If the -I<length> argument is not an integral multiple of eight bytes, the -last block is copied to a temporary area and zero filled. The output -is always an integral multiple of eight bytes. - -DES_xcbc_encrypt() is RSA's DESX mode of DES. It uses I<inw> and -I<outw> to 'whiten' the encryption. I<inw> and I<outw> are secret -(unlike the iv) and are as such, part of the key. So the key is sort -of 24 bytes. This is much better than CBC DES. - -DES_ede3_cbc_encrypt() implements outer triple CBC DES encryption with -three keys. This means that each DES operation inside the CBC mode is -really an C<C=E(ks3,D(ks2,E(ks1,M)))>. This mode is used by SSL. - -The DES_ede2_cbc_encrypt() macro implements two-key Triple-DES by -reusing I<ks1> for the final encryption. C<C=E(ks1,D(ks2,E(ks1,M)))>. -This form of Triple-DES is used by the RSAREF library. - -DES_pcbc_encrypt() encrypt/decrypts using the propagating cipher block -chaining mode used by Kerberos v4. Its parameters are the same as -DES_ncbc_encrypt(). - -DES_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This -method takes an array of characters as input and outputs and array of -characters. It does not require any padding to 8 character groups. -Note: the I<ivec> variable is changed and the new changed value needs to -be passed to the next call to this function. Since this function runs -a complete DES ECB encryption per I<numbits>, this function is only -suggested for use when sending small numbers of characters. - -DES_cfb64_encrypt() -implements CFB mode of DES with 64bit feedback. Why is this -useful you ask? Because this routine will allow you to encrypt an -arbitrary number of bytes, no 8 byte padding. Each call to this -routine will encrypt the input bytes to output and then update ivec -and num. num contains 'how far' we are though ivec. If this does -not make much sense, read more about cfb mode of DES :-). - -DES_ede3_cfb64_encrypt() and DES_ede2_cfb64_encrypt() is the same as -DES_cfb64_encrypt() except that Triple-DES is used. - -DES_ofb_encrypt() encrypts using output feedback mode. This method -takes an array of characters as input and outputs and array of -characters. It does not require any padding to 8 character groups. -Note: the I<ivec> variable is changed and the new changed value needs to -be passed to the next call to this function. Since this function runs -a complete DES ECB encryption per numbits, this function is only -suggested for use when sending small numbers of characters. - -DES_ofb64_encrypt() is the same as DES_cfb64_encrypt() using Output -Feed Back mode. - -DES_ede3_ofb64_encrypt() and DES_ede2_ofb64_encrypt() is the same as -DES_ofb64_encrypt(), using Triple-DES. - -The following functions are included in the DES library for -compatibility with the MIT Kerberos library. - -DES_cbc_cksum() produces an 8 byte checksum based on the input stream -(via CBC encryption). The last 4 bytes of the checksum are returned -and the complete 8 bytes are placed in I<output>. This function is -used by Kerberos v4. Other applications should use -L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead. - -DES_quad_cksum() is a Kerberos v4 function. It returns a 4 byte -checksum from the input bytes. The algorithm can be iterated over the -input, depending on I<out_count>, 1, 2, 3 or 4 times. If I<output> is -non-NULL, the 8 bytes generated by each pass are written into -I<output>. - -The following are DES-based transformations: - -DES_fcrypt() is a fast version of the Unix crypt(3) function. This -version takes only a small amount of space relative to other fast -crypt() implementations. This is different to the normal crypt in -that the third parameter is the buffer that the return value is -written into. It needs to be at least 14 bytes long. This function -is thread safe, unlike the normal crypt. - -DES_crypt() is a faster replacement for the normal system crypt(). -This function calls DES_fcrypt() with a static array passed as the -third parameter. This emulates the normal non-thread safe semantics -of crypt(3). - -DES_enc_write() writes I<len> bytes to file descriptor I<fd> from -buffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default) -using I<sched> for the key and I<iv> as a starting vector. The actual -data send down I<fd> consists of 4 bytes (in network byte order) -containing the length of the following encrypted data. The encrypted -data then follows, padded with random data out to a multiple of 8 -bytes. - -DES_enc_read() is used to read I<len> bytes from file descriptor -I<fd> into buffer I<buf>. The data being read from I<fd> is assumed to -have come from DES_enc_write() and is decrypted using I<sched> for -the key schedule and I<iv> for the initial vector. - -B<Warning:> The data format used by DES_enc_write() and DES_enc_read() -has a cryptographic weakness: When asked to write more than MAXWRITE -bytes, DES_enc_write() will split the data into several chunks that -are all encrypted using the same IV. So don't use these functions -unless you are sure you know what you do (in which case you might not -want to use them anyway). They cannot handle non-blocking sockets. -DES_enc_read() uses an internal state and thus cannot be used on -multiple files. - -I<DES_rw_mode> is used to specify the encryption mode to use with -DES_enc_read() and DES_end_write(). If set to I<DES_PCBC_MODE> (the -default), DES_pcbc_encrypt is used. If set to I<DES_CBC_MODE> -DES_cbc_encrypt is used. - -=head1 NOTES - -Single-key DES is insecure due to its short key size. ECB mode is -not suitable for most applications; see L<des_modes(7)|des_modes(7)>. - -The L<evp(3)|evp(3)> library provides higher-level encryption functions. - -=head1 BUGS - -DES_3cbc_encrypt() is flawed and must not be used in applications. - -DES_cbc_encrypt() does not modify B<ivec>; use DES_ncbc_encrypt() -instead. - -DES_cfb_encrypt() and DES_ofb_encrypt() operates on input of 8 bits. -What this means is that if you set numbits to 12, and length to 2, the -first 12 bits will come from the 1st input byte and the low half of -the second input byte. The second 12 bits will have the low 8 bits -taken from the 3rd input byte and the top 4 bits taken from the 4th -input byte. The same holds for output. This function has been -implemented this way because most people will be using a multiple of 8 -and because once you get into pulling bytes input bytes apart things -get ugly! - -DES_string_to_key() is available for backward compatibility with the -MIT library. New applications should use a cryptographic hash function. -The same applies for DES_string_to_2key(). - -=head1 CONFORMING TO - -ANSI X3.106 - -The B<des> library was written to be source code compatible with -the MIT Kerberos library. - -=head1 SEE ALSO - -crypt(3), L<des_modes(7)|des_modes(7)>, L<evp(3)|evp(3)>, L<rand(3)|rand(3)> - -=head1 HISTORY - -In OpenSSL 0.9.7, all des_ functions were renamed to DES_ to avoid -clashes with older versions of libdes. Compatibility des_ functions -are provided for a short while, as well as crypt(). -Declarations for these are in <openssl/des_old.h>. There is no DES_ -variant for des_random_seed(). -This will happen to other functions -as well if they are deemed redundant (des_random_seed() just calls -RAND_seed() and is present for backward compatibility only), buggy or -already scheduled for removal. - -des_cbc_cksum(), des_cbc_encrypt(), des_ecb_encrypt(), -des_is_weak_key(), des_key_sched(), des_pcbc_encrypt(), -des_quad_cksum(), des_random_key() and des_string_to_key() -are available in the MIT Kerberos library; -des_check_key_parity(), des_fixup_key_parity() and des_is_weak_key() -are available in newer versions of that library. - -des_set_key_checked() and des_set_key_unchecked() were added in -OpenSSL 0.9.5. - -des_generate_random_block(), des_init_random_number_generator(), -des_new_random_key(), des_set_random_generator_seed() and -des_set_sequence_number() and des_rand_data() are used in newer -versions of Kerberos but are not implemented here. - -des_random_key() generated cryptographically weak random data in -SSLeay and in OpenSSL prior version 0.9.5, as well as in the original -MIT library. - -=head1 AUTHOR - -Eric Young (eay@cryptsoft.com). Modified for the OpenSSL project -(http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/des_modes.pod b/sys/src/ape/lib/openssl/doc/crypto/des_modes.pod deleted file mode 100644 index e883ca8fd..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/des_modes.pod +++ /dev/null @@ -1,255 +0,0 @@ -=pod - -=for comment openssl_manual_section:7 - -=head1 NAME - -des_modes - the variants of DES and other crypto algorithms of OpenSSL - -=head1 DESCRIPTION - -Several crypto algorithms for OpenSSL can be used in a number of modes. Those -are used for using block ciphers in a way similar to stream ciphers, among -other things. - -=head1 OVERVIEW - -=head2 Electronic Codebook Mode (ECB) - -Normally, this is found as the function I<algorithm>_ecb_encrypt(). - -=over 2 - -=item * - -64 bits are enciphered at a time. - -=item * - -The order of the blocks can be rearranged without detection. - -=item * - -The same plaintext block always produces the same ciphertext block -(for the same key) making it vulnerable to a 'dictionary attack'. - -=item * - -An error will only affect one ciphertext block. - -=back - -=head2 Cipher Block Chaining Mode (CBC) - -Normally, this is found as the function I<algorithm>_cbc_encrypt(). -Be aware that des_cbc_encrypt() is not really DES CBC (it does -not update the IV); use des_ncbc_encrypt() instead. - -=over 2 - -=item * - -a multiple of 64 bits are enciphered at a time. - -=item * - -The CBC mode produces the same ciphertext whenever the same -plaintext is encrypted using the same key and starting variable. - -=item * - -The chaining operation makes the ciphertext blocks dependent on the -current and all preceding plaintext blocks and therefore blocks can not -be rearranged. - -=item * - -The use of different starting variables prevents the same plaintext -enciphering to the same ciphertext. - -=item * - -An error will affect the current and the following ciphertext blocks. - -=back - -=head2 Cipher Feedback Mode (CFB) - -Normally, this is found as the function I<algorithm>_cfb_encrypt(). - -=over 2 - -=item * - -a number of bits (j) <= 64 are enciphered at a time. - -=item * - -The CFB mode produces the same ciphertext whenever the same -plaintext is encrypted using the same key and starting variable. - -=item * - -The chaining operation makes the ciphertext variables dependent on the -current and all preceding variables and therefore j-bit variables are -chained together and can not be rearranged. - -=item * - -The use of different starting variables prevents the same plaintext -enciphering to the same ciphertext. - -=item * - -The strength of the CFB mode depends on the size of k (maximal if -j == k). In my implementation this is always the case. - -=item * - -Selection of a small value for j will require more cycles through -the encipherment algorithm per unit of plaintext and thus cause -greater processing overheads. - -=item * - -Only multiples of j bits can be enciphered. - -=item * - -An error will affect the current and the following ciphertext variables. - -=back - -=head2 Output Feedback Mode (OFB) - -Normally, this is found as the function I<algorithm>_ofb_encrypt(). - -=over 2 - - -=item * - -a number of bits (j) <= 64 are enciphered at a time. - -=item * - -The OFB mode produces the same ciphertext whenever the same -plaintext enciphered using the same key and starting variable. More -over, in the OFB mode the same key stream is produced when the same -key and start variable are used. Consequently, for security reasons -a specific start variable should be used only once for a given key. - -=item * - -The absence of chaining makes the OFB more vulnerable to specific attacks. - -=item * - -The use of different start variables values prevents the same -plaintext enciphering to the same ciphertext, by producing different -key streams. - -=item * - -Selection of a small value for j will require more cycles through -the encipherment algorithm per unit of plaintext and thus cause -greater processing overheads. - -=item * - -Only multiples of j bits can be enciphered. - -=item * - -OFB mode of operation does not extend ciphertext errors in the -resultant plaintext output. Every bit error in the ciphertext causes -only one bit to be in error in the deciphered plaintext. - -=item * - -OFB mode is not self-synchronizing. If the two operation of -encipherment and decipherment get out of synchronism, the system needs -to be re-initialized. - -=item * - -Each re-initialization should use a value of the start variable -different from the start variable values used before with the same -key. The reason for this is that an identical bit stream would be -produced each time from the same parameters. This would be -susceptible to a 'known plaintext' attack. - -=back - -=head2 Triple ECB Mode - -Normally, this is found as the function I<algorithm>_ecb3_encrypt(). - -=over 2 - -=item * - -Encrypt with key1, decrypt with key2 and encrypt with key3 again. - -=item * - -As for ECB encryption but increases the key length to 168 bits. -There are theoretic attacks that can be used that make the effective -key length 112 bits, but this attack also requires 2^56 blocks of -memory, not very likely, even for the NSA. - -=item * - -If both keys are the same it is equivalent to encrypting once with -just one key. - -=item * - -If the first and last key are the same, the key length is 112 bits. -There are attacks that could reduce the effective key strength -to only slightly more than 56 bits, but these require a lot of memory. - -=item * - -If all 3 keys are the same, this is effectively the same as normal -ecb mode. - -=back - -=head2 Triple CBC Mode - -Normally, this is found as the function I<algorithm>_ede3_cbc_encrypt(). - -=over 2 - - -=item * - -Encrypt with key1, decrypt with key2 and then encrypt with key3. - -=item * - -As for CBC encryption but increases the key length to 168 bits with -the same restrictions as for triple ecb mode. - -=back - -=head1 NOTES - -This text was been written in large parts by Eric Young in his original -documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed -it to: - - AS 2805.5.2 - Australian Standard - Electronic funds transfer - Requirements for interfaces, - Part 5.2: Modes of operation for an n-bit block cipher algorithm - Appendix A - -=head1 SEE ALSO - -L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<idea(3)|idea(3)>, -L<rc2(3)|rc2(3)> - -=cut - diff --git a/sys/src/ape/lib/openssl/doc/crypto/dh.pod b/sys/src/ape/lib/openssl/doc/crypto/dh.pod deleted file mode 100644 index c3ccd0620..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/dh.pod +++ /dev/null @@ -1,78 +0,0 @@ -=pod - -=head1 NAME - -dh - Diffie-Hellman key agreement - -=head1 SYNOPSIS - - #include <openssl/dh.h> - #include <openssl/engine.h> - - DH * DH_new(void); - void DH_free(DH *dh); - - int DH_size(const DH *dh); - - DH * DH_generate_parameters(int prime_len, int generator, - void (*callback)(int, int, void *), void *cb_arg); - int DH_check(const DH *dh, int *codes); - - int DH_generate_key(DH *dh); - int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); - - void DH_set_default_method(const DH_METHOD *meth); - const DH_METHOD *DH_get_default_method(void); - int DH_set_method(DH *dh, const DH_METHOD *meth); - DH *DH_new_method(ENGINE *engine); - const DH_METHOD *DH_OpenSSL(void); - - int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), - int (*dup_func)(), void (*free_func)()); - int DH_set_ex_data(DH *d, int idx, char *arg); - char *DH_get_ex_data(DH *d, int idx); - - DH * d2i_DHparams(DH **a, unsigned char **pp, long length); - int i2d_DHparams(const DH *a, unsigned char **pp); - - int DHparams_print_fp(FILE *fp, const DH *x); - int DHparams_print(BIO *bp, const DH *x); - -=head1 DESCRIPTION - -These functions implement the Diffie-Hellman key agreement protocol. -The generation of shared DH parameters is described in -L<DH_generate_parameters(3)|DH_generate_parameters(3)>; L<DH_generate_key(3)|DH_generate_key(3)> describes how -to perform a key agreement. - -The B<DH> structure consists of several BIGNUM components. - - struct - { - BIGNUM *p; // prime number (shared) - BIGNUM *g; // generator of Z_p (shared) - BIGNUM *priv_key; // private DH value x - BIGNUM *pub_key; // public DH value g^x - // ... - }; - DH - -Note that DH keys may use non-standard B<DH_METHOD> implementations, -either directly or by the use of B<ENGINE> modules. In some cases (eg. an -ENGINE providing support for hardware-embedded keys), these BIGNUM values -will not be used by the implementation or may be used for alternative data -storage. For this reason, applications should generally avoid using DH -structure elements directly and instead use API functions to query or -modify keys. - -=head1 SEE ALSO - -L<dhparam(1)|dhparam(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, -L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<engine(3)|engine(3)>, -L<DH_set_method(3)|DH_set_method(3)>, L<DH_new(3)|DH_new(3)>, -L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>, -L<DH_generate_parameters(3)|DH_generate_parameters(3)>, -L<DH_compute_key(3)|DH_compute_key(3)>, L<d2i_DHparams(3)|d2i_DHparams(3)>, -L<RSA_print(3)|RSA_print(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/dsa.pod b/sys/src/ape/lib/openssl/doc/crypto/dsa.pod deleted file mode 100644 index da07d2b93..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/dsa.pod +++ /dev/null @@ -1,114 +0,0 @@ -=pod - -=head1 NAME - -dsa - Digital Signature Algorithm - -=head1 SYNOPSIS - - #include <openssl/dsa.h> - #include <openssl/engine.h> - - DSA * DSA_new(void); - void DSA_free(DSA *dsa); - - int DSA_size(const DSA *dsa); - - DSA * DSA_generate_parameters(int bits, unsigned char *seed, - int seed_len, int *counter_ret, unsigned long *h_ret, - void (*callback)(int, int, void *), void *cb_arg); - - DH * DSA_dup_DH(const DSA *r); - - int DSA_generate_key(DSA *dsa); - - int DSA_sign(int dummy, const unsigned char *dgst, int len, - unsigned char *sigret, unsigned int *siglen, DSA *dsa); - int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, - BIGNUM **rp); - int DSA_verify(int dummy, const unsigned char *dgst, int len, - const unsigned char *sigbuf, int siglen, DSA *dsa); - - void DSA_set_default_method(const DSA_METHOD *meth); - const DSA_METHOD *DSA_get_default_method(void); - int DSA_set_method(DSA *dsa, const DSA_METHOD *meth); - DSA *DSA_new_method(ENGINE *engine); - const DSA_METHOD *DSA_OpenSSL(void); - - int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), - int (*dup_func)(), void (*free_func)()); - int DSA_set_ex_data(DSA *d, int idx, char *arg); - char *DSA_get_ex_data(DSA *d, int idx); - - DSA_SIG *DSA_SIG_new(void); - void DSA_SIG_free(DSA_SIG *a); - int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); - DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length); - - DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); - int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - - DSA * d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length); - DSA * d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); - DSA * d2i_DSAparams(DSA **a, unsigned char **pp, long length); - int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); - int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); - int i2d_DSAparams(const DSA *a,unsigned char **pp); - - int DSAparams_print(BIO *bp, const DSA *x); - int DSAparams_print_fp(FILE *fp, const DSA *x); - int DSA_print(BIO *bp, const DSA *x, int off); - int DSA_print_fp(FILE *bp, const DSA *x, int off); - -=head1 DESCRIPTION - -These functions implement the Digital Signature Algorithm (DSA). The -generation of shared DSA parameters is described in -L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>; -L<DSA_generate_key(3)|DSA_generate_key(3)> describes how to -generate a signature key. Signature generation and verification are -described in L<DSA_sign(3)|DSA_sign(3)>. - -The B<DSA> structure consists of several BIGNUM components. - - struct - { - BIGNUM *p; // prime number (public) - BIGNUM *q; // 160-bit subprime, q | p-1 (public) - BIGNUM *g; // generator of subgroup (public) - BIGNUM *priv_key; // private key x - BIGNUM *pub_key; // public key y = g^x - // ... - } - DSA; - -In public keys, B<priv_key> is NULL. - -Note that DSA keys may use non-standard B<DSA_METHOD> implementations, -either directly or by the use of B<ENGINE> modules. In some cases (eg. an -ENGINE providing support for hardware-embedded keys), these BIGNUM values -will not be used by the implementation or may be used for alternative data -storage. For this reason, applications should generally avoid using DSA -structure elements directly and instead use API functions to query or -modify keys. - -=head1 CONFORMING TO - -US Federal Information Processing Standard FIPS 186 (Digital Signature -Standard, DSS), ANSI X9.30 - -=head1 SEE ALSO - -L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, -L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<engine(3)|engine(3)>, -L<DSA_new(3)|DSA_new(3)>, -L<DSA_size(3)|DSA_size(3)>, -L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, -L<DSA_dup_DH(3)|DSA_dup_DH(3)>, -L<DSA_generate_key(3)|DSA_generate_key(3)>, -L<DSA_sign(3)|DSA_sign(3)>, L<DSA_set_method(3)|DSA_set_method(3)>, -L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>, -L<RSA_print(3)|RSA_print(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ecdsa.pod b/sys/src/ape/lib/openssl/doc/crypto/ecdsa.pod deleted file mode 100644 index 49b10f224..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ecdsa.pod +++ /dev/null @@ -1,210 +0,0 @@ -=pod - -=head1 NAME - -ecdsa - Elliptic Curve Digital Signature Algorithm - -=head1 SYNOPSIS - - #include <openssl/ecdsa.h> - - ECDSA_SIG* ECDSA_SIG_new(void); - void ECDSA_SIG_free(ECDSA_SIG *sig); - int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); - ECDSA_SIG* d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, - long len); - - ECDSA_SIG* ECDSA_do_sign(const unsigned char *dgst, int dgst_len, - EC_KEY *eckey); - ECDSA_SIG* ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, - const BIGNUM *kinv, const BIGNUM *rp, - EC_KEY *eckey); - int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, - const ECDSA_SIG *sig, EC_KEY* eckey); - int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, - BIGNUM **kinv, BIGNUM **rp); - int ECDSA_sign(int type, const unsigned char *dgst, - int dgstlen, unsigned char *sig, - unsigned int *siglen, EC_KEY *eckey); - int ECDSA_sign_ex(int type, const unsigned char *dgst, - int dgstlen, unsigned char *sig, - unsigned int *siglen, const BIGNUM *kinv, - const BIGNUM *rp, EC_KEY *eckey); - int ECDSA_verify(int type, const unsigned char *dgst, - int dgstlen, const unsigned char *sig, - int siglen, EC_KEY *eckey); - int ECDSA_size(const EC_KEY *eckey); - - const ECDSA_METHOD* ECDSA_OpenSSL(void); - void ECDSA_set_default_method(const ECDSA_METHOD *meth); - const ECDSA_METHOD* ECDSA_get_default_method(void); - int ECDSA_set_method(EC_KEY *eckey,const ECDSA_METHOD *meth); - - int ECDSA_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg); - void* ECDSA_get_ex_data(EC_KEY *d, int idx); - -=head1 DESCRIPTION - -The B<ECDSA_SIG> structure consists of two BIGNUMs for the -r and s value of a ECDSA signature (see X9.62 or FIPS 186-2). - - struct - { - BIGNUM *r; - BIGNUM *s; - } ECDSA_SIG; - -ECDSA_SIG_new() allocates a new B<ECDSA_SIG> structure (note: this -function also allocates the BIGNUMs) and initialize it. - -ECDSA_SIG_free() frees the B<ECDSA_SIG> structure B<sig>. - -i2d_ECDSA_SIG() creates the DER encoding of the ECDSA signature -B<sig> and writes the encoded signature to B<*pp> (note: if B<pp> -is NULL B<i2d_ECDSA_SIG> returns the expected length in bytes of -the DER encoded signature). B<i2d_ECDSA_SIG> returns the length -of the DER encoded signature (or 0 on error). - -d2i_ECDSA_SIG() decodes a DER encoded ECDSA signature and returns -the decoded signature in a newly allocated B<ECDSA_SIG> structure. -B<*sig> points to the buffer containing the DER encoded signature -of size B<len>. - -ECDSA_size() returns the maximum length of a DER encoded -ECDSA signature created with the private EC key B<eckey>. - -ECDSA_sign_setup() may be used to precompute parts of the -signing operation. B<eckey> is the private EC key and B<ctx> -is a pointer to B<BN_CTX> structure (or NULL). The precomputed -values or returned in B<kinv> and B<rp> and can be used in a -later call to B<ECDSA_sign_ex> or B<ECDSA_do_sign_ex>. - -ECDSA_sign() is wrapper function for ECDSA_sign_ex with B<kinv> -and B<rp> set to NULL. - -ECDSA_sign_ex() computes a digital signature of the B<dgstlen> bytes -hash value B<dgst> using the private EC key B<eckey> and the optional -pre-computed values B<kinv> and B<rp>. The DER encoded signatures is -stored in B<sig> and it's length is returned in B<sig_len>. Note: B<sig> -must point to B<ECDSA_size> bytes of memory. The parameter B<type> -is ignored. - -ECDSA_verify() verifies that the signature in B<sig> of size -B<siglen> is a valid ECDSA signature of the hash value -value B<dgst> of size B<dgstlen> using the public key B<eckey>. -The parameter B<type> is ignored. - -ECDSA_do_sign() is wrapper function for ECDSA_do_sign_ex with B<kinv> -and B<rp> set to NULL. - -ECDSA_do_sign_ex() computes a digital signature of the B<dgst_len> -bytes hash value B<dgst> using the private key B<eckey> and the -optional pre-computed values B<kinv> and B<rp>. The signature is -returned in a newly allocated B<ECDSA_SIG> structure (or NULL on error). - -ECDSA_do_verify() verifies that the signature B<sig> is a valid -ECDSA signature of the hash value B<dgst> of size B<dgst_len> -using the public key B<eckey>. - -=head1 RETURN VALUES - -ECDSA_size() returns the maximum length signature or 0 on error. - -ECDSA_sign_setup() and ECDSA_sign() return 1 if successful or -1 -on error. - -ECDSA_verify() and ECDSA_do_verify() return 1 for a valid -signature, 0 for an invalid signature and -1 on error. -The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. - -=head1 EXAMPLES - -Creating a ECDSA signature of given SHA-1 hash value using the -named curve secp192k1. - -First step: create a EC_KEY object (note: this part is B<not> ECDSA -specific) - - int ret; - ECDSA_SIG *sig; - EC_KEY *eckey = EC_KEY_new(); - if (eckey == NULL) - { - /* error */ - } - key->group = EC_GROUP_new_by_nid(NID_secp192k1); - if (key->group == NULL) - { - /* error */ - } - if (!EC_KEY_generate_key(eckey)) - { - /* error */ - } - -Second step: compute the ECDSA signature of a SHA-1 hash value -using B<ECDSA_do_sign> - - sig = ECDSA_do_sign(digest, 20, eckey); - if (sig == NULL) - { - /* error */ - } - -or using B<ECDSA_sign> - - unsigned char *buffer, *pp; - int buf_len; - buf_len = ECDSA_size(eckey); - buffer = OPENSSL_malloc(buf_len); - pp = buffer; - if (!ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey); - { - /* error */ - } - -Third step: verify the created ECDSA signature using B<ECDSA_do_verify> - - ret = ECDSA_do_verify(digest, 20, sig, eckey); - -or using B<ECDSA_verify> - - ret = ECDSA_verify(0, digest, 20, buffer, buf_len, eckey); - -and finally evaluate the return value: - - if (ret == -1) - { - /* error */ - } - else if (ret == 0) - { - /* incorrect signature */ - } - else /* ret == 1 */ - { - /* signature ok */ - } - -=head1 CONFORMING TO - -ANSI X9.62, US Federal Information Processing Standard FIPS 186-2 -(Digital Signature Standard, DSS) - -=head1 SEE ALSO - -L<dsa(3)|dsa(3)>, L<rsa(3)|rsa(3)> - -=head1 HISTORY - -The ecdsa implementation was first introduced in OpenSSL 0.9.8 - -=head1 AUTHOR - -Nils Larsch for the OpenSSL project (http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/engine.pod b/sys/src/ape/lib/openssl/doc/crypto/engine.pod deleted file mode 100644 index 75933fcca..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/engine.pod +++ /dev/null @@ -1,599 +0,0 @@ -=pod - -=head1 NAME - -engine - ENGINE cryptographic module support - -=head1 SYNOPSIS - - #include <openssl/engine.h> - - ENGINE *ENGINE_get_first(void); - ENGINE *ENGINE_get_last(void); - ENGINE *ENGINE_get_next(ENGINE *e); - ENGINE *ENGINE_get_prev(ENGINE *e); - - int ENGINE_add(ENGINE *e); - int ENGINE_remove(ENGINE *e); - - ENGINE *ENGINE_by_id(const char *id); - - int ENGINE_init(ENGINE *e); - int ENGINE_finish(ENGINE *e); - - void ENGINE_load_openssl(void); - void ENGINE_load_dynamic(void); - #ifndef OPENSSL_NO_STATIC_ENGINE - void ENGINE_load_4758cca(void); - void ENGINE_load_aep(void); - void ENGINE_load_atalla(void); - void ENGINE_load_chil(void); - void ENGINE_load_cswift(void); - void ENGINE_load_gmp(void); - void ENGINE_load_nuron(void); - void ENGINE_load_sureware(void); - void ENGINE_load_ubsec(void); - #endif - void ENGINE_load_cryptodev(void); - void ENGINE_load_builtin_engines(void); - - void ENGINE_cleanup(void); - - ENGINE *ENGINE_get_default_RSA(void); - ENGINE *ENGINE_get_default_DSA(void); - ENGINE *ENGINE_get_default_ECDH(void); - ENGINE *ENGINE_get_default_ECDSA(void); - ENGINE *ENGINE_get_default_DH(void); - ENGINE *ENGINE_get_default_RAND(void); - ENGINE *ENGINE_get_cipher_engine(int nid); - ENGINE *ENGINE_get_digest_engine(int nid); - - int ENGINE_set_default_RSA(ENGINE *e); - int ENGINE_set_default_DSA(ENGINE *e); - int ENGINE_set_default_ECDH(ENGINE *e); - int ENGINE_set_default_ECDSA(ENGINE *e); - int ENGINE_set_default_DH(ENGINE *e); - int ENGINE_set_default_RAND(ENGINE *e); - int ENGINE_set_default_ciphers(ENGINE *e); - int ENGINE_set_default_digests(ENGINE *e); - int ENGINE_set_default_string(ENGINE *e, const char *list); - - int ENGINE_set_default(ENGINE *e, unsigned int flags); - - unsigned int ENGINE_get_table_flags(void); - void ENGINE_set_table_flags(unsigned int flags); - - int ENGINE_register_RSA(ENGINE *e); - void ENGINE_unregister_RSA(ENGINE *e); - void ENGINE_register_all_RSA(void); - int ENGINE_register_DSA(ENGINE *e); - void ENGINE_unregister_DSA(ENGINE *e); - void ENGINE_register_all_DSA(void); - int ENGINE_register_ECDH(ENGINE *e); - void ENGINE_unregister_ECDH(ENGINE *e); - void ENGINE_register_all_ECDH(void); - int ENGINE_register_ECDSA(ENGINE *e); - void ENGINE_unregister_ECDSA(ENGINE *e); - void ENGINE_register_all_ECDSA(void); - int ENGINE_register_DH(ENGINE *e); - void ENGINE_unregister_DH(ENGINE *e); - void ENGINE_register_all_DH(void); - int ENGINE_register_RAND(ENGINE *e); - void ENGINE_unregister_RAND(ENGINE *e); - void ENGINE_register_all_RAND(void); - int ENGINE_register_STORE(ENGINE *e); - void ENGINE_unregister_STORE(ENGINE *e); - void ENGINE_register_all_STORE(void); - int ENGINE_register_ciphers(ENGINE *e); - void ENGINE_unregister_ciphers(ENGINE *e); - void ENGINE_register_all_ciphers(void); - int ENGINE_register_digests(ENGINE *e); - void ENGINE_unregister_digests(ENGINE *e); - void ENGINE_register_all_digests(void); - int ENGINE_register_complete(ENGINE *e); - int ENGINE_register_all_complete(void); - - int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)); - int ENGINE_cmd_is_executable(ENGINE *e, int cmd); - int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, - long i, void *p, void (*f)(void), int cmd_optional); - int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, - int cmd_optional); - - int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); - void *ENGINE_get_ex_data(const ENGINE *e, int idx); - - int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); - - ENGINE *ENGINE_new(void); - int ENGINE_free(ENGINE *e); - int ENGINE_up_ref(ENGINE *e); - - int ENGINE_set_id(ENGINE *e, const char *id); - int ENGINE_set_name(ENGINE *e, const char *name); - int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); - int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); - int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *dh_meth); - int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *dh_meth); - int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); - int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); - int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *rand_meth); - int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); - int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); - int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); - int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); - int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); - int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); - int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); - int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); - int ENGINE_set_flags(ENGINE *e, int flags); - int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); - - const char *ENGINE_get_id(const ENGINE *e); - const char *ENGINE_get_name(const ENGINE *e); - const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); - const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); - const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); - const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); - const DH_METHOD *ENGINE_get_DH(const ENGINE *e); - const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); - const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); - ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); - ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); - ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); - ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); - ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); - ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); - ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); - ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); - const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); - const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); - int ENGINE_get_flags(const ENGINE *e); - const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); - - EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); - EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); - - void ENGINE_add_conf_module(void); - -=head1 DESCRIPTION - -These functions create, manipulate, and use cryptographic modules in the -form of B<ENGINE> objects. These objects act as containers for -implementations of cryptographic algorithms, and support a -reference-counted mechanism to allow them to be dynamically loaded in and -out of the running application. - -The cryptographic functionality that can be provided by an B<ENGINE> -implementation includes the following abstractions; - - RSA_METHOD - for providing alternative RSA implementations - DSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD, - STORE_METHOD - similarly for other OpenSSL APIs - EVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid') - EVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid') - key-loading - loading public and/or private EVP_PKEY keys - -=head2 Reference counting and handles - -Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be -treated as handles - ie. not only as pointers, but also as references to -the underlying ENGINE object. Ie. one should obtain a new reference when -making copies of an ENGINE pointer if the copies will be used (and -released) independantly. - -ENGINE objects have two levels of reference-counting to match the way in -which the objects are used. At the most basic level, each ENGINE pointer is -inherently a B<structural> reference - a structural reference is required -to use the pointer value at all, as this kind of reference is a guarantee -that the structure can not be deallocated until the reference is released. - -However, a structural reference provides no guarantee that the ENGINE is -initiliased and able to use any of its cryptographic -implementations. Indeed it's quite possible that most ENGINEs will not -initialise at all in typical environments, as ENGINEs are typically used to -support specialised hardware. To use an ENGINE's functionality, you need a -B<functional> reference. This kind of reference can be considered a -specialised form of structural reference, because each functional reference -implicitly contains a structural reference as well - however to avoid -difficult-to-find programming bugs, it is recommended to treat the two -kinds of reference independantly. If you have a functional reference to an -ENGINE, you have a guarantee that the ENGINE has been initialised ready to -perform cryptographic operations and will remain uninitialised -until after you have released your reference. - -I<Structural references> - -This basic type of reference is used for instantiating new ENGINEs, -iterating across OpenSSL's internal linked-list of loaded -ENGINEs, reading information about an ENGINE, etc. Essentially a structural -reference is sufficient if you only need to query or manipulate the data of -an ENGINE implementation rather than use its functionality. - -The ENGINE_new() function returns a structural reference to a new (empty) -ENGINE object. There are other ENGINE API functions that return structural -references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(), -ENGINE_get_next(), ENGINE_get_prev(). All structural references should be -released by a corresponding to call to the ENGINE_free() function - the -ENGINE object itself will only actually be cleaned up and deallocated when -the last structural reference is released. - -It should also be noted that many ENGINE API function calls that accept a -structural reference will internally obtain another reference - typically -this happens whenever the supplied ENGINE will be needed by OpenSSL after -the function has returned. Eg. the function to add a new ENGINE to -OpenSSL's internal list is ENGINE_add() - if this function returns success, -then OpenSSL will have stored a new structural reference internally so the -caller is still responsible for freeing their own reference with -ENGINE_free() when they are finished with it. In a similar way, some -functions will automatically release the structural reference passed to it -if part of the function's job is to do so. Eg. the ENGINE_get_next() and -ENGINE_get_prev() functions are used for iterating across the internal -ENGINE list - they will return a new structural reference to the next (or -previous) ENGINE in the list or NULL if at the end (or beginning) of the -list, but in either case the structural reference passed to the function is -released on behalf of the caller. - -To clarify a particular function's handling of references, one should -always consult that function's documentation "man" page, or failing that -the openssl/engine.h header file includes some hints. - -I<Functional references> - -As mentioned, functional references exist when the cryptographic -functionality of an ENGINE is required to be available. A functional -reference can be obtained in one of two ways; from an existing structural -reference to the required ENGINE, or by asking OpenSSL for the default -operational ENGINE for a given cryptographic purpose. - -To obtain a functional reference from an existing structural reference, -call the ENGINE_init() function. This returns zero if the ENGINE was not -already operational and couldn't be successfully initialised (eg. lack of -system drivers, no special hardware attached, etc), otherwise it will -return non-zero to indicate that the ENGINE is now operational and will -have allocated a new B<functional> reference to the ENGINE. All functional -references are released by calling ENGINE_finish() (which removes the -implicit structural reference as well). - -The second way to get a functional reference is by asking OpenSSL for a -default implementation for a given task, eg. by ENGINE_get_default_RSA(), -ENGINE_get_default_cipher_engine(), etc. These are discussed in the next -section, though they are not usually required by application programmers as -they are used automatically when creating and using the relevant -algorithm-specific types in OpenSSL, such as RSA, DSA, EVP_CIPHER_CTX, etc. - -=head2 Default implementations - -For each supported abstraction, the ENGINE code maintains an internal table -of state to control which implementations are available for a given -abstraction and which should be used by default. These implementations are -registered in the tables and indexed by an 'nid' value, because -abstractions like EVP_CIPHER and EVP_DIGEST support many distinct -algorithms and modes, and ENGINEs can support arbitrarily many of them. -In the case of other abstractions like RSA, DSA, etc, there is only one -"algorithm" so all implementations implicitly register using the same 'nid' -index. - -When a default ENGINE is requested for a given abstraction/algorithm/mode, (eg. -when calling RSA_new_method(NULL)), a "get_default" call will be made to the -ENGINE subsystem to process the corresponding state table and return a -functional reference to an initialised ENGINE whose implementation should be -used. If no ENGINE should (or can) be used, it will return NULL and the caller -will operate with a NULL ENGINE handle - this usually equates to using the -conventional software implementation. In the latter case, OpenSSL will from -then on behave the way it used to before the ENGINE API existed. - -Each state table has a flag to note whether it has processed this -"get_default" query since the table was last modified, because to process -this question it must iterate across all the registered ENGINEs in the -table trying to initialise each of them in turn, in case one of them is -operational. If it returns a functional reference to an ENGINE, it will -also cache another reference to speed up processing future queries (without -needing to iterate across the table). Likewise, it will cache a NULL -response if no ENGINE was available so that future queries won't repeat the -same iteration unless the state table changes. This behaviour can also be -changed; if the ENGINE_TABLE_FLAG_NOINIT flag is set (using -ENGINE_set_table_flags()), no attempted initialisations will take place, -instead the only way for the state table to return a non-NULL ENGINE to the -"get_default" query will be if one is expressly set in the table. Eg. -ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except -that it also sets the state table's cached response for the "get_default" -query. In the case of abstractions like EVP_CIPHER, where implementations are -indexed by 'nid', these flags and cached-responses are distinct for each 'nid' -value. - -=head2 Application requirements - -This section will explain the basic things an application programmer should -support to make the most useful elements of the ENGINE functionality -available to the user. The first thing to consider is whether the -programmer wishes to make alternative ENGINE modules available to the -application and user. OpenSSL maintains an internal linked list of -"visible" ENGINEs from which it has to operate - at start-up, this list is -empty and in fact if an application does not call any ENGINE API calls and -it uses static linking against openssl, then the resulting application -binary will not contain any alternative ENGINE code at all. So the first -consideration is whether any/all available ENGINE implementations should be -made visible to OpenSSL - this is controlled by calling the various "load" -functions, eg. - - /* Make the "dynamic" ENGINE available */ - void ENGINE_load_dynamic(void); - /* Make the CryptoSwift hardware acceleration support available */ - void ENGINE_load_cswift(void); - /* Make support for nCipher's "CHIL" hardware available */ - void ENGINE_load_chil(void); - ... - /* Make ALL ENGINE implementations bundled with OpenSSL available */ - void ENGINE_load_builtin_engines(void); - -Having called any of these functions, ENGINE objects would have been -dynamically allocated and populated with these implementations and linked -into OpenSSL's internal linked list. At this point it is important to -mention an important API function; - - void ENGINE_cleanup(void); - -If no ENGINE API functions are called at all in an application, then there -are no inherent memory leaks to worry about from the ENGINE functionality, -however if any ENGINEs are loaded, even if they are never registered or -used, it is necessary to use the ENGINE_cleanup() function to -correspondingly cleanup before program exit, if the caller wishes to avoid -memory leaks. This mechanism uses an internal callback registration table -so that any ENGINE API functionality that knows it requires cleanup can -register its cleanup details to be called during ENGINE_cleanup(). This -approach allows ENGINE_cleanup() to clean up after any ENGINE functionality -at all that your program uses, yet doesn't automatically create linker -dependencies to all possible ENGINE functionality - only the cleanup -callbacks required by the functionality you do use will be required by the -linker. - -The fact that ENGINEs are made visible to OpenSSL (and thus are linked into -the program and loaded into memory at run-time) does not mean they are -"registered" or called into use by OpenSSL automatically - that behaviour -is something for the application to control. Some applications -will want to allow the user to specify exactly which ENGINE they want used -if any is to be used at all. Others may prefer to load all support and have -OpenSSL automatically use at run-time any ENGINE that is able to -successfully initialise - ie. to assume that this corresponds to -acceleration hardware attached to the machine or some such thing. There are -probably numerous other ways in which applications may prefer to handle -things, so we will simply illustrate the consequences as they apply to a -couple of simple cases and leave developers to consider these and the -source code to openssl's builtin utilities as guides. - -I<Using a specific ENGINE implementation> - -Here we'll assume an application has been configured by its user or admin -to want to use the "ACME" ENGINE if it is available in the version of -OpenSSL the application was compiled with. If it is available, it should be -used by default for all RSA, DSA, and symmetric cipher operation, otherwise -OpenSSL should use its builtin software as per usual. The following code -illustrates how to approach this; - - ENGINE *e; - const char *engine_id = "ACME"; - ENGINE_load_builtin_engines(); - e = ENGINE_by_id(engine_id); - if(!e) - /* the engine isn't available */ - return; - if(!ENGINE_init(e)) { - /* the engine couldn't initialise, release 'e' */ - ENGINE_free(e); - return; - } - if(!ENGINE_set_default_RSA(e)) - /* This should only happen when 'e' can't initialise, but the previous - * statement suggests it did. */ - abort(); - ENGINE_set_default_DSA(e); - ENGINE_set_default_ciphers(e); - /* Release the functional reference from ENGINE_init() */ - ENGINE_finish(e); - /* Release the structural reference from ENGINE_by_id() */ - ENGINE_free(e); - -I<Automatically using builtin ENGINE implementations> - -Here we'll assume we want to load and register all ENGINE implementations -bundled with OpenSSL, such that for any cryptographic algorithm required by -OpenSSL - if there is an ENGINE that implements it and can be initialise, -it should be used. The following code illustrates how this can work; - - /* Load all bundled ENGINEs into memory and make them visible */ - ENGINE_load_builtin_engines(); - /* Register all of them for every algorithm they collectively implement */ - ENGINE_register_all_complete(); - -That's all that's required. Eg. the next time OpenSSL tries to set up an -RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to -ENGINE_init() and if any of those succeed, that ENGINE will be set as the -default for RSA use from then on. - -=head2 Advanced configuration support - -There is a mechanism supported by the ENGINE framework that allows each -ENGINE implementation to define an arbitrary set of configuration -"commands" and expose them to OpenSSL and any applications based on -OpenSSL. This mechanism is entirely based on the use of name-value pairs -and assumes ASCII input (no unicode or UTF for now!), so it is ideal if -applications want to provide a transparent way for users to provide -arbitrary configuration "directives" directly to such ENGINEs. It is also -possible for the application to dynamically interrogate the loaded ENGINE -implementations for the names, descriptions, and input flags of their -available "control commands", providing a more flexible configuration -scheme. However, if the user is expected to know which ENGINE device he/she -is using (in the case of specialised hardware, this goes without saying) -then applications may not need to concern themselves with discovering the -supported control commands and simply prefer to pass settings into ENGINEs -exactly as they are provided by the user. - -Before illustrating how control commands work, it is worth mentioning what -they are typically used for. Broadly speaking there are two uses for -control commands; the first is to provide the necessary details to the -implementation (which may know nothing at all specific to the host system) -so that it can be initialised for use. This could include the path to any -driver or config files it needs to load, required network addresses, -smart-card identifiers, passwords to initialise protected devices, -logging information, etc etc. This class of commands typically needs to be -passed to an ENGINE B<before> attempting to initialise it, ie. before -calling ENGINE_init(). The other class of commands consist of settings or -operations that tweak certain behaviour or cause certain operations to take -place, and these commands may work either before or after ENGINE_init(), or -in some cases both. ENGINE implementations should provide indications of -this in the descriptions attached to builtin control commands and/or in -external product documentation. - -I<Issuing control commands to an ENGINE> - -Let's illustrate by example; a function for which the caller supplies the -name of the ENGINE it wishes to use, a table of string-pairs for use before -initialisation, and another table for use after initialisation. Note that -the string-pairs used for control commands consist of a command "name" -followed by the command "parameter" - the parameter could be NULL in some -cases but the name can not. This function should initialise the ENGINE -(issuing the "pre" commands beforehand and the "post" commands afterwards) -and set it as the default for everything except RAND and then return a -boolean success or failure. - - int generic_load_engine_fn(const char *engine_id, - const char **pre_cmds, int pre_num, - const char **post_cmds, int post_num) - { - ENGINE *e = ENGINE_by_id(engine_id); - if(!e) return 0; - while(pre_num--) { - if(!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) { - fprintf(stderr, "Failed command (%s - %s:%s)\n", engine_id, - pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : "(NULL)"); - ENGINE_free(e); - return 0; - } - pre_cmds += 2; - } - if(!ENGINE_init(e)) { - fprintf(stderr, "Failed initialisation\n"); - ENGINE_free(e); - return 0; - } - /* ENGINE_init() returned a functional reference, so free the structural - * reference from ENGINE_by_id(). */ - ENGINE_free(e); - while(post_num--) { - if(!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) { - fprintf(stderr, "Failed command (%s - %s:%s)\n", engine_id, - post_cmds[0], post_cmds[1] ? post_cmds[1] : "(NULL)"); - ENGINE_finish(e); - return 0; - } - post_cmds += 2; - } - ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND); - /* Success */ - return 1; - } - -Note that ENGINE_ctrl_cmd_string() accepts a boolean argument that can -relax the semantics of the function - if set non-zero it will only return -failure if the ENGINE supported the given command name but failed while -executing it, if the ENGINE doesn't support the command name it will simply -return success without doing anything. In this case we assume the user is -only supplying commands specific to the given ENGINE so we set this to -FALSE. - -I<Discovering supported control commands> - -It is possible to discover at run-time the names, numerical-ids, descriptions -and input parameters of the control commands supported by an ENGINE using a -structural reference. Note that some control commands are defined by OpenSSL -itself and it will intercept and handle these control commands on behalf of the -ENGINE, ie. the ENGINE's ctrl() handler is not used for the control command. -openssl/engine.h defines an index, ENGINE_CMD_BASE, that all control commands -implemented by ENGINEs should be numbered from. Any command value lower than -this symbol is considered a "generic" command is handled directly by the -OpenSSL core routines. - -It is using these "core" control commands that one can discover the the control -commands implemented by a given ENGINE, specifically the commands; - - #define ENGINE_HAS_CTRL_FUNCTION 10 - #define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 - #define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 - #define ENGINE_CTRL_GET_CMD_FROM_NAME 13 - #define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 - #define ENGINE_CTRL_GET_NAME_FROM_CMD 15 - #define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 - #define ENGINE_CTRL_GET_DESC_FROM_CMD 17 - #define ENGINE_CTRL_GET_CMD_FLAGS 18 - -Whilst these commands are automatically processed by the OpenSSL framework code, -they use various properties exposed by each ENGINE to process these -queries. An ENGINE has 3 properties it exposes that can affect how this behaves; -it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in -the ENGINE's flags, and it can expose an array of control command descriptions. -If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will -simply pass all these "core" control commands directly to the ENGINE's ctrl() -handler (and thus, it must have supplied one), so it is up to the ENGINE to -reply to these "discovery" commands itself. If that flag is not set, then the -OpenSSL framework code will work with the following rules; - - if no ctrl() handler supplied; - ENGINE_HAS_CTRL_FUNCTION returns FALSE (zero), - all other commands fail. - if a ctrl() handler was supplied but no array of control commands; - ENGINE_HAS_CTRL_FUNCTION returns TRUE, - all other commands fail. - if a ctrl() handler and array of control commands was supplied; - ENGINE_HAS_CTRL_FUNCTION returns TRUE, - all other commands proceed processing ... - -If the ENGINE's array of control commands is empty then all other commands will -fail, otherwise; ENGINE_CTRL_GET_FIRST_CMD_TYPE returns the identifier of -the first command supported by the ENGINE, ENGINE_GET_NEXT_CMD_TYPE takes the -identifier of a command supported by the ENGINE and returns the next command -identifier or fails if there are no more, ENGINE_CMD_FROM_NAME takes a string -name for a command and returns the corresponding identifier or fails if no such -command name exists, and the remaining commands take a command identifier and -return properties of the corresponding commands. All except -ENGINE_CTRL_GET_FLAGS return the string length of a command name or description, -or populate a supplied character buffer with a copy of the command name or -description. ENGINE_CTRL_GET_FLAGS returns a bitwise-OR'd mask of the following -possible values; - - #define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 - #define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 - #define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 - #define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 - -If the ENGINE_CMD_FLAG_INTERNAL flag is set, then any other flags are purely -informational to the caller - this flag will prevent the command being usable -for any higher-level ENGINE functions such as ENGINE_ctrl_cmd_string(). -"INTERNAL" commands are not intended to be exposed to text-based configuration -by applications, administrations, users, etc. These can support arbitrary -operations via ENGINE_ctrl(), including passing to and/or from the control -commands data of any arbitrary type. These commands are supported in the -discovery mechanisms simply to allow applications determinie if an ENGINE -supports certain specific commands it might want to use (eg. application "foo" -might query various ENGINEs to see if they implement "FOO_GET_VENDOR_LOGO_GIF" - -and ENGINE could therefore decide whether or not to support this "foo"-specific -extension). - -=head2 Future developments - -The ENGINE API and internal architecture is currently being reviewed. Slated for -possible release in 0.9.8 is support for transparent loading of "dynamic" -ENGINEs (built as self-contained shared-libraries). This would allow ENGINE -implementations to be provided independantly of OpenSSL libraries and/or -OpenSSL-based applications, and would also remove any requirement for -applications to explicitly use the "dynamic" ENGINE to bind to shared-library -implementations. - -=head1 SEE ALSO - -L<rsa(3)|rsa(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rand(3)|rand(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/err.pod b/sys/src/ape/lib/openssl/doc/crypto/err.pod deleted file mode 100644 index 6f729554d..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/err.pod +++ /dev/null @@ -1,187 +0,0 @@ -=pod - -=head1 NAME - -err - error codes - -=head1 SYNOPSIS - - #include <openssl/err.h> - - unsigned long ERR_get_error(void); - unsigned long ERR_peek_error(void); - unsigned long ERR_get_error_line(const char **file, int *line); - unsigned long ERR_peek_error_line(const char **file, int *line); - unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); - unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); - - int ERR_GET_LIB(unsigned long e); - int ERR_GET_FUNC(unsigned long e); - int ERR_GET_REASON(unsigned long e); - - void ERR_clear_error(void); - - char *ERR_error_string(unsigned long e, char *buf); - const char *ERR_lib_error_string(unsigned long e); - const char *ERR_func_error_string(unsigned long e); - const char *ERR_reason_error_string(unsigned long e); - - void ERR_print_errors(BIO *bp); - void ERR_print_errors_fp(FILE *fp); - - void ERR_load_crypto_strings(void); - void ERR_free_strings(void); - - void ERR_remove_state(unsigned long pid); - - void ERR_put_error(int lib, int func, int reason, const char *file, - int line); - void ERR_add_error_data(int num, ...); - - void ERR_load_strings(int lib,ERR_STRING_DATA str[]); - unsigned long ERR_PACK(int lib, int func, int reason); - int ERR_get_next_error_library(void); - -=head1 DESCRIPTION - -When a call to the OpenSSL library fails, this is usually signalled -by the return value, and an error code is stored in an error queue -associated with the current thread. The B<err> library provides -functions to obtain these error codes and textual error messages. - -The L<ERR_get_error(3)|ERR_get_error(3)> manpage describes how to -access error codes. - -Error codes contain information about where the error occurred, and -what went wrong. L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> describes how to -extract this information. A method to obtain human-readable error -messages is described in L<ERR_error_string(3)|ERR_error_string(3)>. - -L<ERR_clear_error(3)|ERR_clear_error(3)> can be used to clear the -error queue. - -Note that L<ERR_remove_state(3)|ERR_remove_state(3)> should be used to -avoid memory leaks when threads are terminated. - -=head1 ADDING NEW ERROR CODES TO OPENSSL - -See L<ERR_put_error(3)> if you want to record error codes in the -OpenSSL error system from within your application. - -The remainder of this section is of interest only if you want to add -new error codes to OpenSSL or add error codes from external libraries. - -=head2 Reporting errors - -Each sub-library has a specific macro XXXerr() that is used to report -errors. Its first argument is a function code B<XXX_F_...>, the second -argument is a reason code B<XXX_R_...>. Function codes are derived -from the function names; reason codes consist of textual error -descriptions. For example, the function ssl23_read() reports a -"handshake failure" as follows: - - SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); - -Function and reason codes should consist of upper case characters, -numbers and underscores only. The error file generation script translates -function codes into function names by looking in the header files -for an appropriate function name, if none is found it just uses -the capitalized form such as "SSL23_READ" in the above example. - -The trailing section of a reason code (after the "_R_") is translated -into lower case and underscores changed to spaces. - -When you are using new function or reason codes, run B<make errors>. -The necessary B<#define>s will then automatically be added to the -sub-library's header file. - -Although a library will normally report errors using its own specific -XXXerr macro, another library's macro can be used. This is normally -only done when a library wants to include ASN1 code which must use -the ASN1err() macro. - -=head2 Adding new libraries - -When adding a new sub-library to OpenSSL, assign it a library number -B<ERR_LIB_XXX>, define a macro XXXerr() (both in B<err.h>), add its -name to B<ERR_str_libraries[]> (in B<crypto/err/err.c>), and add -C<ERR_load_XXX_strings()> to the ERR_load_crypto_strings() function -(in B<crypto/err/err_all.c>). Finally, add an entry - - L XXX xxx.h xxx_err.c - -to B<crypto/err/openssl.ec>, and add B<xxx_err.c> to the Makefile. -Running B<make errors> will then generate a file B<xxx_err.c>, and -add all error codes used in the library to B<xxx.h>. - -Additionally the library include file must have a certain form. -Typically it will initially look like this: - - #ifndef HEADER_XXX_H - #define HEADER_XXX_H - - #ifdef __cplusplus - extern "C" { - #endif - - /* Include files */ - - #include <openssl/bio.h> - #include <openssl/x509.h> - - /* Macros, structures and function prototypes */ - - - /* BEGIN ERROR CODES */ - -The B<BEGIN ERROR CODES> sequence is used by the error code -generation script as the point to place new error codes, any text -after this point will be overwritten when B<make errors> is run. -The closing #endif etc will be automatically added by the script. - -The generated C error code file B<xxx_err.c> will load the header -files B<stdio.h>, B<openssl/err.h> and B<openssl/xxx.h> so the -header file must load any additional header files containing any -definitions it uses. - -=head1 USING ERROR CODES IN EXTERNAL LIBRARIES - -It is also possible to use OpenSSL's error code scheme in external -libraries. The library needs to load its own codes and call the OpenSSL -error code insertion script B<mkerr.pl> explicitly to add codes to -the header file and generate the C error code file. This will normally -be done if the external library needs to generate new ASN1 structures -but it can also be used to add more general purpose error code handling. - -TBA more details - -=head1 INTERNALS - -The error queues are stored in a hash table with one B<ERR_STATE> -entry for each pid. ERR_get_state() returns the current thread's -B<ERR_STATE>. An B<ERR_STATE> can hold up to B<ERR_NUM_ERRORS> error -codes. When more error codes are added, the old ones are overwritten, -on the assumption that the most recent errors are most important. - -Error strings are also stored in hash table. The hash tables can -be obtained by calling ERR_get_err_state_table(void) and -ERR_get_string_table(void) respectively. - -=head1 SEE ALSO - -L<CRYPTO_set_id_callback(3)|CRYPTO_set_id_callback(3)>, -L<CRYPTO_set_locking_callback(3)|CRYPTO_set_locking_callback(3)>, -L<ERR_get_error(3)|ERR_get_error(3)>, -L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>, -L<ERR_clear_error(3)|ERR_clear_error(3)>, -L<ERR_error_string(3)|ERR_error_string(3)>, -L<ERR_print_errors(3)|ERR_print_errors(3)>, -L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, -L<ERR_remove_state(3)|ERR_remove_state(3)>, -L<ERR_put_error(3)|ERR_put_error(3)>, -L<ERR_load_strings(3)|ERR_load_strings(3)>, -L<SSL_get_error(3)|SSL_get_error(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/evp.pod b/sys/src/ape/lib/openssl/doc/crypto/evp.pod deleted file mode 100644 index b3ca14314..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/evp.pod +++ /dev/null @@ -1,45 +0,0 @@ -=pod - -=head1 NAME - -evp - high-level cryptographic functions - -=head1 SYNOPSIS - - #include <openssl/evp.h> - -=head1 DESCRIPTION - -The EVP library provides a high-level interface to cryptographic -functions. - -B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption -and decryption to implement digital "envelopes". - -The B<EVP_Sign>I<...> and B<EVP_Verify>I<...> functions implement -digital signatures. - -Symmetric encryption is available with the B<EVP_Encrypt>I<...> -functions. The B<EVP_Digest>I<...> functions provide message digests. - -Algorithms are loaded with OpenSSL_add_all_algorithms(3). - -All the symmetric algorithms (ciphers) and digests can be replaced by ENGINE -modules providing alternative implementations. If ENGINE implementations of -ciphers or digests are registered as defaults, then the various EVP functions -will automatically use those implementations automatically in preference to -built in software implementations. For more information, consult the engine(3) -man page. - -=head1 SEE ALSO - -L<EVP_DigestInit(3)|EVP_DigestInit(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, -L<EVP_OpenInit(3)|EVP_OpenInit(3)>, -L<EVP_SealInit(3)|EVP_SealInit(3)>, -L<EVP_SignInit(3)|EVP_SignInit(3)>, -L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, -L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)>, -L<engine(3)|engine(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/hmac.pod b/sys/src/ape/lib/openssl/doc/crypto/hmac.pod deleted file mode 100644 index 0bd79a6d3..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/hmac.pod +++ /dev/null @@ -1,102 +0,0 @@ -=pod - -=head1 NAME - -HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message -authentication code - -=head1 SYNOPSIS - - #include <openssl/hmac.h> - - unsigned char *HMAC(const EVP_MD *evp_md, const void *key, - int key_len, const unsigned char *d, int n, - unsigned char *md, unsigned int *md_len); - - void HMAC_CTX_init(HMAC_CTX *ctx); - - void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, - const EVP_MD *md); - void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, - const EVP_MD *md, ENGINE *impl); - void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); - void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); - - void HMAC_CTX_cleanup(HMAC_CTX *ctx); - void HMAC_cleanup(HMAC_CTX *ctx); - -=head1 DESCRIPTION - -HMAC is a MAC (message authentication code), i.e. a keyed hash -function used for message authentication, which is based on a hash -function. - -HMAC() computes the message authentication code of the B<n> bytes at -B<d> using the hash function B<evp_md> and the key B<key> which is -B<key_len> bytes long. - -It places the result in B<md> (which must have space for the output of -the hash function, which is no more than B<EVP_MAX_MD_SIZE> bytes). -If B<md> is NULL, the digest is placed in a static array. The size of -the output is placed in B<md_len>, unless it is B<NULL>. - -B<evp_md> can be EVP_sha1(), EVP_ripemd160() etc. -B<key> and B<evp_md> may be B<NULL> if a key and hash function have -been set in a previous call to HMAC_Init() for that B<HMAC_CTX>. - -HMAC_CTX_init() initialises a B<HMAC_CTX> before first use. It must be -called. - -HMAC_CTX_cleanup() erases the key and other data from the B<HMAC_CTX> -and releases any associated resources. It must be called when an -B<HMAC_CTX> is no longer required. - -HMAC_cleanup() is an alias for HMAC_CTX_cleanup() included for back -compatibility with 0.9.6b, it is deprecated. - -The following functions may be used if the message is not completely -stored in memory: - -HMAC_Init() initializes a B<HMAC_CTX> structure to use the hash -function B<evp_md> and the key B<key> which is B<key_len> bytes -long. It is deprecated and only included for backward compatibility -with OpenSSL 0.9.6b. - -HMAC_Init_ex() initializes or reuses a B<HMAC_CTX> structure to use -the function B<evp_md> and key B<key>. Either can be NULL, in which -case the existing one will be reused. HMAC_CTX_init() must have been -called before the first use of an B<HMAC_CTX> in this -function. B<N.B. HMAC_Init() had this undocumented behaviour in -previous versions of OpenSSL - failure to switch to HMAC_Init_ex() in -programs that expect it will cause them to stop working>. - -HMAC_Update() can be called repeatedly with chunks of the message to -be authenticated (B<len> bytes at B<data>). - -HMAC_Final() places the message authentication code in B<md>, which -must have space for the hash function output. - -=head1 RETURN VALUES - -HMAC() returns a pointer to the message authentication code. - -HMAC_CTX_init(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and -HMAC_CTX_cleanup() do not return values. - -=head1 CONFORMING TO - -RFC 2104 - -=head1 SEE ALSO - -L<sha(3)|sha(3)>, L<evp(3)|evp(3)> - -=head1 HISTORY - -HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() -are available since SSLeay 0.9.0. - -HMAC_CTX_init(), HMAC_Init_ex() and HMAC_CTX_cleanup() are available -since OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/lh_stats.pod b/sys/src/ape/lib/openssl/doc/crypto/lh_stats.pod deleted file mode 100644 index 3eeaa72e5..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/lh_stats.pod +++ /dev/null @@ -1,60 +0,0 @@ -=pod - -=head1 NAME - -lh_stats, lh_node_stats, lh_node_usage_stats, lh_stats_bio, -lh_node_stats_bio, lh_node_usage_stats_bio - LHASH statistics - -=head1 SYNOPSIS - - #include <openssl/lhash.h> - - void lh_stats(LHASH *table, FILE *out); - void lh_node_stats(LHASH *table, FILE *out); - void lh_node_usage_stats(LHASH *table, FILE *out); - - void lh_stats_bio(LHASH *table, BIO *out); - void lh_node_stats_bio(LHASH *table, BIO *out); - void lh_node_usage_stats_bio(LHASH *table, BIO *out); - -=head1 DESCRIPTION - -The B<LHASH> structure records statistics about most aspects of -accessing the hash table. This is mostly a legacy of Eric Young -writing this library for the reasons of implementing what looked like -a nice algorithm rather than for a particular software product. - -lh_stats() prints out statistics on the size of the hash table, how -many entries are in it, and the number and result of calls to the -routines in this library. - -lh_node_stats() prints the number of entries for each 'bucket' in the -hash table. - -lh_node_usage_stats() prints out a short summary of the state of the -hash table. It prints the 'load' and the 'actual load'. The load is -the average number of data items per 'bucket' in the hash table. The -'actual load' is the average number of items per 'bucket', but only -for buckets which contain entries. So the 'actual load' is the -average number of searches that will need to find an item in the hash -table, while the 'load' is the average number that will be done to -record a miss. - -lh_stats_bio(), lh_node_stats_bio() and lh_node_usage_stats_bio() -are the same as the above, except that the output goes to a B<BIO>. - -=head1 RETURN VALUES - -These functions do not return values. - -=head1 SEE ALSO - -L<bio(3)|bio(3)>, L<lhash(3)|lhash(3)> - -=head1 HISTORY - -These functions are available in all versions of SSLeay and OpenSSL. - -This manpage is derived from the SSLeay documentation. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/lhash.pod b/sys/src/ape/lib/openssl/doc/crypto/lhash.pod deleted file mode 100644 index dcdbb43a8..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/lhash.pod +++ /dev/null @@ -1,294 +0,0 @@ -=pod - -=head1 NAME - -lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, lh_doall_arg, lh_error - dynamic hash table - -=head1 SYNOPSIS - - #include <openssl/lhash.h> - - LHASH *lh_new(LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE compare); - void lh_free(LHASH *table); - - void *lh_insert(LHASH *table, void *data); - void *lh_delete(LHASH *table, void *data); - void *lh_retrieve(LHASH *table, void *data); - - void lh_doall(LHASH *table, LHASH_DOALL_FN_TYPE func); - void lh_doall_arg(LHASH *table, LHASH_DOALL_ARG_FN_TYPE func, - void *arg); - - int lh_error(LHASH *table); - - typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); - typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); - typedef void (*LHASH_DOALL_FN_TYPE)(const void *); - typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *); - -=head1 DESCRIPTION - -This library implements dynamic hash tables. The hash table entries -can be arbitrary structures. Usually they consist of key and value -fields. - -lh_new() creates a new B<LHASH> structure to store arbitrary data -entries, and provides the 'hash' and 'compare' callbacks to be used in -organising the table's entries. The B<hash> callback takes a pointer -to a table entry as its argument and returns an unsigned long hash -value for its key field. The hash value is normally truncated to a -power of 2, so make sure that your hash function returns well mixed -low order bits. The B<compare> callback takes two arguments (pointers -to two hash table entries), and returns 0 if their keys are equal, -non-zero otherwise. If your hash table will contain items of some -particular type and the B<hash> and B<compare> callbacks hash/compare -these types, then the B<DECLARE_LHASH_HASH_FN> and -B<IMPLEMENT_LHASH_COMP_FN> macros can be used to create callback -wrappers of the prototypes required by lh_new(). These provide -per-variable casts before calling the type-specific callbacks written -by the application author. These macros, as well as those used for -the "doall" callbacks, are defined as; - - #define DECLARE_LHASH_HASH_FN(f_name,o_type) \ - unsigned long f_name##_LHASH_HASH(const void *); - #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ - unsigned long f_name##_LHASH_HASH(const void *arg) { \ - o_type a = (o_type)arg; \ - return f_name(a); } - #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH - - #define DECLARE_LHASH_COMP_FN(f_name,o_type) \ - int f_name##_LHASH_COMP(const void *, const void *); - #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ - int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ - o_type a = (o_type)arg1; \ - o_type b = (o_type)arg2; \ - return f_name(a,b); } - #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP - - #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ - void f_name##_LHASH_DOALL(const void *); - #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ - void f_name##_LHASH_DOALL(const void *arg) { \ - o_type a = (o_type)arg; \ - f_name(a); } - #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL - - #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ - void f_name##_LHASH_DOALL_ARG(const void *, const void *); - #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ - void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg2) { \ - o_type a = (o_type)arg1; \ - a_type b = (a_type)arg2; \ - f_name(a,b); } - #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG - -An example of a hash table storing (pointers to) structures of type 'STUFF' -could be defined as follows; - - /* Calculates the hash value of 'tohash' (implemented elsewhere) */ - unsigned long STUFF_hash(const STUFF *tohash); - /* Orders 'arg1' and 'arg2' (implemented elsewhere) */ - int STUFF_cmp(const STUFF *arg1, const STUFF *arg2); - /* Create the type-safe wrapper functions for use in the LHASH internals */ - static IMPLEMENT_LHASH_HASH_FN(STUFF_hash, const STUFF *) - static IMPLEMENT_LHASH_COMP_FN(STUFF_cmp, const STUFF *); - /* ... */ - int main(int argc, char *argv[]) { - /* Create the new hash table using the hash/compare wrappers */ - LHASH *hashtable = lh_new(LHASH_HASH_FN(STUFF_hash), - LHASH_COMP_FN(STUFF_cmp)); - /* ... */ - } - -lh_free() frees the B<LHASH> structure B<table>. Allocated hash table -entries will not be freed; consider using lh_doall() to deallocate any -remaining entries in the hash table (see below). - -lh_insert() inserts the structure pointed to by B<data> into B<table>. -If there already is an entry with the same key, the old value is -replaced. Note that lh_insert() stores pointers, the data are not -copied. - -lh_delete() deletes an entry from B<table>. - -lh_retrieve() looks up an entry in B<table>. Normally, B<data> is -a structure with the key field(s) set; the function will return a -pointer to a fully populated structure. - -lh_doall() will, for every entry in the hash table, call B<func> with -the data item as its parameter. For lh_doall() and lh_doall_arg(), -function pointer casting should be avoided in the callbacks (see -B<NOTE>) - instead, either declare the callbacks to match the -prototype required in lh_new() or use the declare/implement macros to -create type-safe wrappers that cast variables prior to calling your -type-specific callbacks. An example of this is illustrated here where -the callback is used to cleanup resources for items in the hash table -prior to the hashtable itself being deallocated: - - /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */ - void STUFF_cleanup(STUFF *a); - /* Implement a prototype-compatible wrapper for "STUFF_cleanup" */ - IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF *) - /* ... then later in the code ... */ - /* So to run "STUFF_cleanup" against all items in a hash table ... */ - lh_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup)); - /* Then the hash table itself can be deallocated */ - lh_free(hashtable); - -When doing this, be careful if you delete entries from the hash table -in your callbacks: the table may decrease in size, moving the item -that you are currently on down lower in the hash table - this could -cause some entries to be skipped during the iteration. The second -best solution to this problem is to set hash-E<gt>down_load=0 before -you start (which will stop the hash table ever decreasing in size). -The best solution is probably to avoid deleting items from the hash -table inside a "doall" callback! - -lh_doall_arg() is the same as lh_doall() except that B<func> will be -called with B<arg> as the second argument and B<func> should be of -type B<LHASH_DOALL_ARG_FN_TYPE> (a callback prototype that is passed -both the table entry and an extra argument). As with lh_doall(), you -can instead choose to declare your callback with a prototype matching -the types you are dealing with and use the declare/implement macros to -create compatible wrappers that cast variables before calling your -type-specific callbacks. An example of this is demonstrated here -(printing all hash table entries to a BIO that is provided by the -caller): - - /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */ - void STUFF_print(const STUFF *a, BIO *output_bio); - /* Implement a prototype-compatible wrapper for "STUFF_print" */ - static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF_print, const STUFF *, BIO *) - /* ... then later in the code ... */ - /* Print out the entire hashtable to a particular BIO */ - lh_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), logging_bio); - -lh_error() can be used to determine if an error occurred in the last -operation. lh_error() is a macro. - -=head1 RETURN VALUES - -lh_new() returns B<NULL> on error, otherwise a pointer to the new -B<LHASH> structure. - -When a hash table entry is replaced, lh_insert() returns the value -being replaced. B<NULL> is returned on normal operation and on error. - -lh_delete() returns the entry being deleted. B<NULL> is returned if -there is no such value in the hash table. - -lh_retrieve() returns the hash table entry if it has been found, -B<NULL> otherwise. - -lh_error() returns 1 if an error occurred in the last operation, 0 -otherwise. - -lh_free(), lh_doall() and lh_doall_arg() return no values. - -=head1 NOTE - -The various LHASH macros and callback types exist to make it possible -to write type-safe code without resorting to function-prototype -casting - an evil that makes application code much harder to -audit/verify and also opens the window of opportunity for stack -corruption and other hard-to-find bugs. It also, apparently, violates -ANSI-C. - -The LHASH code regards table entries as constant data. As such, it -internally represents lh_insert()'d items with a "const void *" -pointer type. This is why callbacks such as those used by lh_doall() -and lh_doall_arg() declare their prototypes with "const", even for the -parameters that pass back the table items' data pointers - for -consistency, user-provided data is "const" at all times as far as the -LHASH code is concerned. However, as callers are themselves providing -these pointers, they can choose whether they too should be treating -all such parameters as constant. - -As an example, a hash table may be maintained by code that, for -reasons of encapsulation, has only "const" access to the data being -indexed in the hash table (ie. it is returned as "const" from -elsewhere in their code) - in this case the LHASH prototypes are -appropriate as-is. Conversely, if the caller is responsible for the -life-time of the data in question, then they may well wish to make -modifications to table item passed back in the lh_doall() or -lh_doall_arg() callbacks (see the "STUFF_cleanup" example above). If -so, the caller can either cast the "const" away (if they're providing -the raw callbacks themselves) or use the macros to declare/implement -the wrapper functions without "const" types. - -Callers that only have "const" access to data they're indexing in a -table, yet declare callbacks without constant types (or cast the -"const" away themselves), are therefore creating their own risks/bugs -without being encouraged to do so by the API. On a related note, -those auditing code should pay special attention to any instances of -DECLARE/IMPLEMENT_LHASH_DOALL_[ARG_]_FN macros that provide types -without any "const" qualifiers. - -=head1 BUGS - -lh_insert() returns B<NULL> both for success and error. - -=head1 INTERNALS - -The following description is based on the SSLeay documentation: - -The B<lhash> library implements a hash table described in the -I<Communications of the ACM> in 1991. What makes this hash table -different is that as the table fills, the hash table is increased (or -decreased) in size via OPENSSL_realloc(). When a 'resize' is done, instead of -all hashes being redistributed over twice as many 'buckets', one -bucket is split. So when an 'expand' is done, there is only a minimal -cost to redistribute some values. Subsequent inserts will cause more -single 'bucket' redistributions but there will never be a sudden large -cost due to redistributing all the 'buckets'. - -The state for a particular hash table is kept in the B<LHASH> structure. -The decision to increase or decrease the hash table size is made -depending on the 'load' of the hash table. The load is the number of -items in the hash table divided by the size of the hash table. The -default values are as follows. If (hash->up_load E<lt> load) =E<gt> -expand. if (hash-E<gt>down_load E<gt> load) =E<gt> contract. The -B<up_load> has a default value of 1 and B<down_load> has a default value -of 2. These numbers can be modified by the application by just -playing with the B<up_load> and B<down_load> variables. The 'load' is -kept in a form which is multiplied by 256. So -hash-E<gt>up_load=8*256; will cause a load of 8 to be set. - -If you are interested in performance the field to watch is -num_comp_calls. The hash library keeps track of the 'hash' value for -each item so when a lookup is done, the 'hashes' are compared, if -there is a match, then a full compare is done, and -hash-E<gt>num_comp_calls is incremented. If num_comp_calls is not equal -to num_delete plus num_retrieve it means that your hash function is -generating hashes that are the same for different values. It is -probably worth changing your hash function if this is the case because -even if your hash table has 10 items in a 'bucket', it can be searched -with 10 B<unsigned long> compares and 10 linked list traverses. This -will be much less expensive that 10 calls to your compare function. - -lh_strhash() is a demo string hashing function: - - unsigned long lh_strhash(const char *c); - -Since the B<LHASH> routines would normally be passed structures, this -routine would not normally be passed to lh_new(), rather it would be -used in the function passed to lh_new(). - -=head1 SEE ALSO - -L<lh_stats(3)|lh_stats(3)> - -=head1 HISTORY - -The B<lhash> library is available in all versions of SSLeay and OpenSSL. -lh_error() was added in SSLeay 0.9.1b. - -This manpage is derived from the SSLeay documentation. - -In OpenSSL 0.9.7, all lhash functions that were passed function pointers -were changed for better type safety, and the function types LHASH_COMP_FN_TYPE, -LHASH_HASH_FN_TYPE, LHASH_DOALL_FN_TYPE and LHASH_DOALL_ARG_FN_TYPE -became available. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/md5.pod b/sys/src/ape/lib/openssl/doc/crypto/md5.pod deleted file mode 100644 index d11d5c32c..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/md5.pod +++ /dev/null @@ -1,101 +0,0 @@ -=pod - -=head1 NAME - -MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, -MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions - -=head1 SYNOPSIS - - #include <openssl/md2.h> - - unsigned char *MD2(const unsigned char *d, unsigned long n, - unsigned char *md); - - int MD2_Init(MD2_CTX *c); - int MD2_Update(MD2_CTX *c, const unsigned char *data, - unsigned long len); - int MD2_Final(unsigned char *md, MD2_CTX *c); - - - #include <openssl/md4.h> - - unsigned char *MD4(const unsigned char *d, unsigned long n, - unsigned char *md); - - int MD4_Init(MD4_CTX *c); - int MD4_Update(MD4_CTX *c, const void *data, - unsigned long len); - int MD4_Final(unsigned char *md, MD4_CTX *c); - - - #include <openssl/md5.h> - - unsigned char *MD5(const unsigned char *d, unsigned long n, - unsigned char *md); - - int MD5_Init(MD5_CTX *c); - int MD5_Update(MD5_CTX *c, const void *data, - unsigned long len); - int MD5_Final(unsigned char *md, MD5_CTX *c); - -=head1 DESCRIPTION - -MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output. - -MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest -of the B<n> bytes at B<d> and place it in B<md> (which must have space -for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 -bytes of output). If B<md> is NULL, the digest is placed in a static -array. - -The following functions may be used if the message is not completely -stored in memory: - -MD2_Init() initializes a B<MD2_CTX> structure. - -MD2_Update() can be called repeatedly with chunks of the message to -be hashed (B<len> bytes at B<data>). - -MD2_Final() places the message digest in B<md>, which must have space -for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>. - -MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and -MD5_Final() are analogous using an B<MD4_CTX> and B<MD5_CTX> structure. - -Applications should use the higher level functions -L<EVP_DigestInit(3)|EVP_DigestInit(3)> -etc. instead of calling the hash functions directly. - -=head1 NOTE - -MD2, MD4, and MD5 are recommended only for compatibility with existing -applications. In new applications, SHA-1 or RIPEMD-160 should be -preferred. - -=head1 RETURN VALUES - -MD2(), MD4(), and MD5() return pointers to the hash value. - -MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), -MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for -success, 0 otherwise. - -=head1 CONFORMING TO - -RFC 1319, RFC 1320, RFC 1321 - -=head1 SEE ALSO - -L<sha(3)|sha(3)>, L<ripemd(3)|ripemd(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> - -=head1 HISTORY - -MD2(), MD2_Init(), MD2_Update() MD2_Final(), MD5(), MD5_Init(), -MD5_Update() and MD5_Final() are available in all versions of SSLeay -and OpenSSL. - -MD4(), MD4_Init(), and MD4_Update() are available in OpenSSL 0.9.6 and -above. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/mdc2.pod b/sys/src/ape/lib/openssl/doc/crypto/mdc2.pod deleted file mode 100644 index 41f648af3..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/mdc2.pod +++ /dev/null @@ -1,64 +0,0 @@ -=pod - -=head1 NAME - -MDC2, MDC2_Init, MDC2_Update, MDC2_Final - MDC2 hash function - -=head1 SYNOPSIS - - #include <openssl/mdc2.h> - - unsigned char *MDC2(const unsigned char *d, unsigned long n, - unsigned char *md); - - int MDC2_Init(MDC2_CTX *c); - int MDC2_Update(MDC2_CTX *c, const unsigned char *data, - unsigned long len); - int MDC2_Final(unsigned char *md, MDC2_CTX *c); - -=head1 DESCRIPTION - -MDC2 is a method to construct hash functions with 128 bit output from -block ciphers. These functions are an implementation of MDC2 with -DES. - -MDC2() computes the MDC2 message digest of the B<n> -bytes at B<d> and places it in B<md> (which must have space for -MDC2_DIGEST_LENGTH == 16 bytes of output). If B<md> is NULL, the digest -is placed in a static array. - -The following functions may be used if the message is not completely -stored in memory: - -MDC2_Init() initializes a B<MDC2_CTX> structure. - -MDC2_Update() can be called repeatedly with chunks of the message to -be hashed (B<len> bytes at B<data>). - -MDC2_Final() places the message digest in B<md>, which must have space -for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MDC2_CTX>. - -Applications should use the higher level functions -L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the -hash functions directly. - -=head1 RETURN VALUES - -MDC2() returns a pointer to the hash value. - -MDC2_Init(), MDC2_Update() and MDC2_Final() return 1 for success, 0 otherwise. - -=head1 CONFORMING TO - -ISO/IEC 10118-2, with DES - -=head1 SEE ALSO - -L<sha(3)|sha(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> - -=head1 HISTORY - -MDC2(), MDC2_Init(), MDC2_Update() and MDC2_Final() are available since -SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/pem.pod b/sys/src/ape/lib/openssl/doc/crypto/pem.pod deleted file mode 100644 index 4f9a27df0..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/pem.pod +++ /dev/null @@ -1,476 +0,0 @@ -=pod - -=head1 NAME - -PEM - PEM routines - -=head1 SYNOPSIS - - #include <openssl/pem.h> - - EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, - pem_password_cb *cb, void *u); - - EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - - EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, - pem_password_cb *cb, void *u); - - EVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x); - int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x); - - RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, - pem_password_cb *cb, void *u); - - RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, - pem_password_cb *cb, void *u); - - RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x); - - int PEM_write_RSAPublicKey(FILE *fp, RSA *x); - - RSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, - pem_password_cb *cb, void *u); - - RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x); - - int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x); - - DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, - pem_password_cb *cb, void *u); - - DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - - DSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, - pem_password_cb *cb, void *u); - - DSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x); - - int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x); - - DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u); - - DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u); - - int PEM_write_bio_DSAparams(BIO *bp, DSA *x); - - int PEM_write_DSAparams(FILE *fp, DSA *x); - - DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u); - - DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u); - - int PEM_write_bio_DHparams(BIO *bp, DH *x); - - int PEM_write_DHparams(FILE *fp, DH *x); - - X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u); - - X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u); - - int PEM_write_bio_X509(BIO *bp, X509 *x); - - int PEM_write_X509(FILE *fp, X509 *x); - - X509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u); - - X509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u); - - int PEM_write_bio_X509_AUX(BIO *bp, X509 *x); - - int PEM_write_X509_AUX(FILE *fp, X509 *x); - - X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, - pem_password_cb *cb, void *u); - - X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x); - - int PEM_write_X509_REQ(FILE *fp, X509_REQ *x); - - int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x); - - int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x); - - X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, - pem_password_cb *cb, void *u); - X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x, - pem_password_cb *cb, void *u); - int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x); - int PEM_write_X509_CRL(FILE *fp, X509_CRL *x); - - PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u); - - PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u); - - int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x); - - int PEM_write_PKCS7(FILE *fp, PKCS7 *x); - - NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, - NETSCAPE_CERT_SEQUENCE **x, - pem_password_cb *cb, void *u); - - NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, - NETSCAPE_CERT_SEQUENCE **x, - pem_password_cb *cb, void *u); - - int PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x); - - int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x); - -=head1 DESCRIPTION - -The PEM functions read or write structures in PEM format. In -this sense PEM format is simply base64 encoded data surrounded -by header lines. - -For more details about the meaning of arguments see the -B<PEM FUNCTION ARGUMENTS> section. - -Each operation has four functions associated with it. For -clarity the term "B<foobar> functions" will be used to collectively -refer to the PEM_read_bio_foobar(), PEM_read_foobar(), -PEM_write_bio_foobar() and PEM_write_foobar() functions. - -The B<PrivateKey> functions read or write a private key in -PEM format using an EVP_PKEY structure. The write routines use -"traditional" private key format and can handle both RSA and DSA -private keys. The read functions can additionally transparently -handle PKCS#8 format encrypted and unencrypted keys too. - -PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() -write a private key in an EVP_PKEY structure in PKCS#8 -EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption -algorithms. The B<cipher> argument specifies the encryption algoritm to -use: unlike all other PEM routines the encryption is applied at the -PKCS#8 level and not in the PEM headers. If B<cipher> is NULL then no -encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead. - -PEM_write_bio_PKCS8PrivateKey_nid() and PEM_write_PKCS8PrivateKey_nid() -also write out a private key as a PKCS#8 EncryptedPrivateKeyInfo however -it uses PKCS#5 v1.5 or PKCS#12 encryption algorithms instead. The algorithm -to use is specified in the B<nid> parameter and should be the NID of the -corresponding OBJECT IDENTIFIER (see NOTES section). - -The B<PUBKEY> functions process a public key using an EVP_PKEY -structure. The public key is encoded as a SubjectPublicKeyInfo -structure. - -The B<RSAPrivateKey> functions process an RSA private key using an -RSA structure. It handles the same formats as the B<PrivateKey> -functions but an error occurs if the private key is not RSA. - -The B<RSAPublicKey> functions process an RSA public key using an -RSA structure. The public key is encoded using a PKCS#1 RSAPublicKey -structure. - -The B<RSA_PUBKEY> functions also process an RSA public key using -an RSA structure. However the public key is encoded using a -SubjectPublicKeyInfo structure and an error occurs if the public -key is not RSA. - -The B<DSAPrivateKey> functions process a DSA private key using a -DSA structure. It handles the same formats as the B<PrivateKey> -functions but an error occurs if the private key is not DSA. - -The B<DSA_PUBKEY> functions process a DSA public key using -a DSA structure. The public key is encoded using a -SubjectPublicKeyInfo structure and an error occurs if the public -key is not DSA. - -The B<DSAparams> functions process DSA parameters using a DSA -structure. The parameters are encoded using a foobar structure. - -The B<DHparams> functions process DH parameters using a DH -structure. The parameters are encoded using a PKCS#3 DHparameter -structure. - -The B<X509> functions process an X509 certificate using an X509 -structure. They will also process a trusted X509 certificate but -any trust settings are discarded. - -The B<X509_AUX> functions process a trusted X509 certificate using -an X509 structure. - -The B<X509_REQ> and B<X509_REQ_NEW> functions process a PKCS#10 -certificate request using an X509_REQ structure. The B<X509_REQ> -write functions use B<CERTIFICATE REQUEST> in the header whereas -the B<X509_REQ_NEW> functions use B<NEW CERTIFICATE REQUEST> -(as required by some CAs). The B<X509_REQ> read functions will -handle either form so there are no B<X509_REQ_NEW> read functions. - -The B<X509_CRL> functions process an X509 CRL using an X509_CRL -structure. - -The B<PKCS7> functions process a PKCS#7 ContentInfo using a PKCS7 -structure. - -The B<NETSCAPE_CERT_SEQUENCE> functions process a Netscape Certificate -Sequence using a NETSCAPE_CERT_SEQUENCE structure. - -=head1 PEM FUNCTION ARGUMENTS - -The PEM functions have many common arguments. - -The B<bp> BIO parameter (if present) specifies the BIO to read from -or write to. - -The B<fp> FILE parameter (if present) specifies the FILE pointer to -read from or write to. - -The PEM read functions all take an argument B<TYPE **x> and return -a B<TYPE *> pointer. Where B<TYPE> is whatever structure the function -uses. If B<x> is NULL then the parameter is ignored. If B<x> is not -NULL but B<*x> is NULL then the structure returned will be written -to B<*x>. If neither B<x> nor B<*x> is NULL then an attempt is made -to reuse the structure at B<*x> (but see BUGS and EXAMPLES sections). -Irrespective of the value of B<x> a pointer to the structure is always -returned (or NULL if an error occurred). - -The PEM functions which write private keys take an B<enc> parameter -which specifies the encryption algorithm to use, encryption is done -at the PEM level. If this parameter is set to NULL then the private -key is written in unencrypted form. - -The B<cb> argument is the callback to use when querying for the pass -phrase used for encrypted PEM structures (normally only private keys). - -For the PEM write routines if the B<kstr> parameter is not NULL then -B<klen> bytes at B<kstr> are used as the passphrase and B<cb> is -ignored. - -If the B<cb> parameters is set to NULL and the B<u> parameter is not -NULL then the B<u> parameter is interpreted as a null terminated string -to use as the passphrase. If both B<cb> and B<u> are NULL then the -default callback routine is used which will typically prompt for the -passphrase on the current terminal with echoing turned off. - -The default passphrase callback is sometimes inappropriate (for example -in a GUI application) so an alternative can be supplied. The callback -routine has the following form: - - int cb(char *buf, int size, int rwflag, void *u); - -B<buf> is the buffer to write the passphrase to. B<size> is the maximum -length of the passphrase (i.e. the size of buf). B<rwflag> is a flag -which is set to 0 when reading and 1 when writing. A typical routine -will ask the user to verify the passphrase (for example by prompting -for it twice) if B<rwflag> is 1. The B<u> parameter has the same -value as the B<u> parameter passed to the PEM routine. It allows -arbitrary data to be passed to the callback by the application -(for example a window handle in a GUI application). The callback -B<must> return the number of characters in the passphrase or 0 if -an error occurred. - -=head1 EXAMPLES - -Although the PEM routines take several arguments in almost all applications -most of them are set to 0 or NULL. - -Read a certificate in PEM format from a BIO: - - X509 *x; - x = PEM_read_bio_X509(bp, NULL, 0, NULL); - if (x == NULL) - { - /* Error */ - } - -Alternative method: - - X509 *x = NULL; - if (!PEM_read_bio_X509(bp, &x, 0, NULL)) - { - /* Error */ - } - -Write a certificate to a BIO: - - if (!PEM_write_bio_X509(bp, x)) - { - /* Error */ - } - -Write an unencrypted private key to a FILE pointer: - - if (!PEM_write_PrivateKey(fp, key, NULL, NULL, 0, 0, NULL)) - { - /* Error */ - } - -Write a private key (using traditional format) to a BIO using -triple DES encryption, the pass phrase is prompted for: - - if (!PEM_write_bio_PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, NULL)) - { - /* Error */ - } - -Write a private key (using PKCS#8 format) to a BIO using triple -DES encryption, using the pass phrase "hello": - - if (!PEM_write_bio_PKCS8PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, "hello")) - { - /* Error */ - } - -Read a private key from a BIO using the pass phrase "hello": - - key = PEM_read_bio_PrivateKey(bp, NULL, 0, "hello"); - if (key == NULL) - { - /* Error */ - } - -Read a private key from a BIO using a pass phrase callback: - - key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, "My Private Key"); - if (key == NULL) - { - /* Error */ - } - -Skeleton pass phrase callback: - - int pass_cb(char *buf, int size, int rwflag, void *u); - { - int len; - char *tmp; - /* We'd probably do something else if 'rwflag' is 1 */ - printf("Enter pass phrase for \"%s\"\n", u); - - /* get pass phrase, length 'len' into 'tmp' */ - tmp = "hello"; - len = strlen(tmp); - - if (len <= 0) return 0; - /* if too long, truncate */ - if (len > size) len = size; - memcpy(buf, tmp, len); - return len; - } - -=head1 NOTES - -The old B<PrivateKey> write routines are retained for compatibility. -New applications should write private keys using the -PEM_write_bio_PKCS8PrivateKey() or PEM_write_PKCS8PrivateKey() routines -because they are more secure (they use an iteration count of 2048 whereas -the traditional routines use a count of 1) unless compatibility with older -versions of OpenSSL is important. - -The B<PrivateKey> read routines can be used in all applications because -they handle all formats transparently. - -A frequent cause of problems is attempting to use the PEM routines like -this: - - X509 *x; - PEM_read_bio_X509(bp, &x, 0, NULL); - -this is a bug because an attempt will be made to reuse the data at B<x> -which is an uninitialised pointer. - -=head1 PEM ENCRYPTION FORMAT - -This old B<PrivateKey> routines use a non standard technique for encryption. - -The private key (or other data) takes the following form: - - -----BEGIN RSA PRIVATE KEY----- - Proc-Type: 4,ENCRYPTED - DEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89 - - ...base64 encoded data... - -----END RSA PRIVATE KEY----- - -The line beginning DEK-Info contains two comma separated pieces of information: -the encryption algorithm name as used by EVP_get_cipherbyname() and an 8 -byte B<salt> encoded as a set of hexadecimal digits. - -After this is the base64 encoded encrypted data. - -The encryption key is determined using EVP_bytestokey(), using B<salt> and an -iteration count of 1. The IV used is the value of B<salt> and *not* the IV -returned by EVP_bytestokey(). - -=head1 BUGS - -The PEM read routines in some versions of OpenSSL will not correctly reuse -an existing structure. Therefore the following: - - PEM_read_bio_X509(bp, &x, 0, NULL); - -where B<x> already contains a valid certificate, may not work, whereas: - - X509_free(x); - x = PEM_read_bio_X509(bp, NULL, 0, NULL); - -is guaranteed to work. - -=head1 RETURN CODES - -The read routines return either a pointer to the structure read or NULL -if an error occurred. - -The write routines return 1 for success or 0 for failure. diff --git a/sys/src/ape/lib/openssl/doc/crypto/rand.pod b/sys/src/ape/lib/openssl/doc/crypto/rand.pod deleted file mode 100644 index 1c068c85b..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/rand.pod +++ /dev/null @@ -1,175 +0,0 @@ -=pod - -=head1 NAME - -rand - pseudo-random number generator - -=head1 SYNOPSIS - - #include <openssl/rand.h> - - int RAND_set_rand_engine(ENGINE *engine); - - int RAND_bytes(unsigned char *buf, int num); - int RAND_pseudo_bytes(unsigned char *buf, int num); - - void RAND_seed(const void *buf, int num); - void RAND_add(const void *buf, int num, int entropy); - int RAND_status(void); - - int RAND_load_file(const char *file, long max_bytes); - int RAND_write_file(const char *file); - const char *RAND_file_name(char *file, size_t num); - - int RAND_egd(const char *path); - - void RAND_set_rand_method(const RAND_METHOD *meth); - const RAND_METHOD *RAND_get_rand_method(void); - RAND_METHOD *RAND_SSLeay(void); - - void RAND_cleanup(void); - - /* For Win32 only */ - void RAND_screen(void); - int RAND_event(UINT, WPARAM, LPARAM); - -=head1 DESCRIPTION - -Since the introduction of the ENGINE API, the recommended way of controlling -default implementations is by using the ENGINE API functions. The default -B<RAND_METHOD>, as set by RAND_set_rand_method() and returned by -RAND_get_rand_method(), is only used if no ENGINE has been set as the default -"rand" implementation. Hence, these two functions are no longer the recommened -way to control defaults. - -If an alternative B<RAND_METHOD> implementation is being used (either set -directly or as provided by an ENGINE module), then it is entirely responsible -for the generation and management of a cryptographically secure PRNG stream. The -mechanisms described below relate solely to the software PRNG implementation -built in to OpenSSL and used by default. - -These functions implement a cryptographically secure pseudo-random -number generator (PRNG). It is used by other library functions for -example to generate random keys, and applications can use it when they -need randomness. - -A cryptographic PRNG must be seeded with unpredictable data such as -mouse movements or keys pressed at random by the user. This is -described in L<RAND_add(3)|RAND_add(3)>. Its state can be saved in a seed file -(see L<RAND_load_file(3)|RAND_load_file(3)>) to avoid having to go through the -seeding process whenever the application is started. - -L<RAND_bytes(3)|RAND_bytes(3)> describes how to obtain random data from the -PRNG. - -=head1 INTERNALS - -The RAND_SSLeay() method implements a PRNG based on a cryptographic -hash function. - -The following description of its design is based on the SSLeay -documentation: - -First up I will state the things I believe I need for a good RNG. - -=over 4 - -=item 1 - -A good hashing algorithm to mix things up and to convert the RNG 'state' -to random numbers. - -=item 2 - -An initial source of random 'state'. - -=item 3 - -The state should be very large. If the RNG is being used to generate -4096 bit RSA keys, 2 2048 bit random strings are required (at a minimum). -If your RNG state only has 128 bits, you are obviously limiting the -search space to 128 bits, not 2048. I'm probably getting a little -carried away on this last point but it does indicate that it may not be -a bad idea to keep quite a lot of RNG state. It should be easier to -break a cipher than guess the RNG seed data. - -=item 4 - -Any RNG seed data should influence all subsequent random numbers -generated. This implies that any random seed data entered will have -an influence on all subsequent random numbers generated. - -=item 5 - -When using data to seed the RNG state, the data used should not be -extractable from the RNG state. I believe this should be a -requirement because one possible source of 'secret' semi random -data would be a private key or a password. This data must -not be disclosed by either subsequent random numbers or a -'core' dump left by a program crash. - -=item 6 - -Given the same initial 'state', 2 systems should deviate in their RNG state -(and hence the random numbers generated) over time if at all possible. - -=item 7 - -Given the random number output stream, it should not be possible to determine -the RNG state or the next random number. - -=back - -The algorithm is as follows. - -There is global state made up of a 1023 byte buffer (the 'state'), a -working hash value ('md'), and a counter ('count'). - -Whenever seed data is added, it is inserted into the 'state' as -follows. - -The input is chopped up into units of 20 bytes (or less for -the last block). Each of these blocks is run through the hash -function as follows: The data passed to the hash function -is the current 'md', the same number of bytes from the 'state' -(the location determined by in incremented looping index) as -the current 'block', the new key data 'block', and 'count' -(which is incremented after each use). -The result of this is kept in 'md' and also xored into the -'state' at the same locations that were used as input into the -hash function. I -believe this system addresses points 1 (hash function; currently -SHA-1), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash -function and xor). - -When bytes are extracted from the RNG, the following process is used. -For each group of 10 bytes (or less), we do the following: - -Input into the hash function the local 'md' (which is initialized from -the global 'md' before any bytes are generated), the bytes that are to -be overwritten by the random bytes, and bytes from the 'state' -(incrementing looping index). From this digest output (which is kept -in 'md'), the top (up to) 10 bytes are returned to the caller and the -bottom 10 bytes are xored into the 'state'. - -Finally, after we have finished 'num' random bytes for the caller, -'count' (which is incremented) and the local and global 'md' are fed -into the hash function and the results are kept in the global 'md'. - -I believe the above addressed points 1 (use of SHA-1), 6 (by hashing -into the 'state' the 'old' data from the caller that is about to be -overwritten) and 7 (by not using the 10 bytes given to the caller to -update the 'state', but they are used to update 'md'). - -So of the points raised, only 2 is not addressed (but see -L<RAND_add(3)|RAND_add(3)>). - -=head1 SEE ALSO - -L<BN_rand(3)|BN_rand(3)>, L<RAND_add(3)|RAND_add(3)>, -L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_egd(3)|RAND_egd(3)>, -L<RAND_bytes(3)|RAND_bytes(3)>, -L<RAND_set_rand_method(3)|RAND_set_rand_method(3)>, -L<RAND_cleanup(3)|RAND_cleanup(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/rc4.pod b/sys/src/ape/lib/openssl/doc/crypto/rc4.pod deleted file mode 100644 index b6d3a4342..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/rc4.pod +++ /dev/null @@ -1,62 +0,0 @@ -=pod - -=head1 NAME - -RC4_set_key, RC4 - RC4 encryption - -=head1 SYNOPSIS - - #include <openssl/rc4.h> - - void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); - - void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, - unsigned char *outdata); - -=head1 DESCRIPTION - -This library implements the Alleged RC4 cipher, which is described for -example in I<Applied Cryptography>. It is believed to be compatible -with RC4[TM], a proprietary cipher of RSA Security Inc. - -RC4 is a stream cipher with variable key length. Typically, 128 bit -(16 byte) keys are used for strong encryption, but shorter insecure -key sizes have been widely used due to export restrictions. - -RC4 consists of a key setup phase and the actual encryption or -decryption phase. - -RC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long -key at B<data>. - -RC4() encrypts or decrypts the B<len> bytes of data at B<indata> using -B<key> and places the result at B<outdata>. Repeated RC4() calls with -the same B<key> yield a continuous key stream. - -Since RC4 is a stream cipher (the input is XORed with a pseudo-random -key stream to produce the output), decryption uses the same function -calls as encryption. - -Applications should use the higher level functions -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> -etc. instead of calling the RC4 functions directly. - -=head1 RETURN VALUES - -RC4_set_key() and RC4() do not return values. - -=head1 NOTE - -Certain conditions have to be observed to securely use stream ciphers. -It is not permissible to perform multiple encryptions using the same -key stream. - -=head1 SEE ALSO - -L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<rc2(3)|rc2(3)> - -=head1 HISTORY - -RC4_set_key() and RC4() are available in all versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ripemd.pod b/sys/src/ape/lib/openssl/doc/crypto/ripemd.pod deleted file mode 100644 index 264bb99ae..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ripemd.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final - -RIPEMD-160 hash function - -=head1 SYNOPSIS - - #include <openssl/ripemd.h> - - unsigned char *RIPEMD160(const unsigned char *d, unsigned long n, - unsigned char *md); - - int RIPEMD160_Init(RIPEMD160_CTX *c); - int RIPEMD160_Update(RIPEMD_CTX *c, const void *data, - unsigned long len); - int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); - -=head1 DESCRIPTION - -RIPEMD-160 is a cryptographic hash function with a -160 bit output. - -RIPEMD160() computes the RIPEMD-160 message digest of the B<n> -bytes at B<d> and places it in B<md> (which must have space for -RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest -is placed in a static array. - -The following functions may be used if the message is not completely -stored in memory: - -RIPEMD160_Init() initializes a B<RIPEMD160_CTX> structure. - -RIPEMD160_Update() can be called repeatedly with chunks of the message to -be hashed (B<len> bytes at B<data>). - -RIPEMD160_Final() places the message digest in B<md>, which must have -space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output, and erases -the B<RIPEMD160_CTX>. - -Applications should use the higher level functions -L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the -hash functions directly. - -=head1 RETURN VALUES - -RIPEMD160() returns a pointer to the hash value. - -RIPEMD160_Init(), RIPEMD160_Update() and RIPEMD160_Final() return 1 for -success, 0 otherwise. - -=head1 CONFORMING TO - -ISO/IEC 10118-3 (draft) (??) - -=head1 SEE ALSO - -L<sha(3)|sha(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> - -=head1 HISTORY - -RIPEMD160(), RIPEMD160_Init(), RIPEMD160_Update() and -RIPEMD160_Final() are available since SSLeay 0.9.0. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/rsa.pod b/sys/src/ape/lib/openssl/doc/crypto/rsa.pod deleted file mode 100644 index 45ac53ffc..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/rsa.pod +++ /dev/null @@ -1,123 +0,0 @@ -=pod - -=head1 NAME - -rsa - RSA public key cryptosystem - -=head1 SYNOPSIS - - #include <openssl/rsa.h> - #include <openssl/engine.h> - - RSA * RSA_new(void); - void RSA_free(RSA *rsa); - - int RSA_public_encrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - int RSA_private_decrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); - int RSA_private_encrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa,int padding); - int RSA_public_decrypt(int flen, unsigned char *from, - unsigned char *to, RSA *rsa,int padding); - - int RSA_sign(int type, unsigned char *m, unsigned int m_len, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); - int RSA_verify(int type, unsigned char *m, unsigned int m_len, - unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - - int RSA_size(const RSA *rsa); - - RSA *RSA_generate_key(int num, unsigned long e, - void (*callback)(int,int,void *), void *cb_arg); - - int RSA_check_key(RSA *rsa); - - int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); - void RSA_blinding_off(RSA *rsa); - - void RSA_set_default_method(const RSA_METHOD *meth); - const RSA_METHOD *RSA_get_default_method(void); - int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - const RSA_METHOD *RSA_get_method(const RSA *rsa); - RSA_METHOD *RSA_PKCS1_SSLeay(void); - RSA_METHOD *RSA_null_method(void); - int RSA_flags(const RSA *rsa); - RSA *RSA_new_method(ENGINE *engine); - - int RSA_print(BIO *bp, RSA *x, int offset); - int RSA_print_fp(FILE *fp, RSA *x, int offset); - - int RSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), - int (*dup_func)(), void (*free_func)()); - int RSA_set_ex_data(RSA *r,int idx,char *arg); - char *RSA_get_ex_data(RSA *r, int idx); - - int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m, - unsigned int m_len, unsigned char *sigret, unsigned int *siglen, - RSA *rsa); - int RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m, - unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, - RSA *rsa); - -=head1 DESCRIPTION - -These functions implement RSA public key encryption and signatures -as defined in PKCS #1 v2.0 [RFC 2437]. - -The B<RSA> structure consists of several BIGNUM components. It can -contain public as well as private RSA keys: - - struct - { - BIGNUM *n; // public modulus - BIGNUM *e; // public exponent - BIGNUM *d; // private exponent - BIGNUM *p; // secret prime factor - BIGNUM *q; // secret prime factor - BIGNUM *dmp1; // d mod (p-1) - BIGNUM *dmq1; // d mod (q-1) - BIGNUM *iqmp; // q^-1 mod p - // ... - }; - RSA - -In public keys, the private exponent and the related secret values are -B<NULL>. - -B<p>, B<q>, B<dmp1>, B<dmq1> and B<iqmp> may be B<NULL> in private -keys, but the RSA operations are much faster when these values are -available. - -Note that RSA keys may use non-standard B<RSA_METHOD> implementations, -either directly or by the use of B<ENGINE> modules. In some cases (eg. an -ENGINE providing support for hardware-embedded keys), these BIGNUM values -will not be used by the implementation or may be used for alternative data -storage. For this reason, applications should generally avoid using RSA -structure elements directly and instead use API functions to query or -modify keys. - -=head1 CONFORMING TO - -SSL, PKCS #1 v2.0 - -=head1 PATENTS - -RSA was covered by a US patent which expired in September 2000. - -=head1 SEE ALSO - -L<rsa(1)|rsa(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, -L<rand(3)|rand(3)>, L<engine(3)|engine(3)>, L<RSA_new(3)|RSA_new(3)>, -L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>, -L<RSA_sign(3)|RSA_sign(3)>, L<RSA_size(3)|RSA_size(3)>, -L<RSA_generate_key(3)|RSA_generate_key(3)>, -L<RSA_check_key(3)|RSA_check_key(3)>, -L<RSA_blinding_on(3)|RSA_blinding_on(3)>, -L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>, -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, -L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, -L<RSA_sign_ASN1_OCTET_STRING(3)|RSA_sign_ASN1_OCTET_STRING(3)>, -L<RSA_padding_add_PKCS1_type_1(3)|RSA_padding_add_PKCS1_type_1(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/sha.pod b/sys/src/ape/lib/openssl/doc/crypto/sha.pod deleted file mode 100644 index 94ab7bc72..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/sha.pod +++ /dev/null @@ -1,70 +0,0 @@ -=pod - -=head1 NAME - -SHA1, SHA1_Init, SHA1_Update, SHA1_Final - Secure Hash Algorithm - -=head1 SYNOPSIS - - #include <openssl/sha.h> - - unsigned char *SHA1(const unsigned char *d, unsigned long n, - unsigned char *md); - - int SHA1_Init(SHA_CTX *c); - int SHA1_Update(SHA_CTX *c, const void *data, - unsigned long len); - int SHA1_Final(unsigned char *md, SHA_CTX *c); - -=head1 DESCRIPTION - -SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a -160 bit output. - -SHA1() computes the SHA-1 message digest of the B<n> -bytes at B<d> and places it in B<md> (which must have space for -SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest -is placed in a static array. - -The following functions may be used if the message is not completely -stored in memory: - -SHA1_Init() initializes a B<SHA_CTX> structure. - -SHA1_Update() can be called repeatedly with chunks of the message to -be hashed (B<len> bytes at B<data>). - -SHA1_Final() places the message digest in B<md>, which must have space -for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>. - -Applications should use the higher level functions -L<EVP_DigestInit(3)|EVP_DigestInit(3)> -etc. instead of calling the hash functions directly. - -The predecessor of SHA-1, SHA, is also implemented, but it should be -used only when backward compatibility is required. - -=head1 RETURN VALUES - -SHA1() returns a pointer to the hash value. - -SHA1_Init(), SHA1_Update() and SHA1_Final() return 1 for success, 0 otherwise. - -=head1 CONFORMING TO - -SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash -Standard), -SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash -Standard), -ANSI X9.30 - -=head1 SEE ALSO - -L<ripemd(3)|ripemd(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> - -=head1 HISTORY - -SHA1(), SHA1_Init(), SHA1_Update() and SHA1_Final() are available in all -versions of SSLeay and OpenSSL. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/threads.pod b/sys/src/ape/lib/openssl/doc/crypto/threads.pod deleted file mode 100644 index 3df4ecd77..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/threads.pod +++ /dev/null @@ -1,175 +0,0 @@ -=pod - -=head1 NAME - -CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks, -CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback, -CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid, -CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support - -=head1 SYNOPSIS - - #include <openssl/crypto.h> - - void CRYPTO_set_locking_callback(void (*locking_function)(int mode, - int n, const char *file, int line)); - - void CRYPTO_set_id_callback(unsigned long (*id_function)(void)); - - int CRYPTO_num_locks(void); - - - /* struct CRYPTO_dynlock_value needs to be defined by the user */ - struct CRYPTO_dynlock_value; - - void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value * - (*dyn_create_function)(char *file, int line)); - void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) - (int mode, struct CRYPTO_dynlock_value *l, - const char *file, int line)); - void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) - (struct CRYPTO_dynlock_value *l, const char *file, int line)); - - int CRYPTO_get_new_dynlockid(void); - - void CRYPTO_destroy_dynlockid(int i); - - void CRYPTO_lock(int mode, int n, const char *file, int line); - - #define CRYPTO_w_lock(type) \ - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) - #define CRYPTO_w_unlock(type) \ - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) - #define CRYPTO_r_lock(type) \ - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) - #define CRYPTO_r_unlock(type) \ - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) - #define CRYPTO_add(addr,amount,type) \ - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) - -=head1 DESCRIPTION - -OpenSSL can safely be used in multi-threaded applications provided -that at least two callback functions are set. - -locking_function(int mode, int n, const char *file, int line) is -needed to perform locking on shared data structures. -(Note that OpenSSL uses a number of global data structures that -will be implicitly shared whenever multiple threads use OpenSSL.) -Multi-threaded applications will crash at random if it is not set. - -locking_function() must be able to handle up to CRYPTO_num_locks() -different mutex locks. It sets the B<n>-th lock if B<mode> & -B<CRYPTO_LOCK>, and releases it otherwise. - -B<file> and B<line> are the file number of the function setting the -lock. They can be useful for debugging. - -id_function(void) is a function that returns a thread ID, for example -pthread_self() if it returns an integer (see NOTES below). It isn't -needed on Windows nor on platforms where getpid() returns a different -ID for each thread (see NOTES below). - -Additionally, OpenSSL supports dynamic locks, and sometimes, some parts -of OpenSSL need it for better performance. To enable this, the following -is required: - -=over 4 - -=item * -Three additional callback function, dyn_create_function, dyn_lock_function -and dyn_destroy_function. - -=item * -A structure defined with the data that each lock needs to handle. - -=back - -struct CRYPTO_dynlock_value has to be defined to contain whatever structure -is needed to handle locks. - -dyn_create_function(const char *file, int line) is needed to create a -lock. Multi-threaded applications might crash at random if it is not set. - -dyn_lock_function(int mode, CRYPTO_dynlock *l, const char *file, int line) -is needed to perform locking off dynamic lock numbered n. Multi-threaded -applications might crash at random if it is not set. - -dyn_destroy_function(CRYPTO_dynlock *l, const char *file, int line) is -needed to destroy the lock l. Multi-threaded applications might crash at -random if it is not set. - -CRYPTO_get_new_dynlockid() is used to create locks. It will call -dyn_create_function for the actual creation. - -CRYPTO_destroy_dynlockid() is used to destroy locks. It will call -dyn_destroy_function for the actual destruction. - -CRYPTO_lock() is used to lock and unlock the locks. mode is a bitfield -describing what should be done with the lock. n is the number of the -lock as returned from CRYPTO_get_new_dynlockid(). mode can be combined -from the following values. These values are pairwise exclusive, with -undefined behaviour if misused (for example, CRYPTO_READ and CRYPTO_WRITE -should not be used together): - - CRYPTO_LOCK 0x01 - CRYPTO_UNLOCK 0x02 - CRYPTO_READ 0x04 - CRYPTO_WRITE 0x08 - -=head1 RETURN VALUES - -CRYPTO_num_locks() returns the required number of locks. - -CRYPTO_get_new_dynlockid() returns the index to the newly created lock. - -The other functions return no values. - -=head1 NOTES - -You can find out if OpenSSL was configured with thread support: - - #define OPENSSL_THREAD_DEFINES - #include <openssl/opensslconf.h> - #if defined(OPENSSL_THREADS) - // thread support enabled - #else - // no thread support - #endif - -Also, dynamic locks are currently not used internally by OpenSSL, but -may do so in the future. - -Defining id_function(void) has it's own issues. Generally speaking, -pthread_self() should be used, even on platforms where getpid() gives -different answers in each thread, since that may depend on the machine -the program is run on, not the machine where the program is being -compiled. For instance, Red Hat 8 Linux and earlier used -LinuxThreads, whose getpid() returns a different value for each -thread. Red Hat 9 Linux and later use NPTL, which is -Posix-conformant, and has a getpid() that returns the same value for -all threads in a process. A program compiled on Red Hat 8 and run on -Red Hat 9 will therefore see getpid() returning the same value for -all threads. - -There is still the issue of platforms where pthread_self() returns -something other than an integer. This is a bit unusual, and this -manual has no cookbook solution for that case. - -=head1 EXAMPLES - -B<crypto/threads/mttest.c> shows examples of the callback functions on -Solaris, Irix and Win32. - -=head1 HISTORY - -CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are -available in all versions of SSLeay and OpenSSL. -CRYPTO_num_locks() was added in OpenSSL 0.9.4. -All functions dealing with dynamic locks were added in OpenSSL 0.9.5b-dev. - -=head1 SEE ALSO - -L<crypto(3)|crypto(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ui.pod b/sys/src/ape/lib/openssl/doc/crypto/ui.pod deleted file mode 100644 index 6df68d604..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ui.pod +++ /dev/null @@ -1,194 +0,0 @@ -=pod - -=head1 NAME - -UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string, -UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean, -UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string, -UI_add_error_string, UI_dup_error_string, UI_construct_prompt, -UI_add_user_data, UI_get0_user_data, UI_get0_result, UI_process, -UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method, -UI_set_method, UI_OpenSSL, ERR_load_UI_strings - New User Interface - -=head1 SYNOPSIS - - #include <openssl/ui.h> - - typedef struct ui_st UI; - typedef struct ui_method_st UI_METHOD; - - UI *UI_new(void); - UI *UI_new_method(const UI_METHOD *method); - void UI_free(UI *ui); - - int UI_add_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); - int UI_dup_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); - int UI_add_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, const char *test_buf); - int UI_dup_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, const char *test_buf); - int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); - int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); - int UI_add_info_string(UI *ui, const char *text); - int UI_dup_info_string(UI *ui, const char *text); - int UI_add_error_string(UI *ui, const char *text); - int UI_dup_error_string(UI *ui, const char *text); - - /* These are the possible flags. They can be or'ed together. */ - #define UI_INPUT_FLAG_ECHO 0x01 - #define UI_INPUT_FLAG_DEFAULT_PWD 0x02 - - char *UI_construct_prompt(UI *ui_method, - const char *object_desc, const char *object_name); - - void *UI_add_user_data(UI *ui, void *user_data); - void *UI_get0_user_data(UI *ui); - - const char *UI_get0_result(UI *ui, int i); - - int UI_process(UI *ui); - - int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)()); - #define UI_CTRL_PRINT_ERRORS 1 - #define UI_CTRL_IS_REDOABLE 2 - - void UI_set_default_method(const UI_METHOD *meth); - const UI_METHOD *UI_get_default_method(void); - const UI_METHOD *UI_get_method(UI *ui); - const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); - - UI_METHOD *UI_OpenSSL(void); - -=head1 DESCRIPTION - -UI stands for User Interface, and is general purpose set of routines to -prompt the user for text-based information. Through user-written methods -(see L<ui_create(3)|ui_create(3)>), prompting can be done in any way -imaginable, be it plain text prompting, through dialog boxes or from a -cell phone. - -All the functions work through a context of the type UI. This context -contains all the information needed to prompt correctly as well as a -reference to a UI_METHOD, which is an ordered vector of functions that -carry out the actual prompting. - -The first thing to do is to create a UI with UI_new() or UI_new_method(), -then add information to it with the UI_add or UI_dup functions. Also, -user-defined random data can be passed down to the underlying method -through calls to UI_add_user_data. The default UI method doesn't care -about these data, but other methods might. Finally, use UI_process() -to actually perform the prompting and UI_get0_result() to find the result -to the prompt. - -A UI can contain more than one prompt, which are performed in the given -sequence. Each prompt gets an index number which is returned by the -UI_add and UI_dup functions, and has to be used to get the corresponding -result with UI_get0_result(). - -The functions are as follows: - -UI_new() creates a new UI using the default UI method. When done with -this UI, it should be freed using UI_free(). - -UI_new_method() creates a new UI using the given UI method. When done with -this UI, it should be freed using UI_free(). - -UI_OpenSSL() returns the built-in UI method (note: not the default one, -since the default can be changed. See further on). This method is the -most machine/OS dependent part of OpenSSL and normally generates the -most problems when porting. - -UI_free() removes a UI from memory, along with all other pieces of memory -that's connected to it, like duplicated input strings, results and others. - -UI_add_input_string() and UI_add_verify_string() add a prompt to the UI, -as well as flags and a result buffer and the desired minimum and maximum -sizes of the result. The given information is used to prompt for -information, for example a password, and to verify a password (i.e. having -the user enter it twice and check that the same string was entered twice). -UI_add_verify_string() takes and extra argument that should be a pointer -to the result buffer of the input string that it's supposed to verify, or -verification will fail. - -UI_add_input_boolean() adds a prompt to the UI that's supposed to be answered -in a boolean way, with a single character for yes and a different character -for no. A set of characters that can be used to cancel the prompt is given -as well. The prompt itself is really divided in two, one part being the -descriptive text (given through the I<prompt> argument) and one describing -the possible answers (given through the I<action_desc> argument). - -UI_add_info_string() and UI_add_error_string() add strings that are shown at -the same time as the prompt for extra information or to show an error string. -The difference between the two is only conceptual. With the builtin method, -there's no technical difference between them. Other methods may make a -difference between them, however. - -The flags currently supported are UI_INPUT_FLAG_ECHO, which is relevant for -UI_add_input_string() and will have the users response be echoed (when -prompting for a password, this flag should obviously not be used, and -UI_INPUT_FLAG_DEFAULT_PWD, which means that a default password of some -sort will be used (completely depending on the application and the UI -method). - -UI_dup_input_string(), UI_dup_verify_string(), UI_dup_input_boolean(), -UI_dup_info_string() and UI_dup_error_string() are basically the same -as their UI_add counterparts, except that they make their own copies -of all strings. - -UI_construct_prompt() is a helper function that can be used to create -a prompt from two pieces of information: an description and a name. -The default constructor (if there is none provided by the method used) -creates a string "Enter I<description> for I<name>:". With the -description "pass phrase" and the file name "foo.key", that becomes -"Enter pass phrase for foo.key:". Other methods may create whatever -string and may include encodings that will be processed by the other -method functions. - -UI_add_user_data() adds a piece of memory for the method to use at any -time. The builtin UI method doesn't care about this info. Note that several -calls to this function doesn't add data, it replaces the previous blob -with the one given as argument. - -UI_get0_user_data() retrieves the data that has last been given to the -UI with UI_add_user_data(). - -UI_get0_result() returns a pointer to the result buffer associated with -the information indexed by I<i>. - -UI_process() goes through the information given so far, does all the printing -and prompting and returns. - -UI_ctrl() adds extra control for the application author. For now, it -understands two commands: UI_CTRL_PRINT_ERRORS, which makes UI_process() -print the OpenSSL error stack as part of processing the UI, and -UI_CTRL_IS_REDOABLE, which returns a flag saying if the used UI can -be used again or not. - -UI_set_default_method() changes the default UI method to the one given. - -UI_get_default_method() returns a pointer to the current default UI method. - -UI_get_method() returns the UI method associated with a given UI. - -UI_set_method() changes the UI method associated with a given UI. - -=head1 SEE ALSO - -L<ui_create(3)|ui_create(3)>, L<ui_compat(3)|ui_compat(3)> - -=head1 HISTORY - -The UI section was first introduced in OpenSSL 0.9.7. - -=head1 AUTHOR - -Richard Levitte (richard@levitte.org) for the OpenSSL project -(http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/ui_compat.pod b/sys/src/ape/lib/openssl/doc/crypto/ui_compat.pod deleted file mode 100644 index 9ab3c69bf..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/ui_compat.pod +++ /dev/null @@ -1,55 +0,0 @@ -=pod - -=head1 NAME - -des_read_password, des_read_2passwords, des_read_pw_string, des_read_pw - -Compatibility user interface functions - -=head1 SYNOPSIS - - int des_read_password(DES_cblock *key,const char *prompt,int verify); - int des_read_2passwords(DES_cblock *key1,DES_cblock *key2, - const char *prompt,int verify); - - int des_read_pw_string(char *buf,int length,const char *prompt,int verify); - int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); - -=head1 DESCRIPTION - -The DES library contained a few routines to prompt for passwords. These -aren't necessarely dependent on DES, and have therefore become part of the -UI compatibility library. - -des_read_pw() writes the string specified by I<prompt> to standard output -turns echo off and reads an input string from the terminal. The string is -returned in I<buf>, which must have spac for at least I<size> bytes. -If I<verify> is set, the user is asked for the password twice and unless -the two copies match, an error is returned. The second password is stored -in I<buff>, which must therefore also be at least I<size> bytes. A return -code of -1 indicates a system error, 1 failure due to use interaction, and -0 is success. All other functions described here use des_read_pw() to do -the work. - -des_read_pw_string() is a variant of des_read_pw() that provides a buffer -for you if I<verify> is set. - -des_read_password() calls des_read_pw() and converts the password to a -DES key by calling DES_string_to_key(); des_read_2password() operates in -the same way as des_read_password() except that it generates two keys -by using the DES_string_to_2key() function. - -=head1 NOTES - -des_read_pw_string() is available in the MIT Kerberos library as well, and -is also available under the name EVP_read_pw_string(). - -=head1 SEE ALSO - -L<ui(3)|ui(3)>, L<ui_create(3)|ui_create(3)> - -=head1 AUTHOR - -Richard Levitte (richard@levitte.org) for the OpenSSL project -(http://www.openssl.org). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/crypto/x509.pod b/sys/src/ape/lib/openssl/doc/crypto/x509.pod deleted file mode 100644 index f9e58e0e4..000000000 --- a/sys/src/ape/lib/openssl/doc/crypto/x509.pod +++ /dev/null @@ -1,64 +0,0 @@ -=pod - -=head1 NAME - -x509 - X.509 certificate handling - -=head1 SYNOPSIS - - #include <openssl/x509.h> - -=head1 DESCRIPTION - -A X.509 certificate is a structured grouping of information about -an individual, a device, or anything one can imagine. A X.509 CRL -(certificate revocation list) is a tool to help determine if a -certificate is still valid. The exact definition of those can be -found in the X.509 document from ITU-T, or in RFC3280 from PKIX. -In OpenSSL, the type X509 is used to express such a certificate, and -the type X509_CRL is used to express a CRL. - -A related structure is a certificate request, defined in PKCS#10 from -RSA Security, Inc, also reflected in RFC2896. In OpenSSL, the type -X509_REQ is used to express such a certificate request. - -To handle some complex parts of a certificate, there are the types -X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express -a certificate attributes), X509_EXTENSION (to express a certificate -extension) and a few more. - -Finally, there's the supertype X509_INFO, which can contain a CRL, a -certificate and a corresponding private key. - -B<X509_>I<...>, B<d2i_X509_>I<...> and B<i2d_X509_>I<...> handle X.509 -certificates, with some exceptions, shown below. - -B<X509_CRL_>I<...>, B<d2i_X509_CRL_>I<...> and B<i2d_X509_CRL_>I<...> -handle X.509 CRLs. - -B<X509_REQ_>I<...>, B<d2i_X509_REQ_>I<...> and B<i2d_X509_REQ_>I<...> -handle PKCS#10 certificate requests. - -B<X509_NAME_>I<...> handle certificate names. - -B<X509_ATTRIBUTE_>I<...> handle certificate attributes. - -B<X509_EXTENSION_>I<...> handle certificate extensions. - -=head1 SEE ALSO - -L<X509_NAME_ENTRY_get_object(3)|X509_NAME_ENTRY_get_object(3)>, -L<X509_NAME_add_entry_by_txt(3)|X509_NAME_add_entry_by_txt(3)>, -L<X509_NAME_add_entry_by_NID(3)|X509_NAME_add_entry_by_NID(3)>, -L<X509_NAME_print_ex(3)|X509_NAME_print_ex(3)>, -L<X509_NAME_new(3)|X509_NAME_new(3)>, -L<d2i_X509(3)|d2i_X509(3)>, -L<d2i_X509_ALGOR(3)|d2i_X509_ALGOR(3)>, -L<d2i_X509_CRL(3)|d2i_X509_CRL(3)>, -L<d2i_X509_NAME(3)|d2i_X509_NAME(3)>, -L<d2i_X509_REQ(3)|d2i_X509_REQ(3)>, -L<d2i_X509_SIG(3)|d2i_X509_SIG(3)>, -L<crypto(3)|crypto(3)>, -L<x509v3(3)|x509v3(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/fingerprints.txt b/sys/src/ape/lib/openssl/doc/fingerprints.txt deleted file mode 100644 index 7d05a8559..000000000 --- a/sys/src/ape/lib/openssl/doc/fingerprints.txt +++ /dev/null @@ -1,57 +0,0 @@ - Fingerprints - -OpenSSL releases are signed with PGP/GnuPG keys. You can find the -signatures in separate files in the same location you find the -distributions themselves. The normal file name is the same as the -distribution file, with '.asc' added. For example, the signature for -the distribution of OpenSSL 0.9.7f, openssl-0.9.7f.tar.gz, is found in -the file openssl-0.9.7f.tar.gz.asc. - -The following is the list of fingerprints for the keys that are -currently in use (have been used since summer 2004) to sign OpenSSL -distributions: - -pub 1024D/F709453B 2003-10-20 - Key fingerprint = C4CA B749 C34F 7F4C C04F DAC9 A7AF 9E78 F709 453B -uid Richard Levitte <richard@levitte.org> -uid Richard Levitte <levitte@openssl.org> -uid Richard Levitte <levitte@lp.se> - -pub 2048R/F295C759 1998-12-13 - Key fingerprint = D0 5D 8C 61 6E 27 E6 60 41 EC B1 B8 D5 7E E5 97 -uid Dr S N Henson <shenson@drh-consultancy.demon.co.uk> - -pub 1024R/49A563D9 1997-02-24 - Key fingerprint = 7B 79 19 FA 71 6B 87 25 0E 77 21 E5 52 D9 83 BF -uid Mark Cox <mjc@redhat.com> -uid Mark Cox <mark@awe.com> -uid Mark Cox <mjc@apache.org> - -pub 1024R/26BB437D 1997-04-28 - Key fingerprint = 00 C9 21 8E D1 AB 70 37 DD 67 A2 3A 0A 6F 8D A5 -uid Ralf S. Engelschall <rse@engelschall.com> - -pub 1024R/9C58A66D 1997-04-03 - Key fingerprint = 13 D0 B8 9D 37 30 C3 ED AC 9C 24 7D 45 8C 17 67 -uid jaenicke@openssl.org -uid Lutz Jaenicke <Lutz.Jaenicke@aet.TU-Cottbus.DE> - -pub 1024D/2118CF83 1998-07-13 - Key fingerprint = 7656 55DE 62E3 96FF 2587 EB6C 4F6D E156 2118 CF83 -uid Ben Laurie <ben@thebunker.net> -uid Ben Laurie <ben@cryptix.org> -uid Ben Laurie <ben@algroup.co.uk> -sub 4096g/1F5143E7 1998-07-13 - -pub 1024R/5A6A9B85 1994-03-22 - Key fingerprint = C7 AC 7E AD 56 6A 65 EC F6 16 66 83 7E 86 68 28 -uid Bodo Moeller <2005@bmoeller.de> -uid Bodo Moeller <2003@bmoeller.de> -uid Bodo Moeller <2004@bmoeller.de> -uid Bodo Moeller <bmoeller@acm.org> -uid Bodo Moeller <bodo@openssl.org> -uid Bodo Moeller <bm@ulf.mali.sub.org> -uid Bodo Moeller <3moeller@informatik.uni-hamburg.de> -uid Bodo Moeller <Bodo_Moeller@public.uni-hamburg.de> -uid Bodo Moeller <3moeller@rzdspc5.informatik.uni-hamburg.de> - diff --git a/sys/src/ape/lib/openssl/doc/openssl-shared.txt b/sys/src/ape/lib/openssl/doc/openssl-shared.txt deleted file mode 100644 index 5cf84a054..000000000 --- a/sys/src/ape/lib/openssl/doc/openssl-shared.txt +++ /dev/null @@ -1,32 +0,0 @@ -The OpenSSL shared libraries are often installed in a directory like -/usr/local/ssl/lib. - -If this directory is not in a standard system path for dynamic/shared -libraries, then you will have problems linking and executing -applications that use OpenSSL libraries UNLESS: - -* you link with static (archive) libraries. If you are truly - paranoid about security, you should use static libraries. -* you use the GNU libtool code during linking - (http://www.gnu.org/software/libtool/libtool.html) -* you use pkg-config during linking (this requires that - PKG_CONFIG_PATH includes the path to the OpenSSL shared - library directory), and make use of -R or -rpath. - (http://www.freedesktop.org/software/pkgconfig/) -* you specify the system-wide link path via a command such - as crle(1) on Solaris systems. -* you add the OpenSSL shared library directory to /etc/ld.so.conf - and run ldconfig(8) on Linux systems. -* you define the LD_LIBRARY_PATH, LIBPATH, SHLIB_PATH (HP), - DYLD_LIBRARY_PATH (MacOS X) or PATH (Cygwin and DJGPP) - environment variable and add the OpenSSL shared library - directory to it. - -One common tool to check the dynamic dependencies of an executable -or dynamic library is ldd(1) on most UNIX systems. - -See any operating system documentation and manpages about shared -libraries for your version of UNIX. The following manpages may be -helpful: ld(1), ld.so(1), ld.so.1(1) [Solaris], dld.sl(1) [HP], -ldd(1), crle(1) [Solaris], pldd(1) [Solaris], ldconfig(8) [Linux], -chatr(1) [HP]. diff --git a/sys/src/ape/lib/openssl/doc/openssl.txt b/sys/src/ape/lib/openssl/doc/openssl.txt deleted file mode 100644 index f8817b0a7..000000000 --- a/sys/src/ape/lib/openssl/doc/openssl.txt +++ /dev/null @@ -1,1254 +0,0 @@ - -This is some preliminary documentation for OpenSSL. - -Contents: - - OpenSSL X509V3 extension configuration - X509V3 Extension code: programmers guide - PKCS#12 Library - - -============================================================================== - OpenSSL X509V3 extension configuration -============================================================================== - -OpenSSL X509V3 extension configuration: preliminary documentation. - -INTRODUCTION. - -For OpenSSL 0.9.2 the extension code has be considerably enhanced. It is now -possible to add and print out common X509 V3 certificate and CRL extensions. - -BEGINNERS NOTE - -For most simple applications you don't need to know too much about extensions: -the default openssl.cnf values will usually do sensible things. - -If you want to know more you can initially quickly look through the sections -describing how the standard OpenSSL utilities display and add extensions and -then the list of supported extensions. - -For more technical information about the meaning of extensions see: - -http://www.imc.org/ietf-pkix/ -http://home.netscape.com/eng/security/certs.html - -PRINTING EXTENSIONS. - -Extension values are automatically printed out for supported extensions. - -openssl x509 -in cert.pem -text -openssl crl -in crl.pem -text - -will give information in the extension printout, for example: - - X509v3 extensions: - X509v3 Basic Constraints: - CA:TRUE - X509v3 Subject Key Identifier: - 73:FE:F7:59:A7:E1:26:84:44:D6:44:36:EE:79:1A:95:7C:B1:4B:15 - X509v3 Authority Key Identifier: - keyid:73:FE:F7:59:A7:E1:26:84:44:D6:44:36:EE:79:1A:95:7C:B1:4B:15, DirName:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/Email=email@1.address/Email=email@2.address, serial:00 - X509v3 Key Usage: - Certificate Sign, CRL Sign - X509v3 Subject Alternative Name: - email:email@1.address, email:email@2.address - -CONFIGURATION FILES. - -The OpenSSL utilities 'ca' and 'req' can now have extension sections listing -which certificate extensions to include. In each case a line: - -x509_extensions = extension_section - -indicates which section contains the extensions. In the case of 'req' the -extension section is used when the -x509 option is present to create a -self signed root certificate. - -The 'x509' utility also supports extensions when it signs a certificate. -The -extfile option is used to set the configuration file containing the -extensions. In this case a line with: - -extensions = extension_section - -in the nameless (default) section is used. If no such line is included then -it uses the default section. - -You can also add extensions to CRLs: a line - -crl_extensions = crl_extension_section - -will include extensions when the -gencrl option is used with the 'ca' utility. -You can add any extension to a CRL but of the supported extensions only -issuerAltName and authorityKeyIdentifier make any real sense. Note: these are -CRL extensions NOT CRL *entry* extensions which cannot currently be generated. -CRL entry extensions can be displayed. - -NB. At this time Netscape Communicator rejects V2 CRLs: to get an old V1 CRL -you should not include a crl_extensions line in the configuration file. - -As with all configuration files you can use the inbuilt environment expansion -to allow the values to be passed in the environment. Therefore if you have -several extension sections used for different purposes you can have a line: - -x509_extensions = $ENV::ENV_EXT - -and set the ENV_EXT environment variable before calling the relevant utility. - -EXTENSION SYNTAX. - -Extensions have the basic form: - -extension_name=[critical,] extension_options - -the use of the critical option makes the extension critical. Extreme caution -should be made when using the critical flag. If an extension is marked -as critical then any client that does not understand the extension should -reject it as invalid. Some broken software will reject certificates which -have *any* critical extensions (these violates PKIX but we have to live -with it). - -There are three main types of extension: string extensions, multi-valued -extensions, and raw extensions. - -String extensions simply have a string which contains either the value itself -or how it is obtained. - -For example: - -nsComment="This is a Comment" - -Multi-valued extensions have a short form and a long form. The short form -is a list of names and values: - -basicConstraints=critical,CA:true,pathlen:1 - -The long form allows the values to be placed in a separate section: - -basicConstraints=critical,@bs_section - -[bs_section] - -CA=true -pathlen=1 - -Both forms are equivalent. However it should be noted that in some cases the -same name can appear multiple times, for example, - -subjectAltName=email:steve@here,email:steve@there - -in this case an equivalent long form is: - -subjectAltName=@alt_section - -[alt_section] - -email.1=steve@here -email.2=steve@there - -This is because the configuration file code cannot handle the same name -occurring twice in the same section. - -The syntax of raw extensions is governed by the extension code: it can -for example contain data in multiple sections. The correct syntax to -use is defined by the extension code itself: check out the certificate -policies extension for an example. - -There are two ways to encode arbitrary extensions. - -The first way is to use the word ASN1 followed by the extension content -using the same syntax as ASN1_generate_nconf(). For example: - -1.2.3.4=critical,ASN1:UTF8String:Some random data - -1.2.3.4=ASN1:SEQUENCE:seq_sect - -[seq_sect] - -field1 = UTF8:field1 -field2 = UTF8:field2 - -It is also possible to use the word DER to include arbitrary data in any -extension. - -1.2.3.4=critical,DER:01:02:03:04 -1.2.3.4=DER:01020304 - -The value following DER is a hex dump of the DER encoding of the extension -Any extension can be placed in this form to override the default behaviour. -For example: - -basicConstraints=critical,DER:00:01:02:03 - -WARNING: DER should be used with caution. It is possible to create totally -invalid extensions unless care is taken. - -CURRENTLY SUPPORTED EXTENSIONS. - -If you aren't sure about extensions then they can be largely ignored: its only -when you want to do things like restrict certificate usage when you need to -worry about them. - -The only extension that a beginner might want to look at is Basic Constraints. -If in addition you want to try Netscape object signing the you should also -look at Netscape Certificate Type. - -Literal String extensions. - -In each case the 'value' of the extension is placed directly in the -extension. Currently supported extensions in this category are: nsBaseUrl, -nsRevocationUrl, nsCaRevocationUrl, nsRenewalUrl, nsCaPolicyUrl, -nsSslServerName and nsComment. - -For example: - -nsComment="This is a test comment" - -Bit Strings. - -Bit string extensions just consist of a list of supported bits, currently -two extensions are in this category: PKIX keyUsage and the Netscape specific -nsCertType. - -nsCertType (netscape certificate type) takes the flags: client, server, email, -objsign, reserved, sslCA, emailCA, objCA. - -keyUsage (PKIX key usage) takes the flags: digitalSignature, nonRepudiation, -keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign, -encipherOnly, decipherOnly. - -For example: - -nsCertType=server - -keyUsage=digitalSignature, nonRepudiation - -Hints on Netscape Certificate Type. - -Other than Basic Constraints this is the only extension a beginner might -want to use, if you want to try Netscape object signing, otherwise it can -be ignored. - -If you want a certificate that can be used just for object signing then: - -nsCertType=objsign - -will do the job. If you want to use it as a normal end user and server -certificate as well then - -nsCertType=objsign,email,server - -is more appropriate. You cannot use a self signed certificate for object -signing (well Netscape signtool can but it cheats!) so you need to create -a CA certificate and sign an end user certificate with it. - -Side note: If you want to conform to the Netscape specifications then you -should really also set: - -nsCertType=objCA - -in the *CA* certificate for just an object signing CA and - -nsCertType=objCA,emailCA,sslCA - -for everything. Current Netscape software doesn't enforce this so it can -be omitted. - -Basic Constraints. - -This is generally the only extension you need to worry about for simple -applications. If you want your certificate to be usable as a CA certificate -(in addition to an end user certificate) then you set this to: - -basicConstraints=CA:TRUE - -if you want to be certain the certificate cannot be used as a CA then do: - -basicConstraints=CA:FALSE - -The rest of this section describes more advanced usage. - -Basic constraints is a multi-valued extension that supports a CA and an -optional pathlen option. The CA option takes the values true and false and -pathlen takes an integer. Note if the CA option is false the pathlen option -should be omitted. - -The pathlen parameter indicates the maximum number of CAs that can appear -below this one in a chain. So if you have a CA with a pathlen of zero it can -only be used to sign end user certificates and not further CAs. This all -assumes that the software correctly interprets this extension of course. - -Examples: - -basicConstraints=CA:TRUE -basicConstraints=critical,CA:TRUE, pathlen:0 - -NOTE: for a CA to be considered valid it must have the CA option set to -TRUE. An end user certificate MUST NOT have the CA value set to true. -According to PKIX recommendations it should exclude the extension entirely, -however some software may require CA set to FALSE for end entity certificates. - -Extended Key Usage. - -This extensions consists of a list of usages. - -These can either be object short names of the dotted numerical form of OIDs. -While any OID can be used only certain values make sense. In particular the -following PKIX, NS and MS values are meaningful: - -Value Meaning ------ ------- -serverAuth SSL/TLS Web Server Authentication. -clientAuth SSL/TLS Web Client Authentication. -codeSigning Code signing. -emailProtection E-mail Protection (S/MIME). -timeStamping Trusted Timestamping -msCodeInd Microsoft Individual Code Signing (authenticode) -msCodeCom Microsoft Commercial Code Signing (authenticode) -msCTLSign Microsoft Trust List Signing -msSGC Microsoft Server Gated Crypto -msEFS Microsoft Encrypted File System -nsSGC Netscape Server Gated Crypto - -For example, under IE5 a CA can be used for any purpose: by including a list -of the above usages the CA can be restricted to only authorised uses. - -Note: software packages may place additional interpretations on certificate -use, in particular some usages may only work for selected CAs. Don't for example -expect just including msSGC or nsSGC will automatically mean that a certificate -can be used for SGC ("step up" encryption) otherwise anyone could use it. - -Examples: - -extendedKeyUsage=critical,codeSigning,1.2.3.4 -extendedKeyUsage=nsSGC,msSGC - -Subject Key Identifier. - -This is really a string extension and can take two possible values. Either -a hex string giving details of the extension value to include or the word -'hash' which then automatically follow PKIX guidelines in selecting and -appropriate key identifier. The use of the hex string is strongly discouraged. - -Example: subjectKeyIdentifier=hash - -Authority Key Identifier. - -The authority key identifier extension permits two options. keyid and issuer: -both can take the optional value "always". - -If the keyid option is present an attempt is made to copy the subject key -identifier from the parent certificate. If the value "always" is present -then an error is returned if the option fails. - -The issuer option copies the issuer and serial number from the issuer -certificate. Normally this will only be done if the keyid option fails or -is not included: the "always" flag will always include the value. - -Subject Alternative Name. - -The subject alternative name extension allows various literal values to be -included in the configuration file. These include "email" (an email address) -"URI" a uniform resource indicator, "DNS" (a DNS domain name), RID (a -registered ID: OBJECT IDENTIFIER), IP (and IP address) and otherName. - -Also the email option include a special 'copy' value. This will automatically -include and email addresses contained in the certificate subject name in -the extension. - -otherName can include arbitrary data associated with an OID: the value -should be the OID followed by a semicolon and the content in standard -ASN1_generate_nconf() format. - -Examples: - -subjectAltName=email:copy,email:my@other.address,URI:http://my.url.here/ -subjectAltName=email:my@other.address,RID:1.2.3.4 -subjectAltName=otherName:1.2.3.4;UTF8:some other identifier - -Issuer Alternative Name. - -The issuer alternative name option supports all the literal options of -subject alternative name. It does *not* support the email:copy option because -that would not make sense. It does support an additional issuer:copy option -that will copy all the subject alternative name values from the issuer -certificate (if possible). - -Example: - -issuserAltName = issuer:copy - -Authority Info Access. - -The authority information access extension gives details about how to access -certain information relating to the CA. Its syntax is accessOID;location -where 'location' has the same syntax as subject alternative name (except -that email:copy is not supported). accessOID can be any valid OID but only -certain values are meaningful for example OCSP and caIssuers. OCSP gives the -location of an OCSP responder: this is used by Netscape PSM and other software. - -Example: - -authorityInfoAccess = OCSP;URI:http://ocsp.my.host/ -authorityInfoAccess = caIssuers;URI:http://my.ca/ca.html - -CRL distribution points. - -This is a multi-valued extension that supports all the literal options of -subject alternative name. Of the few software packages that currently interpret -this extension most only interpret the URI option. - -Currently each option will set a new DistributionPoint with the fullName -field set to the given value. - -Other fields like cRLissuer and reasons cannot currently be set or displayed: -at this time no examples were available that used these fields. - -If you see this extension with <UNSUPPORTED> when you attempt to print it out -or it doesn't appear to display correctly then let me know, including the -certificate (mail me at steve@openssl.org) . - -Examples: - -crlDistributionPoints=URI:http://www.myhost.com/myca.crl -crlDistributionPoints=URI:http://www.my.com/my.crl,URI:http://www.oth.com/my.crl - -Certificate Policies. - -This is a RAW extension. It attempts to display the contents of this extension: -unfortunately this extension is often improperly encoded. - -The certificate policies extension will rarely be used in practice: few -software packages interpret it correctly or at all. IE5 does partially -support this extension: but it needs the 'ia5org' option because it will -only correctly support a broken encoding. Of the options below only the -policy OID, explicitText and CPS options are displayed with IE5. - -All the fields of this extension can be set by using the appropriate syntax. - -If you follow the PKIX recommendations of not including any qualifiers and just -using only one OID then you just include the value of that OID. Multiple OIDs -can be set separated by commas, for example: - -certificatePolicies= 1.2.4.5, 1.1.3.4 - -If you wish to include qualifiers then the policy OID and qualifiers need to -be specified in a separate section: this is done by using the @section syntax -instead of a literal OID value. - -The section referred to must include the policy OID using the name -policyIdentifier, cPSuri qualifiers can be included using the syntax: - -CPS.nnn=value - -userNotice qualifiers can be set using the syntax: - -userNotice.nnn=@notice - -The value of the userNotice qualifier is specified in the relevant section. -This section can include explicitText, organization and noticeNumbers -options. explicitText and organization are text strings, noticeNumbers is a -comma separated list of numbers. The organization and noticeNumbers options -(if included) must BOTH be present. If you use the userNotice option with IE5 -then you need the 'ia5org' option at the top level to modify the encoding: -otherwise it will not be interpreted properly. - -Example: - -certificatePolicies=ia5org,1.2.3.4,1.5.6.7.8,@polsect - -[polsect] - -policyIdentifier = 1.3.5.8 -CPS.1="http://my.host.name/" -CPS.2="http://my.your.name/" -userNotice.1=@notice - -[notice] - -explicitText="Explicit Text Here" -organization="Organisation Name" -noticeNumbers=1,2,3,4 - -TECHNICAL NOTE: the ia5org option changes the type of the 'organization' field, -according to PKIX it should be of type DisplayText but Verisign uses an -IA5STRING and IE5 needs this too. - -Display only extensions. - -Some extensions are only partially supported and currently are only displayed -but cannot be set. These include private key usage period, CRL number, and -CRL reason. - -============================================================================== - X509V3 Extension code: programmers guide -============================================================================== - -The purpose of the extension code is twofold. It allows an extension to be -created from a string or structure describing its contents and it prints out an -extension in a human or machine readable form. - -1. Initialisation and cleanup. - -No special initialisation is needed before calling the extension functions. -You used to have to call X509V3_add_standard_extensions(); but this is no longer -required and this function no longer does anything. - -void X509V3_EXT_cleanup(void); - -This function should be called to cleanup the extension code if any custom -extensions have been added. If no custom extensions have been added then this -call does nothing. After this call all custom extension code is freed up but -you can still use the standard extensions. - -2. Printing and parsing extensions. - -The simplest way to print out extensions is via the standard X509 printing -routines: if you use the standard X509_print() function, the supported -extensions will be printed out automatically. - -The following functions allow finer control over extension display: - -int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent); -int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); - -These two functions print out an individual extension to a BIO or FILE pointer. -Currently the flag argument is unused and should be set to 0. The 'indent' -argument is the number of spaces to indent each line. - -void *X509V3_EXT_d2i(X509_EXTENSION *ext); - -This function parses an extension and returns its internal structure. The -precise structure you get back depends on the extension being parsed. If the -extension if basicConstraints you will get back a pointer to a -BASIC_CONSTRAINTS structure. Check out the source in crypto/x509v3 for more -details about the structures returned. The returned structure should be freed -after use using the relevant free function, BASIC_CONSTRAINTS_free() for -example. - -void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); -void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); -void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); -void * X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); - -These functions combine the operations of searching for extensions and -parsing them. They search a certificate, a CRL a CRL entry or a stack -of extensions respectively for extension whose NID is 'nid' and return -the parsed result of NULL if an error occurred. For example: - -BASIC_CONSTRAINTS *bs; -bs = X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL); - -This will search for the basicConstraints extension and either return -it value or NULL. NULL can mean either the extension was not found, it -occurred more than once or it could not be parsed. - -If 'idx' is NULL then an extension is only parsed if it occurs precisely -once. This is standard behaviour because extensions normally cannot occur -more than once. If however more than one extension of the same type can -occur it can be used to parse successive extensions for example: - -int i; -void *ext; - -i = -1; -for(;;) { - ext = X509_get_ext_d2i(x, nid, crit, &idx); - if(ext == NULL) break; - /* Do something with ext */ -} - -If 'crit' is not NULL and the extension was found then the int it points to -is set to 1 for critical extensions and 0 for non critical. Therefore if the -function returns NULL but 'crit' is set to 0 or 1 then the extension was -found but it could not be parsed. - -The int pointed to by crit will be set to -1 if the extension was not found -and -2 if the extension occurred more than once (this will only happen if -idx is NULL). In both cases the function will return NULL. - -3. Generating extensions. - -An extension will typically be generated from a configuration file, or some -other kind of configuration database. - -int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, - X509 *cert); -int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, - X509_CRL *crl); - -These functions add all the extensions in the given section to the given -certificate or CRL. They will normally be called just before the certificate -or CRL is due to be signed. Both return 0 on error on non zero for success. - -In each case 'conf' is the LHASH pointer of the configuration file to use -and 'section' is the section containing the extension details. - -See the 'context functions' section for a description of the ctx parameter. - - -X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, - char *value); - -This function returns an extension based on a name and value pair, if the -pair will not need to access other sections in a config file (or there is no -config file) then the 'conf' parameter can be set to NULL. - -X509_EXTENSION *X509V3_EXT_conf_nid(char *conf, X509V3_CTX *ctx, int nid, - char *value); - -This function creates an extension in the same way as X509V3_EXT_conf() but -takes the NID of the extension rather than its name. - -For example to produce basicConstraints with the CA flag and a path length of -10: - -x = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints,"CA:TRUE,pathlen:10"); - - -X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); - -This function sets up an extension from its internal structure. The ext_nid -parameter is the NID of the extension and 'crit' is the critical flag. - -4. Context functions. - -The following functions set and manipulate an extension context structure. -The purpose of the extension context is to allow the extension code to -access various structures relating to the "environment" of the certificate: -for example the issuers certificate or the certificate request. - -void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, - X509_REQ *req, X509_CRL *crl, int flags); - -This function sets up an X509V3_CTX structure with details of the certificate -environment: specifically the issuers certificate, the subject certificate, -the certificate request and the CRL: if these are not relevant or not -available then they can be set to NULL. The 'flags' parameter should be set -to zero. - -X509V3_set_ctx_test(ctx) - -This macro is used to set the 'ctx' structure to a 'test' value: this is to -allow the syntax of an extension (or configuration file) to be tested. - -X509V3_set_ctx_nodb(ctx) - -This macro is used when no configuration database is present. - -void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash); - -This function is used to set the configuration database when it is an LHASH -structure: typically a configuration file. - -The following functions are used to access a configuration database: they -should only be used in RAW extensions. - -char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); - -This function returns the value of the parameter "name" in "section", or NULL -if there has been an error. - -void X509V3_string_free(X509V3_CTX *ctx, char *str); - -This function frees up the string returned by the above function. - -STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section); - -This function returns a whole section as a STACK_OF(CONF_VALUE) . - -void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); - -This function frees up the STACK returned by the above function. - -Note: it is possible to use the extension code with a custom configuration -database. To do this the "db_meth" element of the X509V3_CTX structure should -be set to an X509V3_CTX_METHOD structure. This structure contains the following -function pointers: - -char * (*get_string)(void *db, char *section, char *value); -STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section); -void (*free_string)(void *db, char * string); -void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section); - -these will be called and passed the 'db' element in the X509V3_CTX structure -to access the database. If a given function is not implemented or not required -it can be set to NULL. - -5. String helper functions. - -There are several "i2s" and "s2i" functions that convert structures to and -from ASCII strings. In all the "i2s" cases the returned string should be -freed using Free() after use. Since some of these are part of other extension -code they may take a 'method' parameter. Unless otherwise stated it can be -safely set to NULL. - -char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct); - -This returns a hex string from an ASN1_OCTET_STRING. - -char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint); -char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); - -These return a string decimal representations of an ASN1_INTEGER and an -ASN1_ENUMERATED type, respectively. - -ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, char *str); - -This converts an ASCII hex string to an ASN1_OCTET_STRING. - -ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value); - -This converts a decimal ASCII string into an ASN1_INTEGER. - -6. Multi valued extension helper functions. - -The following functions can be used to manipulate STACKs of CONF_VALUE -structures, as used by multi valued extensions. - -int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); - -This function expects a boolean value in 'value' and sets 'asn1_bool' to -it. That is it sets it to 0 for FALSE or 0xff for TRUE. The following -strings are acceptable: "TRUE", "true", "Y", "y", "YES", "yes", "FALSE" -"false", "N", "n", "NO" or "no". - -int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); - -This accepts a decimal integer of arbitrary length and sets an ASN1_INTEGER. - -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist); - -This simply adds a string name and value pair. - -int X509V3_add_value_uchar(const char *name, const unsigned char *value, - STACK_OF(CONF_VALUE) **extlist); - -The same as above but for an unsigned character value. - -int X509V3_add_value_bool(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); - -This adds either "TRUE" or "FALSE" depending on the value of 'asn1_bool' - -int X509V3_add_value_bool_nf(char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); - -This is the same as above except it adds nothing if asn1_bool is FALSE. - -int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, - STACK_OF(CONF_VALUE) **extlist); - -This function adds the value of the ASN1_INTEGER in decimal form. - -7. Other helper functions. - -<to be added> - -ADDING CUSTOM EXTENSIONS. - -Currently there are three types of supported extensions. - -String extensions are simple strings where the value is placed directly in the -extensions, and the string returned is printed out. - -Multi value extensions are passed a STACK_OF(CONF_VALUE) name and value pairs -or return a STACK_OF(CONF_VALUE). - -Raw extensions are just passed a BIO or a value and it is the extensions -responsibility to handle all the necessary printing. - -There are two ways to add an extension. One is simply as an alias to an already -existing extension. An alias is an extension that is identical in ASN1 structure -to an existing extension but has a different OBJECT IDENTIFIER. This can be -done by calling: - -int X509V3_EXT_add_alias(int nid_to, int nid_from); - -'nid_to' is the new extension NID and 'nid_from' is the already existing -extension NID. - -Alternatively an extension can be written from scratch. This involves writing -the ASN1 code to encode and decode the extension and functions to print out and -generate the extension from strings. The relevant functions are then placed in -a X509V3_EXT_METHOD structure and int X509V3_EXT_add(X509V3_EXT_METHOD *ext); -called. - -The X509V3_EXT_METHOD structure is described below. - -struct { -int ext_nid; -int ext_flags; -X509V3_EXT_NEW ext_new; -X509V3_EXT_FREE ext_free; -X509V3_EXT_D2I d2i; -X509V3_EXT_I2D i2d; -X509V3_EXT_I2S i2s; -X509V3_EXT_S2I s2i; -X509V3_EXT_I2V i2v; -X509V3_EXT_V2I v2i; -X509V3_EXT_R2I r2i; -X509V3_EXT_I2R i2r; - -void *usr_data; -}; - -The elements have the following meanings. - -ext_nid is the NID of the object identifier of the extension. - -ext_flags is set of flags. Currently the only external flag is - X509V3_EXT_MULTILINE which means a multi valued extensions - should be printed on separate lines. - -usr_data is an extension specific pointer to any relevant data. This - allows extensions to share identical code but have different - uses. An example of this is the bit string extension which uses - usr_data to contain a list of the bit names. - -All the remaining elements are function pointers. - -ext_new is a pointer to a function that allocates memory for the - extension ASN1 structure: for example ASN1_OBJECT_new(). - -ext_free is a pointer to a function that free up memory of the extension - ASN1 structure: for example ASN1_OBJECT_free(). - -d2i is the standard ASN1 function that converts a DER buffer into - the internal ASN1 structure: for example d2i_ASN1_IA5STRING(). - -i2d is the standard ASN1 function that converts the internal - structure into the DER representation: for example - i2d_ASN1_IA5STRING(). - -The remaining functions are depend on the type of extension. One i2X and -one X2i should be set and the rest set to NULL. The types set do not need -to match up, for example the extension could be set using the multi valued -v2i function and printed out using the raw i2r. - -All functions have the X509V3_EXT_METHOD passed to them in the 'method' -parameter and an X509V3_CTX structure. Extension code can then access the -parent structure via the 'method' parameter to for example make use of the value -of usr_data. If the code needs to use detail relating to the request it can -use the 'ctx' parameter. - -A note should be given here about the 'flags' member of the 'ctx' parameter. -If it has the value CTX_TEST then the configuration syntax is being checked -and no actual certificate or CRL exists. Therefore any attempt in the config -file to access such information should silently succeed. If the syntax is OK -then it should simply return a (possibly bogus) extension, otherwise it -should return NULL. - -char *i2s(struct v3_ext_method *method, void *ext); - -This function takes the internal structure in the ext parameter and returns -a Malloc'ed string representing its value. - -void * s2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str); - -This function takes the string representation in the ext parameter and returns -an allocated internal structure: ext_free() will be used on this internal -structure after use. - -i2v and v2i handle a STACK_OF(CONF_VALUE): - -typedef struct -{ - char *section; - char *name; - char *value; -} CONF_VALUE; - -Only the name and value members are currently used. - -STACK_OF(CONF_VALUE) * i2v(struct v3_ext_method *method, void *ext); - -This function is passed the internal structure in the ext parameter and -returns a STACK of CONF_VALUE structures. The values of name, value, -section and the structure itself will be freed up with Free after use. -Several helper functions are available to add values to this STACK. - -void * v2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, - STACK_OF(CONF_VALUE) *values); - -This function takes a STACK_OF(CONF_VALUE) structures and should set the -values of the external structure. This typically uses the name element to -determine which structure element to set and the value element to determine -what to set it to. Several helper functions are available for this -purpose (see above). - -int i2r(struct v3_ext_method *method, void *ext, BIO *out, int indent); - -This function is passed the internal extension structure in the ext parameter -and sends out a human readable version of the extension to out. The 'indent' -parameter should be noted to determine the necessary amount of indentation -needed on the output. - -void * r2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str); - -This is just passed the string representation of the extension. It is intended -to be used for more elaborate extensions where the standard single and multi -valued options are insufficient. They can use the 'ctx' parameter to parse the -configuration database themselves. See the context functions section for details -of how to do this. - -Note: although this type takes the same parameters as the "r2s" function there -is a subtle difference. Whereas an "r2i" function can access a configuration -database an "s2i" function MUST NOT. This is so the internal code can safely -assume that an "s2i" function will work without a configuration database. - -============================================================================== - PKCS#12 Library -============================================================================== - -This section describes the internal PKCS#12 support. There are very few -differences between the old external library and the new internal code at -present. This may well change because the external library will not be updated -much in future. - -This version now includes a couple of high level PKCS#12 functions which -generally "do the right thing" and should make it much easier to handle PKCS#12 -structures. - -HIGH LEVEL FUNCTIONS. - -For most applications you only need concern yourself with the high level -functions. They can parse and generate simple PKCS#12 files as produced by -Netscape and MSIE or indeed any compliant PKCS#12 file containing a single -private key and certificate pair. - -1. Initialisation and cleanup. - -No special initialisation is needed for the internal PKCS#12 library: the -standard SSLeay_add_all_algorithms() is sufficient. If you do not wish to -add all algorithms (you should at least add SHA1 though) then you can manually -initialise the PKCS#12 library with: - -PKCS12_PBE_add(); - -The memory allocated by the PKCS#12 library is freed up when EVP_cleanup() is -called or it can be directly freed with: - -EVP_PBE_cleanup(); - -after this call (or EVP_cleanup() ) no more PKCS#12 library functions should -be called. - -2. I/O functions. - -i2d_PKCS12_bio(bp, p12) - -This writes out a PKCS12 structure to a BIO. - -i2d_PKCS12_fp(fp, p12) - -This is the same but for a FILE pointer. - -d2i_PKCS12_bio(bp, p12) - -This reads in a PKCS12 structure from a BIO. - -d2i_PKCS12_fp(fp, p12) - -This is the same but for a FILE pointer. - -3. High level functions. - -3.1 Parsing with PKCS12_parse(). - -int PKCS12_parse(PKCS12 *p12, char *pass, EVP_PKEY **pkey, X509 **cert, - STACK **ca); - -This function takes a PKCS12 structure and a password (ASCII, null terminated) -and returns the private key, the corresponding certificate and any CA -certificates. If any of these is not required it can be passed as a NULL. -The 'ca' parameter should be either NULL, a pointer to NULL or a valid STACK -structure. Typically to read in a PKCS#12 file you might do: - -p12 = d2i_PKCS12_fp(fp, NULL); -PKCS12_parse(p12, password, &pkey, &cert, NULL); /* CAs not wanted */ -PKCS12_free(p12); - -3.2 PKCS#12 creation with PKCS12_create(). - -PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, - STACK *ca, int nid_key, int nid_cert, int iter, - int mac_iter, int keytype); - -This function will create a PKCS12 structure from a given password, name, -private key, certificate and optional STACK of CA certificates. The remaining -5 parameters can be set to 0 and sensible defaults will be used. - -The parameters nid_key and nid_cert are the key and certificate encryption -algorithms, iter is the encryption iteration count, mac_iter is the MAC -iteration count and keytype is the type of private key. If you really want -to know what these last 5 parameters do then read the low level section. - -Typically to create a PKCS#12 file the following could be used: - -p12 = PKCS12_create(pass, "My Certificate", pkey, cert, NULL, 0,0,0,0,0); -i2d_PKCS12_fp(fp, p12); -PKCS12_free(p12); - -3.3 Changing a PKCS#12 structure password. - -int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass); - -This changes the password of an already existing PKCS#12 structure. oldpass -is the old password and newpass is the new one. An error occurs if the old -password is incorrect. - -LOW LEVEL FUNCTIONS. - -In some cases the high level functions do not provide the necessary -functionality. For example if you want to generate or parse more complex -PKCS#12 files. The sample pkcs12 application uses the low level functions -to display details about the internal structure of a PKCS#12 file. - -Introduction. - -This is a brief description of how a PKCS#12 file is represented internally: -some knowledge of PKCS#12 is assumed. - -A PKCS#12 object contains several levels. - -At the lowest level is a PKCS12_SAFEBAG. This can contain a certificate, a -CRL, a private key, encrypted or unencrypted, a set of safebags (so the -structure can be nested) or other secrets (not documented at present). -A safebag can optionally have attributes, currently these are: a unicode -friendlyName (a Unicode string) or a localKeyID (a string of bytes). - -At the next level is an authSafe which is a set of safebags collected into -a PKCS#7 ContentInfo. This can be just plain data, or encrypted itself. - -At the top level is the PKCS12 structure itself which contains a set of -authSafes in an embedded PKCS#7 Contentinfo of type data. In addition it -contains a MAC which is a kind of password protected digest to preserve -integrity (so any unencrypted stuff below can't be tampered with). - -The reason for these levels is so various objects can be encrypted in various -ways. For example you might want to encrypt a set of private keys with -triple-DES and then include the related certificates either unencrypted or -with lower encryption. Yes it's the dreaded crypto laws at work again which -allow strong encryption on private keys and only weak encryption on other -stuff. - -To build one of these things you turn all certificates and keys into safebags -(with optional attributes). You collect the safebags into (one or more) STACKS -and convert these into authsafes (encrypted or unencrypted). The authsafes -are collected into a STACK and added to a PKCS12 structure. Finally a MAC -inserted. - -Pulling one apart is basically the reverse process. The MAC is verified against -the given password. The authsafes are extracted and each authsafe split into -a set of safebags (possibly involving decryption). Finally the safebags are -decomposed into the original keys and certificates and the attributes used to -match up private key and certificate pairs. - -Anyway here are the functions that do the dirty work. - -1. Construction functions. - -1.1 Safebag functions. - -M_PKCS12_x5092certbag(x509) - -This macro takes an X509 structure and returns a certificate bag. The -X509 structure can be freed up after calling this function. - -M_PKCS12_x509crl2certbag(crl) - -As above but for a CRL. - -PKCS8_PRIV_KEY_INFO *PKEY2PKCS8(EVP_PKEY *pkey) - -Take a private key and convert it into a PKCS#8 PrivateKeyInfo structure. -Works for both RSA and DSA private keys. NB since the PKCS#8 PrivateKeyInfo -structure contains a private key data in plain text form it should be free'd -up as soon as it has been encrypted for security reasons (freeing up the -structure zeros out the sensitive data). This can be done with -PKCS8_PRIV_KEY_INFO_free(). - -PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage) - -This sets the key type when a key is imported into MSIE or Outlook 98. Two -values are currently supported: KEY_EX and KEY_SIG. KEY_EX is an exchange type -key that can also be used for signing but its size is limited in the export -versions of MS software to 512 bits, it is also the default. KEY_SIG is a -signing only key but the keysize is unlimited (well 16K is supposed to work). -If you are using the domestic version of MSIE then you can ignore this because -KEY_EX is not limited and can be used for both. - -PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8) - -Convert a PKCS8 private key structure into a keybag. This routine embeds the -p8 structure in the keybag so p8 should not be freed up or used after it is -called. The p8 structure will be freed up when the safebag is freed. - -PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8) - -Convert a PKCS#8 structure into a shrouded key bag (encrypted). p8 is not -embedded and can be freed up after use. - -int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen) -int PKCS12_add_friendlyname(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen) - -Add a local key id or a friendlyname to a safebag. - -1.2 Authsafe functions. - -PKCS7 *PKCS12_pack_p7data(STACK *sk) -Take a stack of safebags and convert them into an unencrypted authsafe. The -stack of safebags can be freed up after calling this function. - -PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int iter, STACK *bags); - -As above but encrypted. - -1.3 PKCS12 functions. - -PKCS12 *PKCS12_init(int mode) - -Initialise a PKCS12 structure (currently mode should be NID_pkcs7_data). - -M_PKCS12_pack_authsafes(p12, safes) - -This macro takes a STACK of authsafes and adds them to a PKCS#12 structure. - -int PKCS12_set_mac(PKCS12 *p12, unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int iter, EVP_MD *md_type); - -Add a MAC to a PKCS12 structure. If EVP_MD is NULL use SHA-1, the spec suggests -that SHA-1 should be used. - -2. Extraction Functions. - -2.1 Safebags. - -M_PKCS12_bag_type(bag) - -Return the type of "bag". Returns one of the following - -NID_keyBag -NID_pkcs8ShroudedKeyBag 7 -NID_certBag 8 -NID_crlBag 9 -NID_secretBag 10 -NID_safeContentsBag 11 - -M_PKCS12_cert_bag_type(bag) - -Returns type of certificate bag, following are understood. - -NID_x509Certificate 14 -NID_sdsiCertificate 15 - -M_PKCS12_crl_bag_type(bag) - -Returns crl bag type, currently only NID_crlBag is recognised. - -M_PKCS12_certbag2x509(bag) - -This macro extracts an X509 certificate from a certificate bag. - -M_PKCS12_certbag2x509crl(bag) - -As above but for a CRL. - -EVP_PKEY * PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8) - -Extract a private key from a PKCS8 private key info structure. - -M_PKCS12_decrypt_skey(bag, pass, passlen) - -Decrypt a shrouded key bag and return a PKCS8 private key info structure. -Works with both RSA and DSA keys - -char *PKCS12_get_friendlyname(bag) - -Returns the friendlyName of a bag if present or NULL if none. The returned -string is a null terminated ASCII string allocated with Malloc(). It should -thus be freed up with Free() after use. - -2.2 AuthSafe functions. - -M_PKCS12_unpack_p7data(p7) - -Extract a STACK of safe bags from a PKCS#7 data ContentInfo. - -#define M_PKCS12_unpack_p7encdata(p7, pass, passlen) - -As above but for an encrypted content info. - -2.3 PKCS12 functions. - -M_PKCS12_unpack_authsafes(p12) - -Extract a STACK of authsafes from a PKCS12 structure. - -M_PKCS12_mac_present(p12) - -Check to see if a MAC is present. - -int PKCS12_verify_mac(PKCS12 *p12, unsigned char *pass, int passlen) - -Verify a MAC on a PKCS12 structure. Returns an error if MAC not present. - - -Notes. - -1. All the function return 0 or NULL on error. -2. Encryption based functions take a common set of parameters. These are -described below. - -pass, passlen -ASCII password and length. The password on the MAC is called the "integrity -password" the encryption password is called the "privacy password" in the -PKCS#12 documentation. The passwords do not have to be the same. If -1 is -passed for the length it is worked out by the function itself (currently -this is sometimes done whatever is passed as the length but that may change). - -salt, saltlen -A 'salt' if salt is NULL a random salt is used. If saltlen is also zero a -default length is used. - -iter -Iteration count. This is a measure of how many times an internal function is -called to encrypt the data. The larger this value is the longer it takes, it -makes dictionary attacks on passwords harder. NOTE: Some implementations do -not support an iteration count on the MAC. If the password for the MAC and -encryption is the same then there is no point in having a high iteration -count for encryption if the MAC has no count. The MAC could be attacked -and the password used for the main decryption. - -pbe_nid -This is the NID of the password based encryption method used. The following are -supported. -NID_pbe_WithSHA1And128BitRC4 -NID_pbe_WithSHA1And40BitRC4 -NID_pbe_WithSHA1And3_Key_TripleDES_CBC -NID_pbe_WithSHA1And2_Key_TripleDES_CBC -NID_pbe_WithSHA1And128BitRC2_CBC -NID_pbe_WithSHA1And40BitRC2_CBC - -Which you use depends on the implementation you are exporting to. "Export -grade" (i.e. cryptographically challenged) products cannot support all -algorithms. Typically you may be able to use any encryption on shrouded key -bags but they must then be placed in an unencrypted authsafe. Other authsafes -may only support 40bit encryption. Of course if you are using SSLeay -throughout you can strongly encrypt everything and have high iteration counts -on everything. - -3. For decryption routines only the password and length are needed. - -4. Unlike the external version the nid's of objects are the values of the -constants: that is NID_certBag is the real nid, therefore there is no -PKCS12_obj_offset() function. Note the object constants are not the same as -those of the external version. If you use these constants then you will need -to recompile your code. - -5. With the exception of PKCS12_MAKE_KEYBAG(), after calling any function or -macro of the form PKCS12_MAKE_SOMETHING(other) the "other" structure can be -reused or freed up safely. - diff --git a/sys/src/ape/lib/openssl/doc/openssl_button.gif b/sys/src/ape/lib/openssl/doc/openssl_button.gif Binary files differdeleted file mode 100644 index 3d3c90c9f..000000000 --- a/sys/src/ape/lib/openssl/doc/openssl_button.gif +++ /dev/null diff --git a/sys/src/ape/lib/openssl/doc/openssl_button.html b/sys/src/ape/lib/openssl/doc/openssl_button.html deleted file mode 100644 index 44c91bd3d..000000000 --- a/sys/src/ape/lib/openssl/doc/openssl_button.html +++ /dev/null @@ -1,7 +0,0 @@ - -<!-- the `Includes OpenSSL Cryptogaphy Software' button --> -<!-- freely usable by any application linked against OpenSSL --> -<a href="http://www.openssl.org/"> -<img src="openssl_button.gif" - width=102 height=47 border=0></a> - diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CIPHER_get_name.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CIPHER_get_name.pod deleted file mode 100644 index f81f692df..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CIPHER_get_name.pod +++ /dev/null @@ -1,112 +0,0 @@ -=pod - -=head1 NAME - -SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description - get SSL_CIPHER properties - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher); - int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits); - char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher); - char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); - -=head1 DESCRIPTION - -SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the -argument is the NULL pointer, a pointer to the constant value "NONE" is -returned. - -SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>. If -B<alg_bits> is not NULL, it contains the number of bits processed by the -chosen algorithm. If B<cipher> is NULL, 0 is returned. - -SSL_CIPHER_get_version() returns the protocol version for B<cipher>, currently -"SSLv2", "SSLv3", or "TLSv1". If B<cipher> is NULL, "(NONE)" is returned. - -SSL_CIPHER_description() returns a textual description of the cipher used -into the buffer B<buf> of length B<len> provided. B<len> must be at least -128 bytes, otherwise a pointer to the the string "Buffer too small" is -returned. If B<buf> is NULL, a buffer of 128 bytes is allocated using -OPENSSL_malloc(). If the allocation fails, a pointer to the string -"OPENSSL_malloc Error" is returned. - -=head1 NOTES - -The number of bits processed can be different from the secret bits. An -export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm -does use the full 128 bits (which would be returned for B<alg_bits>), of -which however 88bits are fixed. The search space is hence only 40 bits. - -The string returned by SSL_CIPHER_description() in case of success consists -of cleartext information separated by one or more blanks in the following -sequence: - -=over 4 - -=item <ciphername> - -Textual representation of the cipher name. - -=item <protocol version> - -Protocol version: B<SSLv2>, B<SSLv3>. The TLSv1 ciphers are flagged with SSLv3. - -=item Kx=<key exchange> - -Key exchange method: B<RSA> (for export ciphers as B<RSA(512)> or -B<RSA(1024)>), B<DH> (for export ciphers as B<DH(512)> or B<DH(1024)>), -B<DH/RSA>, B<DH/DSS>, B<Fortezza>. - -=item Au=<authentication> - -Authentication method: B<RSA>, B<DSS>, B<DH>, B<None>. None is the -representation of anonymous ciphers. - -=item Enc=<symmetric encryption method> - -Encryption method with number of secret bits: B<DES(40)>, B<DES(56)>, -B<3DES(168)>, B<RC4(40)>, B<RC4(56)>, B<RC4(64)>, B<RC4(128)>, -B<RC2(40)>, B<RC2(56)>, B<RC2(128)>, B<IDEA(128)>, B<Fortezza>, B<None>. - -=item Mac=<message authentication code> - -Message digest: B<MD5>, B<SHA1>. - -=item <export flag> - -If the cipher is flagged exportable with respect to old US crypto -regulations, the word "B<export>" is printed. - -=back - -=head1 EXAMPLES - -Some examples for the output of SSL_CIPHER_description(): - - EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 - EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1 - RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 - EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export - -=head1 BUGS - -If SSL_CIPHER_description() is called with B<cipher> being NULL, the -library crashes. - -If SSL_CIPHER_description() cannot handle a built-in cipher, the according -description of the cipher property is B<unknown>. This case should not -occur. - -=head1 RETURN VALUES - -See DESCRIPTION - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>, -L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_COMP_add_compression_method.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_COMP_add_compression_method.pod deleted file mode 100644 index 42fa66b19..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_COMP_add_compression_method.pod +++ /dev/null @@ -1,70 +0,0 @@ -=pod - -=head1 NAME - -SSL_COMP_add_compression_method - handle SSL/TLS integrated compression methods - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); - -=head1 DESCRIPTION - -SSL_COMP_add_compression_method() adds the compression method B<cm> with -the identifier B<id> to the list of available compression methods. This -list is globally maintained for all SSL operations within this application. -It cannot be set for specific SSL_CTX or SSL objects. - -=head1 NOTES - -The TLS standard (or SSLv3) allows the integration of compression methods -into the communication. The TLS RFC does however not specify compression -methods or their corresponding identifiers, so there is currently no compatible -way to integrate compression with unknown peers. It is therefore currently not -recommended to integrate compression into applications. Applications for -non-public use may agree on certain compression methods. Using different -compression methods with the same identifier will lead to connection failure. - -An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) -will unconditionally send the list of all compression methods enabled with -SSL_COMP_add_compression_method() to the server during the handshake. -Unlike the mechanisms to set a cipher list, there is no method available to -restrict the list of compression method on a per connection basis. - -An OpenSSL server will match the identifiers listed by a client against -its own compression methods and will unconditionally activate compression -when a matching identifier is found. There is no way to restrict the list -of compression methods supported on a per connection basis. - -The OpenSSL library has the compression methods B<COMP_rle()> and (when -especially enabled during compilation) B<COMP_zlib()> available. - -=head1 WARNINGS - -Once the identities of the compression methods for the TLS protocol have -been standardized, the compression API will most likely be changed. Using -it in the current state is not recommended. - -=head1 RETURN VALUES - -SSL_COMP_add_compression_method() may return the following values: - -=over 4 - -=item 0 - -The operation succeeded. - -=item 1 - -The operation failed. Check the error queue to find out the reason. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_extra_chain_cert.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_extra_chain_cert.pod deleted file mode 100644 index ee28f5ccc..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_extra_chain_cert.pod +++ /dev/null @@ -1,39 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_add_extra_chain_cert - add certificate to chain - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_add_extra_chain_cert(SSL_CTX ctx, X509 *x509) - -=head1 DESCRIPTION - -SSL_CTX_add_extra_chain_cert() adds the certificate B<x509> to the certificate -chain presented together with the certificate. Several certificates -can be added one after the other. - -=head1 NOTES - -When constructing the certificate chain, the chain will be formed from -these certificates explicitly specified. If no chain is specified, -the library will try to complete the chain from the available CA -certificates in the trusted CA storage, see -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. - -=head1 RETURN VALUES - -SSL_CTX_add_extra_chain_cert() returns 1 on success. Check out the -error stack to find out the reason for failure otherwise. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, -L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_session.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_session.pod deleted file mode 100644 index 82676b26b..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_add_session.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_add_session, SSL_add_session, SSL_CTX_remove_session, SSL_remove_session - manipulate session cache - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c); - int SSL_add_session(SSL_CTX *ctx, SSL_SESSION *c); - - int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c); - int SSL_remove_session(SSL_CTX *ctx, SSL_SESSION *c); - -=head1 DESCRIPTION - -SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The -reference count for session B<c> is incremented by 1. If a session with -the same session id already exists, the old session is removed by calling -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>. - -SSL_CTX_remove_session() removes the session B<c> from the context B<ctx>. -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> is called once for B<c>. - -SSL_add_session() and SSL_remove_session() are synonyms for their -SSL_CTX_*() counterparts. - -=head1 NOTES - -When adding a new session to the internal session cache, it is examined -whether a session with the same session id already exists. In this case -it is assumed that both sessions are identical. If the same session is -stored in a different SSL_SESSION object, The old session is -removed and replaced by the new session. If the session is actually -identical (the SSL_SESSION object is identical), SSL_CTX_add_session() -is a no-op, and the return value is 0. - -If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE -flag then the internal cache will not be populated automatically by new -sessions negotiated by the SSL/TLS implementation, even though the internal -cache will be searched automatically for session-resume requests (the -latter can be surpressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the -application can use SSL_CTX_add_session() directly to have full control -over the sessions that can be resumed if desired. - - -=head1 RETURN VALUES - -The following values are returned by all functions: - -=over 4 - -=item 0 - - The operation failed. In case of the add operation, it was tried to add - the same (identical) session twice. In case of the remove operation, the - session was not found in the cache. - -=item 1 - - The operation succeeded. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_ctrl.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_ctrl.pod deleted file mode 100644 index fb6adcf50..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_ctrl.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal handling functions for SSL_CTX and SSL objects - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); - long SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)()); - - long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); - long SSL_callback_ctrl(SSL *, int cmd, void (*fp)()); - -=head1 DESCRIPTION - -The SSL_*_ctrl() family of functions is used to manipulate settings of -the SSL_CTX and SSL objects. Depending on the command B<cmd> the arguments -B<larg>, B<parg>, or B<fp> are evaluated. These functions should never -be called directly. All functionalities needed are made available via -other functions or macros. - -=head1 RETURN VALUES - -The return values of the SSL*_ctrl() functions depend on the command -supplied via the B<cmd> parameter. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_flush_sessions.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_flush_sessions.pod deleted file mode 100644 index 148c36c87..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_flush_sessions.pod +++ /dev/null @@ -1,49 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_flush_sessions, SSL_flush_sessions - remove expired sessions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); - void SSL_flush_sessions(SSL_CTX *ctx, long tm); - -=head1 DESCRIPTION - -SSL_CTX_flush_sessions() causes a run through the session cache of -B<ctx> to remove sessions expired at time B<tm>. - -SSL_flush_sessions() is a synonym for SSL_CTX_flush_sessions(). - -=head1 NOTES - -If enabled, the internal session cache will collect all sessions established -up to the specified maximum number (see SSL_CTX_sess_set_cache_size()). -As sessions will not be reused ones they are expired, they should be -removed from the cache to save resources. This can either be done - automatically whenever 255 new sessions were established (see -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) -or manually by calling SSL_CTX_flush_sessions(). - -The parameter B<tm> specifies the time which should be used for the -expiration test, in most cases the actual time given by time(0) -will be used. - -SSL_CTX_flush_sessions() will only check sessions stored in the internal -cache. When a session is found and removed, the remove_session_cb is however -called to synchronize with the external cache (see -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>). - -=head1 RETURN VALUES - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_free.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_free.pod deleted file mode 100644 index 51d867696..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_free.pod +++ /dev/null @@ -1,41 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_free - free an allocated SSL_CTX object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_free(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_free() decrements the reference count of B<ctx>, and removes the -SSL_CTX object pointed to by B<ctx> and frees up the allocated memory if the -the reference count has reached 0. - -It also calls the free()ing procedures for indirectly affected items, if -applicable: the session cache, the list of ciphers, the list of Client CAs, -the certificates and keys. - -=head1 WARNINGS - -If a session-remove callback is set (SSL_CTX_sess_set_remove_cb()), this -callback will be called for each session being freed from B<ctx>'s -session cache. This implies, that all corresponding sessions from an -external session cache are removed as well. If this is not desired, the user -should explicitly unset the callback by calling -SSL_CTX_sess_set_remove_cb(B<ctx>, NULL) prior to calling SSL_CTX_free(). - -=head1 RETURN VALUES - -SSL_CTX_free() does not provide diagnostic information. - -=head1 SEE ALSO - -L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)>, -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_ex_new_index.pod deleted file mode 100644 index 0c40a91f2..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_ex_new_index.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data - internal application specific data functions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg); - - void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx); - - typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); - -=head1 DESCRIPTION - -Several OpenSSL structures can have application specific data attached to them. -These functions are used internally by OpenSSL to manipulate application -specific data attached to a specific structure. - -SSL_CTX_get_ex_new_index() is used to register a new index for application -specific data. - -SSL_CTX_set_ex_data() is used to store application data at B<arg> for B<idx> -into the B<ctx> object. - -SSL_CTX_get_ex_data() is used to retrieve the information for B<idx> from -B<ctx>. - -A detailed description for the B<*_get_ex_new_index()> functionality -can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. -The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_verify_mode.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_verify_mode.pod deleted file mode 100644 index 2a3747e75..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_get_verify_mode.pod +++ /dev/null @@ -1,50 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_get_verify_mode, SSL_get_verify_mode, SSL_CTX_get_verify_depth, SSL_get_verify_depth, SSL_get_verify_callback, SSL_CTX_get_verify_callback - get currently set verification parameters - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); - int SSL_get_verify_mode(const SSL *ssl); - int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); - int SSL_get_verify_depth(const SSL *ssl); - int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *); - int (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *); - -=head1 DESCRIPTION - -SSL_CTX_get_verify_mode() returns the verification mode currently set in -B<ctx>. - -SSL_get_verify_mode() returns the verification mode currently set in -B<ssl>. - -SSL_CTX_get_verify_depth() returns the verification depth limit currently set -in B<ctx>. If no limit has been explicitly set, -1 is returned and the -default value will be used. - -SSL_get_verify_depth() returns the verification depth limit currently set -in B<ssl>. If no limit has been explicitly set, -1 is returned and the -default value will be used. - -SSL_CTX_get_verify_callback() returns a function pointer to the verification -callback currently set in B<ctx>. If no callback was explicitly set, the -NULL pointer is returned and the default callback will be used. - -SSL_get_verify_callback() returns a function pointer to the verification -callback currently set in B<ssl>. If no callback was explicitly set, the -NULL pointer is returned and the default callback will be used. - -=head1 RETURN VALUES - -See DESCRIPTION - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_load_verify_locations.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_load_verify_locations.pod deleted file mode 100644 index 84a799fc7..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_load_verify_locations.pod +++ /dev/null @@ -1,124 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_load_verify_locations - set default locations for trusted CA -certificates - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, - const char *CApath); - -=head1 DESCRIPTION - -SSL_CTX_load_verify_locations() specifies the locations for B<ctx>, at -which CA certificates for verification purposes are located. The certificates -available via B<CAfile> and B<CApath> are trusted. - -=head1 NOTES - -If B<CAfile> is not NULL, it points to a file of CA certificates in PEM -format. The file can contain several CA certificates identified by - - -----BEGIN CERTIFICATE----- - ... (CA certificate in base64 encoding) ... - -----END CERTIFICATE----- - -sequences. Before, between, and after the certificates text is allowed -which can be used e.g. for descriptions of the certificates. - -The B<CAfile> is processed on execution of the SSL_CTX_load_verify_locations() -function. - -If B<CApath> is not NULL, it points to a directory containing CA certificates -in PEM format. The files each contain one CA certificate. The files are -looked up by the CA subject name hash value, which must hence be available. -If more than one CA certificate with the same name hash value exist, the -extension must be different (e.g. 9d66eef0.0, 9d66eef0.1 etc). The search -is performed in the ordering of the extension number, regardless of other -properties of the certificates. -Use the B<c_rehash> utility to create the necessary links. - -The certificates in B<CApath> are only looked up when required, e.g. when -building the certificate chain or when actually performing the verification -of a peer certificate. - -When looking up CA certificates, the OpenSSL library will first search the -certificates in B<CAfile>, then those in B<CApath>. Certificate matching -is done based on the subject name, the key identifier (if present), and the -serial number as taken from the certificate to be verified. If these data -do not match, the next certificate will be tried. If a first certificate -matching the parameters is found, the verification process will be performed; -no other certificates for the same parameters will be searched in case of -failure. - -In server mode, when requesting a client certificate, the server must send -the list of CAs of which it will accept client certificates. This list -is not influenced by the contents of B<CAfile> or B<CApath> and must -explicitly be set using the -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> -family of functions. - -When building its own certificate chain, an OpenSSL client/server will -try to fill in missing certificates from B<CAfile>/B<CApath>, if the -certificate chain was not explicitly specified (see -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>. - -=head1 WARNINGS - -If several CA certificates matching the name, key identifier, and serial -number condition are available, only the first one will be examined. This -may lead to unexpected results if the same CA certificate is available -with different expiration dates. If a "certificate expired" verification -error occurs, no other certificate will be searched. Make sure to not -have expired certificates mixed with valid ones. - -=head1 EXAMPLES - -Generate a CA certificate file with descriptive text from the CA certificates -ca1.pem ca2.pem ca3.pem: - - #!/bin/sh - rm CAfile.pem - for i in ca1.pem ca2.pem ca3.pem ; do - openssl x509 -in $i -text >> CAfile.pem - done - -Prepare the directory /some/where/certs containing several CA certificates -for use as B<CApath>: - - cd /some/where/certs - c_rehash . - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The operation failed because B<CAfile> and B<CApath> are NULL or the -processing at one of the locations specified failed. Check the error -stack to find out the reason. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, -L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, -L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_new.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_new.pod deleted file mode 100644 index 465220a75..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_new.pod +++ /dev/null @@ -1,94 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_CTX *SSL_CTX_new(SSL_METHOD *method); - -=head1 DESCRIPTION - -SSL_CTX_new() creates a new B<SSL_CTX> object as framework to establish -TLS/SSL enabled connections. - -=head1 NOTES - -The SSL_CTX object uses B<method> as connection method. The methods exist -in a generic type (for client and server use), a server only type, and a -client only type. B<method> can be of the following types: - -=over 4 - -=item SSLv2_method(void), SSLv2_server_method(void), SSLv2_client_method(void) - -A TLS/SSL connection established with these methods will only understand -the SSLv2 protocol. A client will send out SSLv2 client hello messages -and will also indicate that it only understand SSLv2. A server will only -understand SSLv2 client hello messages. - -=item SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) - -A TLS/SSL connection established with these methods will only understand the -SSLv3 protocol. A client will send out SSLv3 client hello messages -and will indicate that it only understands SSLv3. A server will only understand -SSLv3 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). - -=item TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) - -A TLS/SSL connection established with these methods will only understand the -TLSv1 protocol. A client will send out TLSv1 client hello messages -and will indicate that it only understands TLSv1. A server will only understand -TLSv1 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). It will also not understand -SSLv3 client hello messages. - -=item SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) - -A TLS/SSL connection established with these methods will understand the SSLv2, -SSLv3, and TLSv1 protocol. A client will send out SSLv2 client hello messages -and will indicate that it also understands SSLv3 and TLSv1. A server will -understand SSLv2, SSLv3, and TLSv1 client hello messages. This is the best -choice when compatibility is a concern. - -=back - -The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, -SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the B<SSL_CTX_set_options()> or -B<SSL_set_options()> functions. Using these options it is possible to choose -e.g. SSLv23_server_method() and be able to negotiate with all possible -clients, but to only allow newer protocols like SSLv3 or TLSv1. - -SSL_CTX_new() initializes the list of ciphers, the session cache setting, -the callbacks, the keys and certificates, and the options to its default -values. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -The creation of a new SSL_CTX object failed. Check the error stack to -find out the reason. - -=item Pointer to an SSL_CTX object - -The return value points to an allocated SSL_CTX object. - -=back - -=head1 SEE ALSO - -L<SSL_CTX_free(3)|SSL_CTX_free(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<ssl(3)|ssl(3)>, L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_number.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_number.pod deleted file mode 100644 index 19aa4e290..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_number.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_sess_number, SSL_CTX_sess_connect, SSL_CTX_sess_connect_good, SSL_CTX_sess_connect_renegotiate, SSL_CTX_sess_accept, SSL_CTX_sess_accept_good, SSL_CTX_sess_accept_renegotiate, SSL_CTX_sess_hits, SSL_CTX_sess_cb_hits, SSL_CTX_sess_misses, SSL_CTX_sess_timeouts, SSL_CTX_sess_cache_full - obtain session cache statistics - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_sess_number(SSL_CTX *ctx); - long SSL_CTX_sess_connect(SSL_CTX *ctx); - long SSL_CTX_sess_connect_good(SSL_CTX *ctx); - long SSL_CTX_sess_connect_renegotiate(SSL_CTX *ctx); - long SSL_CTX_sess_accept(SSL_CTX *ctx); - long SSL_CTX_sess_accept_good(SSL_CTX *ctx); - long SSL_CTX_sess_accept_renegotiate(SSL_CTX *ctx); - long SSL_CTX_sess_hits(SSL_CTX *ctx); - long SSL_CTX_sess_cb_hits(SSL_CTX *ctx); - long SSL_CTX_sess_misses(SSL_CTX *ctx); - long SSL_CTX_sess_timeouts(SSL_CTX *ctx); - long SSL_CTX_sess_cache_full(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_sess_number() returns the current number of sessions in the internal -session cache. - -SSL_CTX_sess_connect() returns the number of started SSL/TLS handshakes in -client mode. - -SSL_CTX_sess_connect_good() returns the number of successfully established -SSL/TLS sessions in client mode. - -SSL_CTX_sess_connect_renegotiate() returns the number of start renegotiations -in client mode. - -SSL_CTX_sess_accept() returns the number of started SSL/TLS handshakes in -server mode. - -SSL_CTX_sess_accept_good() returns the number of successfully established -SSL/TLS sessions in server mode. - -SSL_CTX_sess_accept_renegotiate() returns the number of start renegotiations -in server mode. - -SSL_CTX_sess_hits() returns the number of successfully reused sessions. -In client mode a session set with L<SSL_set_session(3)|SSL_set_session(3)> -successfully reused is counted as a hit. In server mode a session successfully -retrieved from internal or external cache is counted as a hit. - -SSL_CTX_sess_cb_hits() returns the number of successfully retrieved sessions -from the external session cache in server mode. - -SSL_CTX_sess_misses() returns the number of sessions proposed by clients -that were not found in the internal session cache in server mode. - -SSL_CTX_sess_timeouts() returns the number of sessions proposed by clients -and either found in the internal or external session cache in server mode, - but that were invalid due to timeout. These sessions are not included in -the SSL_CTX_sess_hits() count. - -SSL_CTX_sess_cache_full() returns the number of sessions that were removed -because the maximum session cache size was exceeded. - -=head1 RETURN VALUES - -The functions return the values indicated in the DESCRIPTION section. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> -L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_cache_size.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_cache_size.pod deleted file mode 100644 index c8b99f4ee..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_cache_size.pod +++ /dev/null @@ -1,51 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size - manipulate session cache size - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t); - long SSL_CTX_sess_get_cache_size(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_sess_set_cache_size() sets the size of the internal session cache -of context B<ctx> to B<t>. - -SSL_CTX_sess_get_cache_size() returns the currently valid session cache size. - -=head1 NOTES - -The internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, -currently 1024*20, so that up to 20000 sessions can be held. This size -can be modified using the SSL_CTX_sess_set_cache_size() call. A special -case is the size 0, which is used for unlimited size. - -When the maximum number of sessions is reached, no more new sessions are -added to the cache. New space may be added by calling -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> to remove -expired sessions. - -If the size of the session cache is reduced and more sessions are already -in the session cache, old session will be removed at the next time a -session shall be added. This removal is not synchronized with the -expiration of sessions. - -=head1 RETURN VALUES - -SSL_CTX_sess_set_cache_size() returns the previously valid size. - -SSL_CTX_sess_get_cache_size() returns the currently valid size. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_get_cb.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_get_cb.pod deleted file mode 100644 index b9d54a40a..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sess_set_get_cb.pod +++ /dev/null @@ -1,87 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb, SSL_CTX_sess_set_get_cb, SSL_CTX_sess_get_new_cb, SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - provide callback functions for server side external session caching - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, - int (*new_session_cb)(SSL *, SSL_SESSION *)); - void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, - void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)); - void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, - SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)); - - int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess); - void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess); - SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *data, int len, int *copy); - - int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess); - void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess); - SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data, - int len, int *copy); - -=head1 DESCRIPTION - -SSL_CTX_sess_set_new_cb() sets the callback function, which is automatically -called whenever a new session was negotiated. - -SSL_CTX_sess_set_remove_cb() sets the callback function, which is -automatically called whenever a session is removed by the SSL engine, -because it is considered faulty or the session has become obsolete because -of exceeding the timeout value. - -SSL_CTX_sess_set_get_cb() sets the callback function which is called, -whenever a SSL/TLS client proposed to resume a session but the session -could not be found in the internal session cache (see -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>). -(SSL/TLS server only.) - -SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and -SSL_CTX_sess_get_get_cb() allow to retrieve the function pointers of the -provided callback functions. If a callback function has not been set, -the NULL pointer is returned. - -=head1 NOTES - -In order to allow external session caching, synchronization with the internal -session cache is realized via callback functions. Inside these callback -functions, session can be saved to disk or put into a database using the -L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> interface. - -The new_session_cb() is called, whenever a new session has been negotiated -and session caching is enabled (see -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>). -The new_session_cb() is passed the B<ssl> connection and the ssl session -B<sess>. If the callback returns B<0>, the session will be immediately -removed again. - -The remove_session_cb() is called, whenever the SSL engine removes a session -from the internal cache. This happens when the session is removed because -it is expired or when a connection was not shutdown cleanly. It also happens -for all sessions in the internal session cache when -L<SSL_CTX_free(3)|SSL_CTX_free(3)> is called. The remove_session_cb() is passed -the B<ctx> and the ssl session B<sess>. It does not provide any feedback. - -The get_session_cb() is only called on SSL/TLS servers with the session id -proposed by the client. The get_session_cb() is always called, also when -session caching was disabled. The get_session_cb() is passed the -B<ssl> connection, the session id of length B<length> at the memory location -B<data>. With the parameter B<copy> the callback can require the -SSL engine to increment the reference count of the SSL_SESSION object, -Normally the reference count is not incremented and therefore the -session must not be explicitly freed with -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, -L<SSL_CTX_free(3)|SSL_CTX_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sessions.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sessions.pod deleted file mode 100644 index e05aab3c1..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_sessions.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_sessions - access internal session cache - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_sessions() returns a pointer to the lhash databases containing the -internal session cache for B<ctx>. - -=head1 NOTES - -The sessions in the internal session cache are kept in an -L<lhash(3)|lhash(3)> type database. It is possible to directly -access this database e.g. for searching. In parallel, the sessions -form a linked list which is maintained separately from the -L<lhash(3)|lhash(3)> operations, so that the database must not be -modified directly but by using the -L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)> family of functions. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<lhash(3)|lhash(3)>, -L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_store.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_store.pod deleted file mode 100644 index 6acf0d9f9..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_store.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); - X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_set_cert_store() sets/replaces the certificate verification storage -of B<ctx> to/with B<store>. If another X509_STORE object is currently -set in B<ctx>, it will be X509_STORE_free()ed. - -SSL_CTX_get_cert_store() returns a pointer to the current certificate -verification storage. - -=head1 NOTES - -In order to verify the certificates presented by the peer, trusted CA -certificates must be accessed. These CA certificates are made available -via lookup methods, handled inside the X509_STORE. From the X509_STORE -the X509_STORE_CTX used when verifying certificates is created. - -Typically the trusted certificate store is handled indirectly via using -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. -Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions -it is possible to manipulate the X509_STORE object beyond the -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> -call. - -Currently no detailed documentation on how to use the X509_STORE -object is available. Not all members of the X509_STORE are used when -the verification takes place. So will e.g. the verify_callback() be -overridden with the verify_callback() set via the -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> family of functions. -This document must therefore be updated when documentation about the -X509_STORE object and its handling becomes available. - -=head1 RETURN VALUES - -SSL_CTX_set_cert_store() does not return diagnostic output. - -SSL_CTX_get_cert_store() returns the current setting. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_verify_callback.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_verify_callback.pod deleted file mode 100644 index c0f4f8570..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cert_verify_callback.pod +++ /dev/null @@ -1,75 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*callback)(X509_STORE_CTX *,void *), void *arg); - -=head1 DESCRIPTION - -SSL_CTX_set_cert_verify_callback() sets the verification callback function for -I<ctx>. SSL objects that are created from I<ctx> inherit the setting valid at -the time when L<SSL_new(3)|SSL_new(3)> is called. - -=head1 NOTES - -Whenever a certificate is verified during a SSL/TLS handshake, a verification -function is called. If the application does not explicitly specify a -verification callback function, the built-in verification function is used. -If a verification callback I<callback> is specified via -SSL_CTX_set_cert_verify_callback(), the supplied callback function is called -instead. By setting I<callback> to NULL, the default behaviour is restored. - -When the verification must be performed, I<callback> will be called with -the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The -argument I<arg> is specified by the application when setting I<callback>. - -I<callback> should return 1 to indicate verification success and 0 to -indicate verification failure. If SSL_VERIFY_PEER is set and I<callback> -returns 0, the handshake will fail. As the verification procedure may -allow to continue the connection in case of failure (by always returning 1) -the verification result must be set in any case using the B<error> -member of I<x509_store_ctx> so that the calling application will be informed -about the detailed result of the verification procedure! - -Within I<x509_store_ctx>, I<callback> has access to the I<verify_callback> -function set using L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>. - -=head1 WARNINGS - -Do not mix the verification callback described in this function with the -B<verify_callback> function called during the verification process. The -latter is set using the L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> -family of functions. - -Providing a complete verification procedure including certificate purpose -settings etc is a complex task. The built-in procedure is quite powerful -and in most cases it should be sufficient to modify its behaviour using -the B<verify_callback> function. - -=head1 BUGS - -=head1 RETURN VALUES - -SSL_CTX_set_cert_verify_callback() does not provide diagnostic information. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, -L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> - -=head1 HISTORY - -Previous to OpenSSL 0.9.7, the I<arg> argument to B<SSL_CTX_set_cert_verify_callback> -was ignored, and I<callback> was called simply as - int (*callback)(X509_STORE_CTX *) -To compile software written for previous versions of OpenSSL, a dummy -argument will have to be added to I<callback>. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod deleted file mode 100644 index ed64f6415..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod +++ /dev/null @@ -1,70 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_cipher_list, SSL_set_cipher_list - choose list of available SSL_CIPHERs - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str); - int SSL_set_cipher_list(SSL *ssl, const char *str); - -=head1 DESCRIPTION - -SSL_CTX_set_cipher_list() sets the list of available ciphers for B<ctx> -using the control string B<str>. The format of the string is described -in L<ciphers(1)|ciphers(1)>. The list of ciphers is inherited by all -B<ssl> objects created from B<ctx>. - -SSL_set_cipher_list() sets the list of ciphers only for B<ssl>. - -=head1 NOTES - -The control string B<str> should be universally usable and not depend -on details of the library configuration (ciphers compiled in). Thus no -syntax checking takes place. Items that are not recognized, because the -corresponding ciphers are not compiled in or because they are mistyped, -are simply ignored. Failure is only flagged if no ciphers could be collected -at all. - -It should be noted, that inclusion of a cipher to be used into the list is -a necessary condition. On the client side, the inclusion into the list is -also sufficient. On the server side, additional restrictions apply. All ciphers -have additional requirements. ADH ciphers don't need a certificate, but -DH-parameters must have been set. All other ciphers need a corresponding -certificate and key. - -A RSA cipher can only be chosen, when a RSA certificate is available. -RSA export ciphers with a keylength of 512 bits for the RSA key require -a temporary 512 bit RSA key, as typically the supplied key has a length -of 1024 bit (see -L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). -RSA ciphers using EDH need a certificate and key and additional DH-parameters -(see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). - -A DSA cipher can only be chosen, when a DSA certificate is available. -DSA ciphers always use DH key exchange and therefore need DH-parameters -(see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). - -When these conditions are not met for any cipher in the list (e.g. a -client only supports export RSA ciphers with a asymmetric key length -of 512 bits and the server is not configured to use temporary RSA -keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated -and the handshake will fail. - -=head1 RETURN VALUES - -SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher -could be selected and 0 on complete failure. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, -L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, -L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, -L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_CA_list.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_CA_list.pod deleted file mode 100644 index 632b556d1..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_CA_list.pod +++ /dev/null @@ -1,94 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_client_CA_list, SSL_set_client_CA_list, SSL_CTX_add_client_CA, -SSL_add_client_CA - set list of CAs sent to the client when requesting a -client certificate - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list); - void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list); - int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *cacert); - int SSL_add_client_CA(SSL *ssl, X509 *cacert); - -=head1 DESCRIPTION - -SSL_CTX_set_client_CA_list() sets the B<list> of CAs sent to the client when -requesting a client certificate for B<ctx>. - -SSL_set_client_CA_list() sets the B<list> of CAs sent to the client when -requesting a client certificate for the chosen B<ssl>, overriding the -setting valid for B<ssl>'s SSL_CTX object. - -SSL_CTX_add_client_CA() adds the CA name extracted from B<cacert> to the -list of CAs sent to the client when requesting a client certificate for -B<ctx>. - -SSL_add_client_CA() adds the CA name extracted from B<cacert> to the -list of CAs sent to the client when requesting a client certificate for -the chosen B<ssl>, overriding the setting valid for B<ssl>'s SSL_CTX object. - -=head1 NOTES - -When a TLS/SSL server requests a client certificate (see -B<SSL_CTX_set_verify_options()>), it sends a list of CAs, for which -it will accept certificates, to the client. - -This list must explicitly be set using SSL_CTX_set_client_CA_list() for -B<ctx> and SSL_set_client_CA_list() for the specific B<ssl>. The list -specified overrides the previous setting. The CAs listed do not become -trusted (B<list> only contains the names, not the complete certificates); use -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> -to additionally load them for verification. - -If the list of acceptable CAs is compiled in a file, the -L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)> -function can be used to help importing the necessary data. - -SSL_CTX_add_client_CA() and SSL_add_client_CA() can be used to add additional -items the list of client CAs. If no list was specified before using -SSL_CTX_set_client_CA_list() or SSL_set_client_CA_list(), a new client -CA list for B<ctx> or B<ssl> (as appropriate) is opened. - -These functions are only useful for TLS/SSL servers. - -=head1 RETURN VALUES - -SSL_CTX_set_client_CA_list() and SSL_set_client_CA_list() do not return -diagnostic information. - -SSL_CTX_add_client_CA() and SSL_add_client_CA() have the following return -values: - -=over 4 - -=item 1 - -The operation succeeded. - -=item 0 - -A failure while manipulating the STACK_OF(X509_NAME) object occurred or -the X509_NAME could not be extracted from B<cacert>. Check the error stack -to find out the reason. - -=back - -=head1 EXAMPLES - -Scan all certificates in B<CAfile> and list them as acceptable CAs: - - SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile)); - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, -L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_cert_cb.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_cert_cb.pod deleted file mode 100644 index 3465b5c7b..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_client_cert_cb.pod +++ /dev/null @@ -1,94 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_client_cert_cb, SSL_CTX_get_client_cert_cb - handle client certificate callback function - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); - int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); - int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); - -=head1 DESCRIPTION - -SSL_CTX_set_client_cert_cb() sets the B<client_cert_cb()> callback, that is -called when a client certificate is requested by a server and no certificate -was yet set for the SSL object. - -When B<client_cert_cb()> is NULL, no callback function is used. - -SSL_CTX_get_client_cert_cb() returns a pointer to the currently set callback -function. - -client_cert_cb() is the application defined callback. If it wants to -set a certificate, a certificate/private key combination must be set -using the B<x509> and B<pkey> arguments and "1" must be returned. The -certificate will be installed into B<ssl>, see the NOTES and BUGS sections. -If no certificate should be set, "0" has to be returned and no certificate -will be sent. A negative return value will suspend the handshake and the -handshake function will return immediatly. L<SSL_get_error(3)|SSL_get_error(3)> -will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was -suspended. The next call to the handshake function will again lead to the call -of client_cert_cb(). It is the job of the client_cert_cb() to store information -about the state of the last call, if required to continue. - -=head1 NOTES - -During a handshake (or renegotiation) a server may request a certificate -from the client. A client certificate must only be sent, when the server -did send the request. - -When a certificate was set using the -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)> family of functions, -it will be sent to the server. The TLS standard requires that only a -certificate is sent, if it matches the list of acceptable CAs sent by the -server. This constraint is violated by the default behavior of the OpenSSL -library. Using the callback function it is possible to implement a proper -selection routine or to allow a user interaction to choose the certificate to -be sent. - -If a callback function is defined and no certificate was yet defined for the -SSL object, the callback function will be called. -If the callback function returns a certificate, the OpenSSL library -will try to load the private key and certificate data into the SSL -object using the SSL_use_certificate() and SSL_use_private_key() functions. -Thus it will permanently install the certificate and key for this SSL -object. It will not be reset by calling L<SSL_clear(3)|SSL_clear(3)>. -If the callback returns no certificate, the OpenSSL library will not send -a certificate. - -=head1 BUGS - -The client_cert_cb() cannot return a complete certificate chain, it can -only return one client certificate. If the chain only has a length of 2, -the root CA certificate may be omitted according to the TLS standard and -thus a standard conforming answer can be sent to the server. For a -longer chain, the client must send the complete chain (with the option -to leave out the root CA certificate). This can only be accomplished by -either adding the intermediate CA certificates into the trusted -certificate store for the SSL_CTX object (resulting in having to add -CA certificates that otherwise maybe would not be trusted), or by adding -the chain certificates using the -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> -function, which is only available for the SSL_CTX object as a whole and that -therefore probably can only apply for one client certificate, making -the concept of the callback function (to allow the choice from several -certificates) questionable. - -Once the SSL object has been used in conjunction with the callback function, -the certificate will be set for the SSL object and will not be cleared -even when L<SSL_clear(3)|SSL_clear(3)> is being called. It is therefore -mandatory to destroy the SSL object using L<SSL_free(3)|SSL_free(3)> -and create a new one to return to the previous state. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, -L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_default_passwd_cb.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_default_passwd_cb.pod deleted file mode 100644 index 2b87f01ca..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_default_passwd_cb.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_default_passwd_cb, SSL_CTX_set_default_passwd_cb_userdata - set passwd callback for encrypted PEM file handling - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); - void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); - - int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata); - -=head1 DESCRIPTION - -SSL_CTX_set_default_passwd_cb() sets the default password callback called -when loading/storing a PEM certificate with encryption. - -SSL_CTX_set_default_passwd_cb_userdata() sets a pointer to B<userdata> which -will be provided to the password callback on invocation. - -The pem_passwd_cb(), which must be provided by the application, hands back the -password to be used during decryption. On invocation a pointer to B<userdata> -is provided. The pem_passwd_cb must write the password into the provided buffer -B<buf> which is of size B<size>. The actual length of the password must -be returned to the calling function. B<rwflag> indicates whether the -callback is used for reading/decryption (rwflag=0) or writing/encryption -(rwflag=1). - -=head1 NOTES - -When loading or storing private keys, a password might be supplied to -protect the private key. The way this password can be supplied may depend -on the application. If only one private key is handled, it can be practical -to have pem_passwd_cb() handle the password dialog interactively. If several -keys have to be handled, it can be practical to ask for the password once, -then keep it in memory and use it several times. In the last case, the -password could be stored into the B<userdata> storage and the -pem_passwd_cb() only returns the password already stored. - -When asking for the password interactively, pem_passwd_cb() can use -B<rwflag> to check, whether an item shall be encrypted (rwflag=1). -In this case the password dialog may ask for the same password twice -for comparison in order to catch typos, that would make decryption -impossible. - -Other items in PEM formatting (certificates) can also be encrypted, it is -however not usual, as certificate information is considered public. - -=head1 RETURN VALUES - -SSL_CTX_set_default_passwd_cb() and SSL_CTX_set_default_passwd_cb_userdata() -do not provide diagnostic information. - -=head1 EXAMPLES - -The following example returns the password provided as B<userdata> to the -calling function. The password is considered to be a '\0' terminated -string. If the password does not fit into the buffer, the password is -truncated. - - int pem_passwd_cb(char *buf, int size, int rwflag, void *password) - { - strncpy(buf, (char *)(password), size); - buf[size - 1] = '\0'; - return(strlen(buf)); - } - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_generate_session_id.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_generate_session_id.pod deleted file mode 100644 index 798e8443a..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_generate_session_id.pod +++ /dev/null @@ -1,150 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_generate_session_id, SSL_set_generate_session_id, SSL_has_matching_session_id - manipulate generation of SSL session IDs (server only) - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, - unsigned int *id_len); - - int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); - int SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB, cb); - int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, - unsigned int id_len); - -=head1 DESCRIPTION - -SSL_CTX_set_generate_session_id() sets the callback function for generating -new session ids for SSL/TLS sessions for B<ctx> to be B<cb>. - -SSL_set_generate_session_id() sets the callback function for generating -new session ids for SSL/TLS sessions for B<ssl> to be B<cb>. - -SSL_has_matching_session_id() checks, whether a session with id B<id> -(of length B<id_len>) is already contained in the internal session cache -of the parent context of B<ssl>. - -=head1 NOTES - -When a new session is established between client and server, the server -generates a session id. The session id is an arbitrary sequence of bytes. -The length of the session id is 16 bytes for SSLv2 sessions and between -1 and 32 bytes for SSLv3/TLSv1. The session id is not security critical -but must be unique for the server. Additionally, the session id is -transmitted in the clear when reusing the session so it must not contain -sensitive information. - -Without a callback being set, an OpenSSL server will generate a unique -session id from pseudo random numbers of the maximum possible length. -Using the callback function, the session id can be changed to contain -additional information like e.g. a host id in order to improve load balancing -or external caching techniques. - -The callback function receives a pointer to the memory location to put -B<id> into and a pointer to the maximum allowed length B<id_len>. The -buffer at location B<id> is only guaranteed to have the size B<id_len>. -The callback is only allowed to generate a shorter id and reduce B<id_len>; -the callback B<must never> increase B<id_len> or write to the location -B<id> exceeding the given limit. - -If a SSLv2 session id is generated and B<id_len> is reduced, it will be -restored after the callback has finished and the session id will be padded -with 0x00. It is not recommended to change the B<id_len> for SSLv2 sessions. -The callback can use the L<SSL_get_version(3)|SSL_get_version(3)> function -to check, whether the session is of type SSLv2. - -The location B<id> is filled with 0x00 before the callback is called, so the -callback may only fill part of the possible length and leave B<id_len> -untouched while maintaining reproducibility. - -Since the sessions must be distinguished, session ids must be unique. -Without the callback a random number is used, so that the probability -of generating the same session id is extremely small (2^128 possible ids -for an SSLv2 session, 2^256 for SSLv3/TLSv1). In order to assure the -uniqueness of the generated session id, the callback must call -SSL_has_matching_session_id() and generate another id if a conflict occurs. -If an id conflict is not resolved, the handshake will fail. -If the application codes e.g. a unique host id, a unique process number, and -a unique sequence number into the session id, uniqueness could easily be -achieved without randomness added (it should however be taken care that -no confidential information is leaked this way). If the application can not -guarantee uniqueness, it is recommended to use the maximum B<id_len> and -fill in the bytes not used to code special information with random data -to avoid collisions. - -SSL_has_matching_session_id() will only query the internal session cache, -not the external one. Since the session id is generated before the -handshake is completed, it is not immediately added to the cache. If -another thread is using the same internal session cache, a race condition -can occur in that another thread generates the same session id. -Collisions can also occur when using an external session cache, since -the external cache is not tested with SSL_has_matching_session_id() -and the same race condition applies. - -When calling SSL_has_matching_session_id() for an SSLv2 session with -reduced B<id_len>, the match operation will be performed using the -fixed length required and with a 0x00 padded id. - -The callback must return 0 if it cannot generate a session id for whatever -reason and return 1 on success. - -=head1 EXAMPLES - -The callback function listed will generate a session id with the -server id given, and will fill the rest with pseudo random bytes: - - const char session_id_prefix = "www-18"; - - #define MAX_SESSION_ID_ATTEMPTS 10 - static int generate_session_id(const SSL *ssl, unsigned char *id, - unsigned int *id_len) - { - unsigned int count = 0; - const char *version; - - version = SSL_get_version(ssl); - if (!strcmp(version, "SSLv2")) - /* we must not change id_len */; - - do { - RAND_pseudo_bytes(id, *id_len); - /* Prefix the session_id with the required prefix. NB: If our - * prefix is too long, clip it - but there will be worse effects - * anyway, eg. the server could only possibly create 1 session - * ID (ie. the prefix!) so all future session negotiations will - * fail due to conflicts. */ - memcpy(id, session_id_prefix, - (strlen(session_id_prefix) < *id_len) ? - strlen(session_id_prefix) : *id_len); - } - while(SSL_has_matching_session_id(ssl, id, *id_len) && - (++count < MAX_SESSION_ID_ATTEMPTS)); - if(count >= MAX_SESSION_ID_ATTEMPTS) - return 0; - return 1; - } - - -=head1 RETURN VALUES - -SSL_CTX_set_generate_session_id() and SSL_set_generate_session_id() -always return 1. - -SSL_has_matching_session_id() returns 1 if another session with the -same id is already in the cache. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_version(3)|SSL_get_version(3)> - -=head1 HISTORY - -SSL_CTX_set_generate_session_id(), SSL_set_generate_session_id() -and SSL_has_matching_session_id() have been introduced in -OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_info_callback.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_info_callback.pod deleted file mode 100644 index 0b4affd5e..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_info_callback.pod +++ /dev/null @@ -1,153 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL_get_info_callback - handle information callback for SSL connections - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback)()); - void (*SSL_CTX_get_info_callback(const SSL_CTX *ctx))(); - - void SSL_set_info_callback(SSL *ssl, void (*callback)()); - void (*SSL_get_info_callback(const SSL *ssl))(); - -=head1 DESCRIPTION - -SSL_CTX_set_info_callback() sets the B<callback> function, that can be used to -obtain state information for SSL objects created from B<ctx> during connection -setup and use. The setting for B<ctx> is overridden from the setting for -a specific SSL object, if specified. -When B<callback> is NULL, not callback function is used. - -SSL_set_info_callback() sets the B<callback> function, that can be used to -obtain state information for B<ssl> during connection setup and use. -When B<callback> is NULL, the callback setting currently valid for -B<ctx> is used. - -SSL_CTX_get_info_callback() returns a pointer to the currently set information -callback function for B<ctx>. - -SSL_get_info_callback() returns a pointer to the currently set information -callback function for B<ssl>. - -=head1 NOTES - -When setting up a connection and during use, it is possible to obtain state -information from the SSL/TLS engine. When set, an information callback function -is called whenever the state changes, an alert appears, or an error occurs. - -The callback function is called as B<callback(SSL *ssl, int where, int ret)>. -The B<where> argument specifies information about where (in which context) -the callback function was called. If B<ret> is 0, an error condition occurred. -If an alert is handled, SSL_CB_ALERT is set and B<ret> specifies the alert -information. - -B<where> is a bitmask made up of the following bits: - -=over 4 - -=item SSL_CB_LOOP - -Callback has been called to indicate state change inside a loop. - -=item SSL_CB_EXIT - -Callback has been called to indicate error exit of a handshake function. -(May be soft error with retry option for non-blocking setups.) - -=item SSL_CB_READ - -Callback has been called during read operation. - -=item SSL_CB_WRITE - -Callback has been called during write operation. - -=item SSL_CB_ALERT - -Callback has been called due to an alert being sent or received. - -=item SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) - -=item SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) - -=item SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) - -=item SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) - -=item SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) - -=item SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) - -=item SSL_CB_HANDSHAKE_START - -Callback has been called because a new handshake is started. - -=item SSL_CB_HANDSHAKE_DONE 0x20 - -Callback has been called because a handshake is finished. - -=back - -The current state information can be obtained using the -L<SSL_state_string(3)|SSL_state_string(3)> family of functions. - -The B<ret> information can be evaluated using the -L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> family of functions. - -=head1 RETURN VALUES - -SSL_set_info_callback() does not provide diagnostic information. - -SSL_get_info_callback() returns the current setting. - -=head1 EXAMPLES - -The following example callback function prints state strings, information -about alerts being handled and error messages to the B<bio_err> BIO. - - void apps_ssl_info_callback(SSL *s, int where, int ret) - { - const char *str; - int w; - - w=where& ~SSL_ST_MASK; - - if (w & SSL_ST_CONNECT) str="SSL_connect"; - else if (w & SSL_ST_ACCEPT) str="SSL_accept"; - else str="undefined"; - - if (where & SSL_CB_LOOP) - { - BIO_printf(bio_err,"%s:%s\n",str,SSL_state_string_long(s)); - } - else if (where & SSL_CB_ALERT) - { - str=(where & SSL_CB_READ)?"read":"write"; - BIO_printf(bio_err,"SSL3 alert %s:%s:%s\n", - str, - SSL_alert_type_string_long(ret), - SSL_alert_desc_string_long(ret)); - } - else if (where & SSL_CB_EXIT) - { - if (ret == 0) - BIO_printf(bio_err,"%s:failed in %s\n", - str,SSL_state_string_long(s)); - else if (ret < 0) - { - BIO_printf(bio_err,"%s:error in %s\n", - str,SSL_state_string_long(s)); - } - } - } - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_state_string(3)|SSL_state_string(3)>, -L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_max_cert_list.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_max_cert_list.pod deleted file mode 100644 index da68cb9fc..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_max_cert_list.pod +++ /dev/null @@ -1,77 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, SSL_get_max_cert_list, - manipulate allowed for the peer's certificate chain - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size); - long SSL_CTX_get_max_cert_list(SSL_CTX *ctx); - - long SSL_set_max_cert_list(SSL *ssl, long size); - long SSL_get_max_cert_list(SSL *ctx); - -=head1 DESCRIPTION - -SSL_CTX_set_max_cert_list() sets the maximum size allowed for the peer's -certificate chain for all SSL objects created from B<ctx> to be <size> bytes. -The SSL objects inherit the setting valid for B<ctx> at the time -L<SSL_new(3)|SSL_new(3)> is being called. - -SSL_CTX_get_max_cert_list() returns the currently set maximum size for B<ctx>. - -SSL_set_max_cert_list() sets the maximum size allowed for the peer's -certificate chain for B<ssl> to be <size> bytes. This setting stays valid -until a new value is set. - -SSL_get_max_cert_list() returns the currently set maximum size for B<ssl>. - -=head1 NOTES - -During the handshake process, the peer may send a certificate chain. -The TLS/SSL standard does not give any maximum size of the certificate chain. -The OpenSSL library handles incoming data by a dynamically allocated buffer. -In order to prevent this buffer from growing without bounds due to data -received from a faulty or malicious peer, a maximum size for the certificate -chain is set. - -The default value for the maximum certificate chain size is 100kB (30kB -on the 16bit DOS platform). This should be sufficient for usual certificate -chains (OpenSSL's default maximum chain length is 10, see -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, and certificates -without special extensions have a typical size of 1-2kB). - -For special applications it can be necessary to extend the maximum certificate -chain size allowed to be sent by the peer, see e.g. the work on -"Internet X.509 Public Key Infrastructure Proxy Certificate Profile" -and "TLS Delegation Protocol" at http://www.ietf.org/ and -http://www.globus.org/ . - -Under normal conditions it should never be necessary to set a value smaller -than the default, as the buffer is handled dynamically and only uses the -memory actually required by the data sent by the peer. - -If the maximum certificate chain size allowed is exceeded, the handshake will -fail with a SSL_R_EXCESSIVE_MESSAGE_SIZE error. - -=head1 RETURN VALUES - -SSL_CTX_set_max_cert_list() and SSL_set_max_cert_list() return the previously -set value. - -SSL_CTX_get_max_cert_list() and SSL_get_max_cert_list() return the currently -set value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> - -=head1 HISTORY - -SSL*_set/get_max_cert_list() have been introduced in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_mode.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_mode.pod deleted file mode 100644 index 9822544e5..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_mode.pod +++ /dev/null @@ -1,81 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_mode, SSL_set_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_set_mode(SSL_CTX *ctx, long mode); - long SSL_set_mode(SSL *ssl, long mode); - - long SSL_CTX_get_mode(SSL_CTX *ctx); - long SSL_get_mode(SSL *ssl); - -=head1 DESCRIPTION - -SSL_CTX_set_mode() adds the mode set via bitmask in B<mode> to B<ctx>. -Options already set before are not cleared. - -SSL_set_mode() adds the mode set via bitmask in B<mode> to B<ssl>. -Options already set before are not cleared. - -SSL_CTX_get_mode() returns the mode set for B<ctx>. - -SSL_get_mode() returns the mode set for B<ssl>. - -=head1 NOTES - -The following mode changes are available: - -=over 4 - -=item SSL_MODE_ENABLE_PARTIAL_WRITE - -Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success -when just a single record has been written). When not set (the default), -SSL_write() will only report success once the complete chunk was written. -Once SSL_write() returns with r, r bytes have been successfully written -and the next call to SSL_write() must only send the n-r bytes left, -imitating the behaviour of write(). - -=item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER - -Make it possible to retry SSL_write() with changed buffer location -(the buffer contents must stay the same). This is not the default to avoid -the misconception that non-blocking SSL_write() behaves like -non-blocking write(). - -=item SSL_MODE_AUTO_RETRY - -Never bother the application with retries if the transport is blocking. -If a renegotiation take place during normal operation, a -L<SSL_read(3)|SSL_read(3)> or L<SSL_write(3)|SSL_write(3)> would return -with -1 and indicate the need to retry with SSL_ERROR_WANT_READ. -In a non-blocking environment applications must be prepared to handle -incomplete read/write operations. -In a blocking environment, applications are not always prepared to -deal with read/write operations returning without success report. The -flag SSL_MODE_AUTO_RETRY will cause read/write operations to only -return after the handshake and successful completion. - -=back - -=head1 RETURN VALUES - -SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask -after adding B<mode>. - -SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_read(3)|SSL_read(3)>, L<SSL_write(3)|SSL_write(3)> - -=head1 HISTORY - -SSL_MODE_AUTO_RETRY as been added in OpenSSL 0.9.6. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod deleted file mode 100644 index 0015e6ea7..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod +++ /dev/null @@ -1,99 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SSL_get_msg_callback_arg - install callback for observing protocol messages - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); - void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); - - void SSL_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); - void SSL_set_msg_callback_arg(SSL_CTX *ctx, void *arg); - -=head1 DESCRIPTION - -SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to -define a message callback function I<cb> for observing all SSL/TLS -protocol messages (such as handshake messages) that are received or -sent. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg() -can be used to set argument I<arg> to the callback function, which is -available for arbitrary application use. - -SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify -default settings that will be copied to new B<SSL> objects by -L<SSL_new(3)|SSL_new(3)>. SSL_set_msg_callback() and -SSL_set_msg_callback_arg() modify the actual settings of an B<SSL> -object. Using a B<0> pointer for I<cb> disables the message callback. - -When I<cb> is called by the SSL/TLS library for a protocol message, -the function arguments have the following meaning: - -=over 4 - -=item I<write_p> - -This flag is B<0> when a protocol message has been received and B<1> -when a protocol message has been sent. - -=item I<version> - -The protocol version according to which the protocol message is -interpreted by the library. Currently, this is one of -B<SSL2_VERSION>, B<SSL3_VERSION> and B<TLS1_VERSION> (for SSL 2.0, SSL -3.0 and TLS 1.0, respectively). - -=item I<content_type> - -In the case of SSL 2.0, this is always B<0>. In the case of SSL 3.0 -or TLS 1.0, this is one of the B<ContentType> values defined in the -protocol specification (B<change_cipher_spec(20)>, B<alert(21)>, -B<handshake(22)>; but never B<application_data(23)> because the -callback will only be called for protocol messages). - -=item I<buf>, I<len> - -I<buf> points to a buffer containing the protocol message, which -consists of I<len> bytes. The buffer is no longer valid after the -callback function has returned. - -=item I<ssl> - -The B<SSL> object that received or sent the message. - -=item I<arg> - -The user-defined argument optionally defined by -SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg(). - -=back - -=head1 NOTES - -Protocol messages are passed to the callback function after decryption -and fragment collection where applicable. (Thus record boundaries are -not visible.) - -If processing a received protocol message results in an error, -the callback function may not be called. For example, the callback -function will never see messages that are considered too large to be -processed. - -Due to automatic protocol version negotiation, I<version> is not -necessarily the protocol version used by the sender of the message: If -a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, -I<version> will be B<SSL3_VERSION>. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> - -=head1 HISTORY - -SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(), -SSL_set_msg_callback() and SSL_get_msg_callback_arg() were added in OpenSSL 0.9.7. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_options.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_options.pod deleted file mode 100644 index eaed19080..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_options.pod +++ /dev/null @@ -1,244 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_options, SSL_set_options, SSL_CTX_get_options, SSL_get_options - manipulate SSL engine options - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_set_options(SSL_CTX *ctx, long options); - long SSL_set_options(SSL *ssl, long options); - - long SSL_CTX_get_options(SSL_CTX *ctx); - long SSL_get_options(SSL *ssl); - -=head1 DESCRIPTION - -SSL_CTX_set_options() adds the options set via bitmask in B<options> to B<ctx>. -Options already set before are not cleared! - -SSL_set_options() adds the options set via bitmask in B<options> to B<ssl>. -Options already set before are not cleared! - -SSL_CTX_get_options() returns the options set for B<ctx>. - -SSL_get_options() returns the options set for B<ssl>. - -=head1 NOTES - -The behaviour of the SSL library can be changed by setting several options. -The options are coded as bitmasks and can be combined by a logical B<or> -operation (|). Options can only be added but can never be reset. - -SSL_CTX_set_options() and SSL_set_options() affect the (external) -protocol behaviour of the SSL library. The (internal) behaviour of -the API can be changed by using the similar -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> and SSL_set_mode() functions. - -During a handshake, the option settings of the SSL object are used. When -a new SSL object is created from a context using SSL_new(), the current -option setting is copied. Changes to B<ctx> do not affect already created -SSL objects. SSL_clear() does not affect the settings. - -The following B<bug workaround> options are available: - -=over 4 - -=item SSL_OP_MICROSOFT_SESS_ID_BUG - -www.microsoft.com - when talking SSLv2, if session-id reuse is -performed, the session-id passed back in the server-finished message -is different from the one decided upon. - -=item SSL_OP_NETSCAPE_CHALLENGE_BUG - -Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte -challenge but then appears to only use 16 bytes when generating the -encryption keys. Using 16 bytes is ok but it should be ok to use 32. -According to the SSLv3 spec, one should use 32 bytes for the challenge -when operating in SSLv2/v3 compatibility mode, but as mentioned above, -this breaks this server so 16 bytes is the way to go. - -=item SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG - -ssl3.netscape.com:443, first a connection is established with RC4-MD5. -If it is then resumed, we end up using DES-CBC3-SHA. It should be -RC4-MD5 according to 7.6.1.3, 'cipher_suite'. - -Netscape-Enterprise/2.01 (https://merchant.netscape.com) has this bug. -It only really shows up when connecting via SSLv2/v3 then reconnecting -via SSLv3. The cipher list changes.... - -NEW INFORMATION. Try connecting with a cipher list of just -DES-CBC-SHA:RC4-MD5. For some weird reason, each new connection uses -RC4-MD5, but a re-connect tries to use DES-CBC-SHA. So netscape, when -doing a re-connect, always takes the first cipher in the cipher list. - -=item SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG - -... - -=item SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER - -... - -=item SSL_OP_MSIE_SSLV2_RSA_PADDING - -As of OpenSSL 0.9.7h and 0.9.8a, this option has no effect. - -=item SSL_OP_SSLEAY_080_CLIENT_DH_BUG - -... - -=item SSL_OP_TLS_D5_BUG - -... - -=item SSL_OP_TLS_BLOCK_PADDING_BUG - -... - -=item SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS - -Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol -vulnerability affecting CBC ciphers, which cannot be handled by some -broken SSL implementations. This option has no effect for connections -using other ciphers. - -=item SSL_OP_ALL - -All of the above bug workarounds. - -=back - -It is usually safe to use B<SSL_OP_ALL> to enable the bug workaround -options if compatibility with somewhat broken implementations is -desired. - -The following B<modifying> options are available: - -=over 4 - -=item SSL_OP_TLS_ROLLBACK_BUG - -Disable version rollback attack detection. - -During the client key exchange, the client must send the same information -about acceptable SSL/TLS protocol levels as during the first hello. Some -clients violate this rule by adapting to the server's answer. (Example: -the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server -only understands up to SSLv3. In this case the client must still use the -same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect -to the server's answer and violate the version rollback protection.) - -=item SSL_OP_SINGLE_DH_USE - -Always create a new key when using temporary/ephemeral DH parameters -(see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). -This option must be used to prevent small subgroup attacks, when -the DH parameters were not generated using "strong" primes -(e.g. when using DSA-parameters, see L<dhparam(1)|dhparam(1)>). -If "strong" primes were used, it is not strictly necessary to generate -a new DH key during each handshake but it is also recommended. -B<SSL_OP_SINGLE_DH_USE> should therefore be enabled whenever -temporary/ephemeral DH parameters are used. - -=item SSL_OP_EPHEMERAL_RSA - -Always use ephemeral (temporary) RSA key when doing RSA operations -(see L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). -According to the specifications this is only done, when a RSA key -can only be used for signature operations (namely under export ciphers -with restricted RSA keylength). By setting this option, ephemeral -RSA keys are always used. This option breaks compatibility with the -SSL/TLS specifications and may lead to interoperability problems with -clients and should therefore never be used. Ciphers with EDH (ephemeral -Diffie-Hellman) key exchange should be used instead. - -=item SSL_OP_CIPHER_SERVER_PREFERENCE - -When choosing a cipher, use the server's preferences instead of the client -preferences. When not set, the SSL server will always follow the clients -preferences. When set, the SSLv3/TLSv1 server will choose following its -own preferences. Because of the different protocol, for SSLv2 the server -will send its list of preferences to the client and the client chooses. - -=item SSL_OP_PKCS1_CHECK_1 - -... - -=item SSL_OP_PKCS1_CHECK_2 - -... - -=item SSL_OP_NETSCAPE_CA_DN_BUG - -If we accept a netscape connection, demand a client cert, have a -non-self-signed CA which does not have its CA in netscape, and the -browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta - -=item SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG - -... - -=item SSL_OP_NO_SSLv2 - -Do not use the SSLv2 protocol. - -=item SSL_OP_NO_SSLv3 - -Do not use the SSLv3 protocol. - -=item SSL_OP_NO_TLSv1 - -Do not use the TLSv1 protocol. - -=item SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION - -When performing renegotiation as a server, always start a new session -(i.e., session resumption requests are only accepted in the initial -handshake). This option is not needed for clients. - -=item SSL_OP_NO_TICKET - -Normally clients and servers will, where possible, transparently make use -of RFC4507bis tickets for stateless session resumption if extension support -is explicitly set when OpenSSL is compiled. - -If this option is set this functionality is disabled and tickets will -not be used by clients or servers. - -=back - -=head1 RETURN VALUES - -SSL_CTX_set_options() and SSL_set_options() return the new options bitmask -after adding B<options>. - -SSL_CTX_get_options() and SSL_get_options() return the current bitmask. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, -L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, -L<dhparam(1)|dhparam(1)> - -=head1 HISTORY - -B<SSL_OP_CIPHER_SERVER_PREFERENCE> and -B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> have been added in -OpenSSL 0.9.7. - -B<SSL_OP_TLS_ROLLBACK_BUG> has been added in OpenSSL 0.9.6 and was automatically -enabled with B<SSL_OP_ALL>. As of 0.9.7, it is no longer included in B<SSL_OP_ALL> -and must be explicitly set. - -B<SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS> has been added in OpenSSL 0.9.6e. -Versions up to OpenSSL 0.9.6c do not include the countermeasure that -can be disabled with this option (in OpenSSL 0.9.6d, it was always -enabled). - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_quiet_shutdown.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_quiet_shutdown.pod deleted file mode 100644 index 393f8ff0b..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_quiet_shutdown.pod +++ /dev/null @@ -1,63 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, SSL_get_quiet_shutdown - manipulate shutdown behaviour - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); - int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); - - void SSL_set_quiet_shutdown(SSL *ssl, int mode); - int SSL_get_quiet_shutdown(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_CTX_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ctx> to be -B<mode>. SSL objects created from B<ctx> inherit the B<mode> valid at the time -L<SSL_new(3)|SSL_new(3)> is called. B<mode> may be 0 or 1. - -SSL_CTX_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ctx>. - -SSL_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ssl> to be -B<mode>. The setting stays valid until B<ssl> is removed with -L<SSL_free(3)|SSL_free(3)> or SSL_set_quiet_shutdown() is called again. -It is not changed when L<SSL_clear(3)|SSL_clear(3)> is called. -B<mode> may be 0 or 1. - -SSL_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ssl>. - -=head1 NOTES - -Normally when a SSL connection is finished, the parties must send out -"close notify" alert messages using L<SSL_shutdown(3)|SSL_shutdown(3)> -for a clean shutdown. - -When setting the "quiet shutdown" flag to 1, L<SSL_shutdown(3)|SSL_shutdown(3)> -will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN. -(L<SSL_shutdown(3)|SSL_shutdown(3)> then behaves like -L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> called with -SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.) -The session is thus considered to be shutdown, but no "close notify" alert -is sent to the peer. This behaviour violates the TLS standard. - -The default is normal shutdown behaviour as described by the TLS standard. - -=head1 RETURN VALUES - -SSL_CTX_set_quiet_shutdown() and SSL_set_quiet_shutdown() do not return -diagnostic information. - -SSL_CTX_get_quiet_shutdown() and SSL_get_quiet_shutdown return the current -setting. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, -L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, L<SSL_new(3)|SSL_new(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod deleted file mode 100644 index c5d2f43df..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod +++ /dev/null @@ -1,137 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode - enable/disable session caching - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode); - long SSL_CTX_get_session_cache_mode(SSL_CTX ctx); - -=head1 DESCRIPTION - -SSL_CTX_set_session_cache_mode() enables/disables session caching -by setting the operational mode for B<ctx> to <mode>. - -SSL_CTX_get_session_cache_mode() returns the currently used cache mode. - -=head1 NOTES - -The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. -The sessions can be held in memory for each B<ctx>, if more than one -SSL_CTX object is being maintained, the sessions are unique for each SSL_CTX -object. - -In order to reuse a session, a client must send the session's id to the -server. It can only send exactly one id. The server then either -agrees to reuse the session or it starts a full handshake (to create a new -session). - -A server will lookup up the session in its internal session storage. If the -session is not found in internal storage or lookups for the internal storage -have been deactivated (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP), the server will try -the external storage if available. - -Since a client may try to reuse a session intended for use in a different -context, the session id context must be set by the server (see -L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>). - -The following session cache modes and modifiers are available: - -=over 4 - -=item SSL_SESS_CACHE_OFF - -No session caching for client or server takes place. - -=item SSL_SESS_CACHE_CLIENT - -Client sessions are added to the session cache. As there is no reliable way -for the OpenSSL library to know whether a session should be reused or which -session to choose (due to the abstract BIO layer the SSL engine does not -have details about the connection), the application must select the session -to be reused by using the L<SSL_set_session(3)|SSL_set_session(3)> -function. This option is not activated by default. - -=item SSL_SESS_CACHE_SERVER - -Server sessions are added to the session cache. When a client proposes a -session to be reused, the server looks for the corresponding session in (first) -the internal session cache (unless SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), -then (second) in the external cache if available. If the session is found, the -server will try to reuse the session. This is the default. - -=item SSL_SESS_CACHE_BOTH - -Enable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the same time. - -=item SSL_SESS_CACHE_NO_AUTO_CLEAR - -Normally the session cache is checked for expired sessions every -255 connections using the -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> function. Since -this may lead to a delay which cannot be controlled, the automatic -flushing may be disabled and -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> can be called -explicitly by the application. - -=item SSL_SESS_CACHE_NO_INTERNAL_LOOKUP - -By setting this flag, session-resume operations in an SSL/TLS server will not -automatically look up sessions in the internal cache, even if sessions are -automatically stored there. If external session caching callbacks are in use, -this flag guarantees that all lookups are directed to the external cache. -As automatic lookup only applies for SSL/TLS servers, the flag has no effect on -clients. - -=item SSL_SESS_CACHE_NO_INTERNAL_STORE - -Depending on the presence of SSL_SESS_CACHE_CLIENT and/or SSL_SESS_CACHE_SERVER, -sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. -Normally a new session is added to the internal cache as well as any external -session caching (callback) that is configured for the SSL_CTX. This flag will -prevent sessions being stored in the internal cache (though the application can -add them manually using L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>). Note: -in any SSL/TLS servers where external caching is configured, any successful -session lookups in the external cache (ie. for session-resume requests) would -normally be copied into the local cache before processing continues - this flag -prevents these additions to the internal cache as well. - -=item SSL_SESS_CACHE_NO_INTERNAL - -Enable both SSL_SESS_CACHE_NO_INTERNAL_LOOKUP and -SSL_SESS_CACHE_NO_INTERNAL_STORE at the same time. - - -=back - -The default mode is SSL_SESS_CACHE_SERVER. - -=head1 RETURN VALUES - -SSL_CTX_set_session_cache_mode() returns the previously set cache mode. - -SSL_CTX_get_session_cache_mode() returns the currently set cache mode. - - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, -L<SSL_session_reused(3)|SSL_session_reused(3)>, -L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, -L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, -L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, -L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> - -=head1 HISTORY - -SSL_SESS_CACHE_NO_INTERNAL_STORE and SSL_SESS_CACHE_NO_INTERNAL -were introduced in OpenSSL 0.9.6h. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_id_context.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_id_context.pod deleted file mode 100644 index 58fc68550..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_session_id_context.pod +++ /dev/null @@ -1,83 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only) - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -=head1 DESCRIPTION - -SSL_CTX_set_session_id_context() sets the context B<sid_ctx> of length -B<sid_ctx_len> within which a session can be reused for the B<ctx> object. - -SSL_set_session_id_context() sets the context B<sid_ctx> of length -B<sid_ctx_len> within which a session can be reused for the B<ssl> object. - -=head1 NOTES - -Sessions are generated within a certain context. When exporting/importing -sessions with B<i2d_SSL_SESSION>/B<d2i_SSL_SESSION> it would be possible, -to re-import a session generated from another context (e.g. another -application), which might lead to malfunctions. Therefore each application -must set its own session id context B<sid_ctx> which is used to distinguish -the contexts and is stored in exported sessions. The B<sid_ctx> can be -any kind of binary data with a given length, it is therefore possible -to use e.g. the name of the application and/or the hostname and/or service -name ... - -The session id context becomes part of the session. The session id context -is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and -SSL_set_session_id_context() functions are therefore only useful on the -server side. - -OpenSSL clients will check the session id context returned by the server -when reusing a session. - -The maximum length of the B<sid_ctx> is limited to -B<SSL_MAX_SSL_SESSION_ID_LENGTH>. - -=head1 WARNINGS - -If the session id context is not set on an SSL/TLS server and client -certificates are used, stored sessions -will not be reused but a fatal error will be flagged and the handshake -will fail. - -If a server returns a different session id context to an OpenSSL client -when reusing a session, an error will be flagged and the handshake will -fail. OpenSSL servers will always return the correct session id context, -as an OpenSSL server checks the session id context itself before reusing -a session as described above. - -=head1 RETURN VALUES - -SSL_CTX_set_session_id_context() and SSL_set_session_id_context() -return the following values: - -=over 4 - -=item 0 - -The length B<sid_ctx_len> of the session id context B<sid_ctx> exceeded -the maximum allowed length of B<SSL_MAX_SSL_SESSION_ID_LENGTH>. The error -is logged to the error stack. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod deleted file mode 100644 index 002018096..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_get_ssl_method -- choose a new TLS/SSL method - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *method); - int SSL_set_ssl_method(SSL *s, SSL_METHOD *method); - SSL_METHOD *SSL_get_ssl_method(SSL *ssl); - -=head1 DESCRIPTION - -SSL_CTX_set_ssl_version() sets a new default TLS/SSL B<method> for SSL objects -newly created from this B<ctx>. SSL objects already created with -L<SSL_new(3)|SSL_new(3)> are not affected, except when -L<SSL_clear(3)|SSL_clear(3)> is being called. - -SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl> -object. It may be reset, when SSL_clear() is called. - -SSL_get_ssl_method() returns a function pointer to the TLS/SSL method -set in B<ssl>. - -=head1 NOTES - -The available B<method> choices are described in -L<SSL_CTX_new(3)|SSL_CTX_new(3)>. - -When L<SSL_clear(3)|SSL_clear(3)> is called and no session is connected to -an SSL object, the method of the SSL object is reset to the method currently -set in the corresponding SSL_CTX object. - -=head1 RETURN VALUES - -The following return values can occur for SSL_CTX_set_ssl_version() -and SSL_set_ssl_method(): - -=over 4 - -=item 0 - -The new choice failed, check the error stack to find out the reason. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<SSL_new(3)|SSL_new(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<ssl(3)|ssl(3)>, -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_timeout.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_timeout.pod deleted file mode 100644 index e3de27c47..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_timeout.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_timeout, SSL_CTX_get_timeout - manipulate timeout values for session caching - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); - long SSL_CTX_get_timeout(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_set_timeout() sets the timeout for newly created sessions for -B<ctx> to B<t>. The timeout value B<t> must be given in seconds. - -SSL_CTX_get_timeout() returns the currently set timeout value for B<ctx>. - -=head1 NOTES - -Whenever a new session is created, it is assigned a maximum lifetime. This -lifetime is specified by storing the creation time of the session and the -timeout value valid at this time. If the actual time is later than creation -time plus timeout, the session is not reused. - -Due to this realization, all sessions behave according to the timeout value -valid at the time of the session negotiation. Changes of the timeout value -do not affect already established sessions. - -The expiration time of a single session can be modified using the -L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)> family of functions. - -Expired sessions are removed from the internal session cache, whenever -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> is called, either -directly by the application or automatically (see -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) - -The default value for session timeout is decided on a per protocol -basis, see L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>. -All currently supported protocols have the same default timeout value -of 300 seconds. - -=head1 RETURN VALUES - -SSL_CTX_set_timeout() returns the previously set timeout value. - -SSL_CTX_get_timeout() returns the currently set timeout value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, -L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod deleted file mode 100644 index 29d1f8a6f..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod +++ /dev/null @@ -1,170 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh - handle DH keys for ephemeral key exchange - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); - long SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh); - - void SSL_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); - long SSL_set_tmp_dh(SSL *ssl, DH *dh) - - DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); - -=head1 DESCRIPTION - -SSL_CTX_set_tmp_dh_callback() sets the callback function for B<ctx> to be -used when a DH parameters are required to B<tmp_dh_callback>. -The callback is inherited by all B<ssl> objects created from B<ctx>. - -SSL_CTX_set_tmp_dh() sets DH parameters to be used to be B<dh>. -The key is inherited by all B<ssl> objects created from B<ctx>. - -SSL_set_tmp_dh_callback() sets the callback only for B<ssl>. - -SSL_set_tmp_dh() sets the parameters only for B<ssl>. - -These functions apply to SSL/TLS servers only. - -=head1 NOTES - -When using a cipher with RSA authentication, an ephemeral DH key exchange -can take place. Ciphers with DSA keys always use ephemeral DH keys as well. -In these cases, the session data are negotiated using the -ephemeral/temporary DH key and the key supplied and certified -by the certificate chain is only used for signing. -Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. - -Using ephemeral DH key exchange yields forward secrecy, as the connection -can only be decrypted, when the DH key is known. By generating a temporary -DH key inside the server application that is lost when the application -is left, it becomes impossible for an attacker to decrypt past sessions, -even if he gets hold of the normal (certified) key, as this key was -only used for signing. - -In order to perform a DH key exchange the server must use a DH group -(DH parameters) and generate a DH key. The server will always generate a new -DH key during the negotiation, when the DH parameters are supplied via -callback and/or when the SSL_OP_SINGLE_DH_USE option of -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)> is set. It will -immediately create a DH key, when DH parameters are supplied via -SSL_CTX_set_tmp_dh() and SSL_OP_SINGLE_DH_USE is not set. In this case, -it may happen that a key is generated on initialization without later -being needed, while on the other hand the computer time during the -negotiation is being saved. - -If "strong" primes were used to generate the DH parameters, it is not strictly -necessary to generate a new key for each handshake but it does improve forward -secrecy. If it is not assured, that "strong" primes were used (see especially -the section about DSA parameters below), SSL_OP_SINGLE_DH_USE must be used -in order to prevent small subgroup attacks. Always using SSL_OP_SINGLE_DH_USE -has an impact on the computer time needed during negotiation, but it is not -very large, so application authors/users should consider to always enable -this option. - -As generating DH parameters is extremely time consuming, an application -should not generate the parameters on the fly but supply the parameters. -DH parameters can be reused, as the actual key is newly generated during -the negotiation. The risk in reusing DH parameters is that an attacker -may specialize on a very often used DH group. Applications should therefore -generate their own DH parameters during the installation process using the -openssl L<dhparam(1)|dhparam(1)> application. In order to reduce the computer -time needed for this generation, it is possible to use DSA parameters -instead (see L<dhparam(1)|dhparam(1)>), but in this case SSL_OP_SINGLE_DH_USE -is mandatory. - -Application authors may compile in DH parameters. Files dh512.pem, -dh1024.pem, dh2048.pem, and dh4096 in the 'apps' directory of current -version of the OpenSSL distribution contain the 'SKIP' DH parameters, -which use safe primes and were generated verifiably pseudo-randomly. -These files can be converted into C code using the B<-C> option of the -L<dhparam(1)|dhparam(1)> application. -Authors may also generate their own set of parameters using -L<dhparam(1)|dhparam(1)>, but a user may not be sure how the parameters were -generated. The generation of DH parameters during installation is therefore -recommended. - -An application may either directly specify the DH parameters or -can supply the DH parameters via a callback function. The callback approach -has the advantage, that the callback may supply DH parameters for different -key lengths. - -The B<tmp_dh_callback> is called with the B<keylength> needed and -the B<is_export> information. The B<is_export> flag is set, when the -ephemeral DH key exchange is performed with an export cipher. - -=head1 EXAMPLES - -Handle DH parameters for key lengths of 512 and 1024 bits. (Error handling -partly left out.) - - ... - /* Set up ephemeral DH stuff */ - DH *dh_512 = NULL; - DH *dh_1024 = NULL; - FILE *paramfile; - - ... - /* "openssl dhparam -out dh_param_512.pem -2 512" */ - paramfile = fopen("dh_param_512.pem", "r"); - if (paramfile) { - dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); - fclose(paramfile); - } - /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ - paramfile = fopen("dh_param_1024.pem", "r"); - if (paramfile) { - dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); - fclose(paramfile); - } - ... - - /* "openssl dhparam -C -2 512" etc... */ - DH *get_dh512() { ... } - DH *get_dh1024() { ... } - - DH *tmp_dh_callback(SSL *s, int is_export, int keylength) - { - DH *dh_tmp=NULL; - - switch (keylength) { - case 512: - if (!dh_512) - dh_512 = get_dh512(); - dh_tmp = dh_512; - break; - case 1024: - if (!dh_1024) - dh_1024 = get_dh1024(); - dh_tmp = dh_1024; - break; - default: - /* Generating a key on the fly is very costly, so use what is there */ - setup_dh_parameters_like_above(); - } - return(dh_tmp); - } - -=head1 RETURN VALUES - -SSL_CTX_set_tmp_dh_callback() and SSL_set_tmp_dh_callback() do not return -diagnostic output. - -SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do return 1 on success and 0 -on failure. Check the error queue to find out the reason of failure. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, -L<ciphers(1)|ciphers(1)>, L<dhparam(1)|dhparam(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod deleted file mode 100644 index 534643cd9..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod +++ /dev/null @@ -1,166 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_tmp_rsa_callback, SSL_CTX_set_tmp_rsa, SSL_CTX_need_tmp_rsa, SSL_set_tmp_rsa_callback, SSL_set_tmp_rsa, SSL_need_tmp_rsa - handle RSA keys for ephemeral key exchange - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, - RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); - long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa); - long SSL_CTX_need_tmp_rsa(SSL_CTX *ctx); - - void SSL_set_tmp_rsa_callback(SSL_CTX *ctx, - RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); - long SSL_set_tmp_rsa(SSL *ssl, RSA *rsa) - long SSL_need_tmp_rsa(SSL *ssl) - - RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength); - -=head1 DESCRIPTION - -SSL_CTX_set_tmp_rsa_callback() sets the callback function for B<ctx> to be -used when a temporary/ephemeral RSA key is required to B<tmp_rsa_callback>. -The callback is inherited by all SSL objects newly created from B<ctx> -with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. - -SSL_CTX_set_tmp_rsa() sets the temporary/ephemeral RSA key to be used to be -B<rsa>. The key is inherited by all SSL objects newly created from B<ctx> -with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. - -SSL_CTX_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed -for RSA-based strength-limited 'exportable' ciphersuites because a RSA key -with a keysize larger than 512 bits is installed. - -SSL_set_tmp_rsa_callback() sets the callback only for B<ssl>. - -SSL_set_tmp_rsa() sets the key only for B<ssl>. - -SSL_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed, -for RSA-based strength-limited 'exportable' ciphersuites because a RSA key -with a keysize larger than 512 bits is installed. - -These functions apply to SSL/TLS servers only. - -=head1 NOTES - -When using a cipher with RSA authentication, an ephemeral RSA key exchange -can take place. In this case the session data are negotiated using the -ephemeral/temporary RSA key and the RSA key supplied and certified -by the certificate chain is only used for signing. - -Under previous export restrictions, ciphers with RSA keys shorter (512 bits) -than the usual key length of 1024 bits were created. To use these ciphers -with RSA keys of usual length, an ephemeral key exchange must be performed, -as the normal (certified) key cannot be directly used. - -Using ephemeral RSA key exchange yields forward secrecy, as the connection -can only be decrypted, when the RSA key is known. By generating a temporary -RSA key inside the server application that is lost when the application -is left, it becomes impossible for an attacker to decrypt past sessions, -even if he gets hold of the normal (certified) RSA key, as this key was -used for signing only. The downside is that creating a RSA key is -computationally expensive. - -Additionally, the use of ephemeral RSA key exchange is only allowed in -the TLS standard, when the RSA key can be used for signing only, that is -for export ciphers. Using ephemeral RSA key exchange for other purposes -violates the standard and can break interoperability with clients. -It is therefore strongly recommended to not use ephemeral RSA key -exchange and use EDH (Ephemeral Diffie-Hellman) key exchange instead -in order to achieve forward secrecy (see -L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). - -On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default -and must be explicitly enabled using the SSL_OP_EPHEMERAL_RSA option of -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, violating the TLS/SSL -standard. When ephemeral RSA key exchange is required for export ciphers, -it will automatically be used without this option! - -An application may either directly specify the key or can supply the key via -a callback function. The callback approach has the advantage, that the -callback may generate the key only in case it is actually needed. As the -generation of a RSA key is however costly, it will lead to a significant -delay in the handshake procedure. Another advantage of the callback function -is that it can supply keys of different size (e.g. for SSL_OP_EPHEMERAL_RSA -usage) while the explicit setting of the key is only useful for key size of -512 bits to satisfy the export restricted ciphers and does give away key length -if a longer key would be allowed. - -The B<tmp_rsa_callback> is called with the B<keylength> needed and -the B<is_export> information. The B<is_export> flag is set, when the -ephemeral RSA key exchange is performed with an export cipher. - -=head1 EXAMPLES - -Generate temporary RSA keys to prepare ephemeral RSA key exchange. As the -generation of a RSA key costs a lot of computer time, they saved for later -reuse. For demonstration purposes, two keys for 512 bits and 1024 bits -respectively are generated. - - ... - /* Set up ephemeral RSA stuff */ - RSA *rsa_512 = NULL; - RSA *rsa_1024 = NULL; - - rsa_512 = RSA_generate_key(512,RSA_F4,NULL,NULL); - if (rsa_512 == NULL) - evaluate_error_queue(); - - rsa_1024 = RSA_generate_key(1024,RSA_F4,NULL,NULL); - if (rsa_1024 == NULL) - evaluate_error_queue(); - - ... - - RSA *tmp_rsa_callback(SSL *s, int is_export, int keylength) - { - RSA *rsa_tmp=NULL; - - switch (keylength) { - case 512: - if (rsa_512) - rsa_tmp = rsa_512; - else { /* generate on the fly, should not happen in this example */ - rsa_tmp = RSA_generate_key(keylength,RSA_F4,NULL,NULL); - rsa_512 = rsa_tmp; /* Remember for later reuse */ - } - break; - case 1024: - if (rsa_1024) - rsa_tmp=rsa_1024; - else - should_not_happen_in_this_example(); - break; - default: - /* Generating a key on the fly is very costly, so use what is there */ - if (rsa_1024) - rsa_tmp=rsa_1024; - else - rsa_tmp=rsa_512; /* Use at least a shorter key */ - } - return(rsa_tmp); - } - -=head1 RETURN VALUES - -SSL_CTX_set_tmp_rsa_callback() and SSL_set_tmp_rsa_callback() do not return -diagnostic output. - -SSL_CTX_set_tmp_rsa() and SSL_set_tmp_rsa() do return 1 on success and 0 -on failure. Check the error queue to find out the reason of failure. - -SSL_CTX_need_tmp_rsa() and SSL_need_tmp_rsa() return 1 if a temporary -RSA key is needed and 0 otherwise. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, -L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, -L<SSL_new(3)|SSL_new(3)>, L<ciphers(1)|ciphers(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_verify.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_verify.pod deleted file mode 100644 index ca8d81b82..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_set_verify.pod +++ /dev/null @@ -1,294 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_verify, SSL_set_verify, SSL_CTX_set_verify_depth, SSL_set_verify_depth - set peer certificate verification parameters - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, - int (*verify_callback)(int, X509_STORE_CTX *)); - void SSL_set_verify(SSL *s, int mode, - int (*verify_callback)(int, X509_STORE_CTX *)); - void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); - void SSL_set_verify_depth(SSL *s, int depth); - - int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx); - -=head1 DESCRIPTION - -SSL_CTX_set_verify() sets the verification flags for B<ctx> to be B<mode> and -specifies the B<verify_callback> function to be used. If no callback function -shall be specified, the NULL pointer can be used for B<verify_callback>. - -SSL_set_verify() sets the verification flags for B<ssl> to be B<mode> and -specifies the B<verify_callback> function to be used. If no callback function -shall be specified, the NULL pointer can be used for B<verify_callback>. In -this case last B<verify_callback> set specifically for this B<ssl> remains. If -no special B<callback> was set before, the default callback for the underlying -B<ctx> is used, that was valid at the the time B<ssl> was created with -L<SSL_new(3)|SSL_new(3)>. - -SSL_CTX_set_verify_depth() sets the maximum B<depth> for the certificate chain -verification that shall be allowed for B<ctx>. (See the BUGS section.) - -SSL_set_verify_depth() sets the maximum B<depth> for the certificate chain -verification that shall be allowed for B<ssl>. (See the BUGS section.) - -=head1 NOTES - -The verification of certificates can be controlled by a set of logically -or'ed B<mode> flags: - -=over 4 - -=item SSL_VERIFY_NONE - -B<Server mode:> the server will not send a client certificate request to the -client, so the client will not send a certificate. - -B<Client mode:> if not using an anonymous cipher (by default disabled), the -server will send a certificate which will be checked. The result of the -certificate verification process can be checked after the TLS/SSL handshake -using the L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> function. -The handshake will be continued regardless of the verification result. - -=item SSL_VERIFY_PEER - -B<Server mode:> the server sends a client certificate request to the client. -The certificate returned (if any) is checked. If the verification process -fails, the TLS/SSL handshake is -immediately terminated with an alert message containing the reason for -the verification failure. -The behaviour can be controlled by the additional -SSL_VERIFY_FAIL_IF_NO_PEER_CERT and SSL_VERIFY_CLIENT_ONCE flags. - -B<Client mode:> the server certificate is verified. If the verification process -fails, the TLS/SSL handshake is -immediately terminated with an alert message containing the reason for -the verification failure. If no server certificate is sent, because an -anonymous cipher is used, SSL_VERIFY_PEER is ignored. - -=item SSL_VERIFY_FAIL_IF_NO_PEER_CERT - -B<Server mode:> if the client did not return a certificate, the TLS/SSL -handshake is immediately terminated with a "handshake failure" alert. -This flag must be used together with SSL_VERIFY_PEER. - -B<Client mode:> ignored - -=item SSL_VERIFY_CLIENT_ONCE - -B<Server mode:> only request a client certificate on the initial TLS/SSL -handshake. Do not ask for a client certificate again in case of a -renegotiation. This flag must be used together with SSL_VERIFY_PEER. - -B<Client mode:> ignored - -=back - -Exactly one of the B<mode> flags SSL_VERIFY_NONE and SSL_VERIFY_PEER must be -set at any time. - -The actual verification procedure is performed either using the built-in -verification procedure or using another application provided verification -function set with -L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>. -The following descriptions apply in the case of the built-in procedure. An -application provided procedure also has access to the verify depth information -and the verify_callback() function, but the way this information is used -may be different. - -SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set the limit up -to which depth certificates in a chain are used during the verification -procedure. If the certificate chain is longer than allowed, the certificates -above the limit are ignored. Error messages are generated as if these -certificates would not be present, most likely a -X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY will be issued. -The depth count is "level 0:peer certificate", "level 1: CA certificate", -"level 2: higher level CA certificate", and so on. Setting the maximum -depth to 2 allows the levels 0, 1, and 2. The default depth limit is 9, -allowing for the peer certificate and additional 9 CA certificates. - -The B<verify_callback> function is used to control the behaviour when the -SSL_VERIFY_PEER flag is set. It must be supplied by the application and -receives two arguments: B<preverify_ok> indicates, whether the verification of -the certificate in question was passed (preverify_ok=1) or not -(preverify_ok=0). B<x509_ctx> is a pointer to the complete context used -for the certificate chain verification. - -The certificate chain is checked starting with the deepest nesting level -(the root CA certificate) and worked upward to the peer's certificate. -At each level signatures and issuer attributes are checked. Whenever -a verification error is found, the error number is stored in B<x509_ctx> -and B<verify_callback> is called with B<preverify_ok>=0. By applying -X509_CTX_store_* functions B<verify_callback> can locate the certificate -in question and perform additional steps (see EXAMPLES). If no error is -found for a certificate, B<verify_callback> is called with B<preverify_ok>=1 -before advancing to the next level. - -The return value of B<verify_callback> controls the strategy of the further -verification process. If B<verify_callback> returns 0, the verification -process is immediately stopped with "verification failed" state. If -SSL_VERIFY_PEER is set, a verification failure alert is sent to the peer and -the TLS/SSL handshake is terminated. If B<verify_callback> returns 1, -the verification process is continued. If B<verify_callback> always returns -1, the TLS/SSL handshake will not be terminated with respect to verification -failures and the connection will be established. The calling process can -however retrieve the error code of the last verification error using -L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> or by maintaining its -own error storage managed by B<verify_callback>. - -If no B<verify_callback> is specified, the default callback will be used. -Its return value is identical to B<preverify_ok>, so that any verification -failure will lead to a termination of the TLS/SSL handshake with an -alert message, if SSL_VERIFY_PEER is set. - -=head1 BUGS - -In client mode, it is not checked whether the SSL_VERIFY_PEER flag -is set, but whether SSL_VERIFY_NONE is not set. This can lead to -unexpected behaviour, if the SSL_VERIFY_PEER and SSL_VERIFY_NONE are not -used as required (exactly one must be set at any time). - -The certificate verification depth set with SSL[_CTX]_verify_depth() -stops the verification at a certain depth. The error message produced -will be that of an incomplete certificate chain and not -X509_V_ERR_CERT_CHAIN_TOO_LONG as may be expected. - -=head1 RETURN VALUES - -The SSL*_set_verify*() functions do not provide diagnostic information. - -=head1 EXAMPLES - -The following code sequence realizes an example B<verify_callback> function -that will always continue the TLS/SSL handshake regardless of verification -failure, if wished. The callback realizes a verification depth limit with -more informational output. - -All verification errors are printed, informations about the certificate chain -are printed on request. -The example is realized for a server that does allow but not require client -certificates. - -The example makes use of the ex_data technique to store application data -into/retrieve application data from the SSL structure -(see L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, -L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>). - - ... - typedef struct { - int verbose_mode; - int verify_depth; - int always_continue; - } mydata_t; - int mydata_index; - ... - static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) - { - char buf[256]; - X509 *err_cert; - int err, depth; - SSL *ssl; - mydata_t *mydata; - - err_cert = X509_STORE_CTX_get_current_cert(ctx); - err = X509_STORE_CTX_get_error(ctx); - depth = X509_STORE_CTX_get_error_depth(ctx); - - /* - * Retrieve the pointer to the SSL of the connection currently treated - * and the application specific data stored into the SSL object. - */ - ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); - mydata = SSL_get_ex_data(ssl, mydata_index); - - X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256); - - /* - * Catch a too long certificate chain. The depth limit set using - * SSL_CTX_set_verify_depth() is by purpose set to "limit+1" so - * that whenever the "depth>verify_depth" condition is met, we - * have violated the limit and want to log this error condition. - * We must do it here, because the CHAIN_TOO_LONG error would not - * be found explicitly; only errors introduced by cutting off the - * additional certificates would be logged. - */ - if (depth > mydata->verify_depth) { - preverify_ok = 0; - err = X509_V_ERR_CERT_CHAIN_TOO_LONG; - X509_STORE_CTX_set_error(ctx, err); - } - if (!preverify_ok) { - printf("verify error:num=%d:%s:depth=%d:%s\n", err, - X509_verify_cert_error_string(err), depth, buf); - } - else if (mydata->verbose_mode) - { - printf("depth=%d:%s\n", depth, buf); - } - - /* - * At this point, err contains the last verification error. We can use - * it for something special - */ - if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) - { - X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256); - printf("issuer= %s\n", buf); - } - - if (mydata->always_continue) - return 1; - else - return preverify_ok; - } - ... - - mydata_t mydata; - - ... - mydata_index = SSL_get_ex_new_index(0, "mydata index", NULL, NULL, NULL); - - ... - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, - verify_callback); - - /* - * Let the verify_callback catch the verify_depth error so that we get - * an appropriate error in the logfile. - */ - SSL_CTX_set_verify_depth(verify_depth + 1); - - /* - * Set up the SSL specific data into "mydata" and store it into th SSL - * structure. - */ - mydata.verify_depth = verify_depth; ... - SSL_set_ex_data(ssl, mydata_index, &mydata); - - ... - SSL_accept(ssl); /* check of success left out for clarity */ - if (peer = SSL_get_peer_certificate(ssl)) - { - if (SSL_get_verify_result(ssl) == X509_V_OK) - { - /* The client sent a certificate which verified OK */ - } - } - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, -L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, -L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, -L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, -L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, -L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_use_certificate.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_use_certificate.pod deleted file mode 100644 index 10be95fdb..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_CTX_use_certificate.pod +++ /dev/null @@ -1,169 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_use_certificate, SSL_CTX_use_certificate_ASN1, SSL_CTX_use_certificate_file, SSL_use_certificate, SSL_use_certificate_ASN1, SSL_use_certificate_file, SSL_CTX_use_certificate_chain_file, SSL_CTX_use_PrivateKey, SSL_CTX_use_PrivateKey_ASN1, SSL_CTX_use_PrivateKey_file, SSL_CTX_use_RSAPrivateKey, SSL_CTX_use_RSAPrivateKey_ASN1, SSL_CTX_use_RSAPrivateKey_file, SSL_use_PrivateKey_file, SSL_use_PrivateKey_ASN1, SSL_use_PrivateKey, SSL_use_RSAPrivateKey, SSL_use_RSAPrivateKey_ASN1, SSL_use_RSAPrivateKey_file, SSL_CTX_check_private_key, SSL_check_private_key - load certificate and key data - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); - int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); - int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); - int SSL_use_certificate(SSL *ssl, X509 *x); - int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len); - int SSL_use_certificate_file(SSL *ssl, const char *file, int type); - - int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); - - int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); - int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, unsigned char *d, - long len); - int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); - int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); - int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len); - int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); - int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); - int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, unsigned char *d, long len); - int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); - int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); - int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); - int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); - - int SSL_CTX_check_private_key(const SSL_CTX *ctx); - int SSL_check_private_key(const SSL *ssl); - -=head1 DESCRIPTION - -These functions load the certificates and private keys into the SSL_CTX -or SSL object, respectively. - -The SSL_CTX_* class of functions loads the certificates and keys into the -SSL_CTX object B<ctx>. The information is passed to SSL objects B<ssl> -created from B<ctx> with L<SSL_new(3)|SSL_new(3)> by copying, so that -changes applied to B<ctx> do not propagate to already existing SSL objects. - -The SSL_* class of functions only loads certificates and keys into a -specific SSL object. The specific information is kept, when -L<SSL_clear(3)|SSL_clear(3)> is called for this SSL object. - -SSL_CTX_use_certificate() loads the certificate B<x> into B<ctx>, -SSL_use_certificate() loads B<x> into B<ssl>. The rest of the -certificates needed to form the complete certificate chain can be -specified using the -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> -function. - -SSL_CTX_use_certificate_ASN1() loads the ASN1 encoded certificate from -the memory location B<d> (with length B<len>) into B<ctx>, -SSL_use_certificate_ASN1() loads the ASN1 encoded certificate into B<ssl>. - -SSL_CTX_use_certificate_file() loads the first certificate stored in B<file> -into B<ctx>. The formatting B<type> of the certificate must be specified -from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. -SSL_use_certificate_file() loads the certificate from B<file> into B<ssl>. -See the NOTES section on why SSL_CTX_use_certificate_chain_file() -should be preferred. - -SSL_CTX_use_certificate_chain_file() loads a certificate chain from -B<file> into B<ctx>. The certificates must be in PEM format and must -be sorted starting with the subject's certificate (actual client or server -certificate), followed by intermediate CA certificates if applicable, and -ending at the highest level (root) CA. -There is no corresponding function working on a single SSL object. - -SSL_CTX_use_PrivateKey() adds B<pkey> as private key to B<ctx>. -SSL_CTX_use_RSAPrivateKey() adds the private key B<rsa> of type RSA -to B<ctx>. SSL_use_PrivateKey() adds B<pkey> as private key to B<ssl>; -SSL_use_RSAPrivateKey() adds B<rsa> as private key of type RSA to B<ssl>. -If a certificate has already been set and the private does not belong -to the certificate an error is returned. To change a certificate, private -key pair the new certificate needs to be set with SSL_use_certificate() -or SSL_CTX_use_certificate() before setting the private key with -SSL_CTX_use_PrivateKey() or SSL_use_PrivateKey(). - - -SSL_CTX_use_PrivateKey_ASN1() adds the private key of type B<pk> -stored at memory location B<d> (length B<len>) to B<ctx>. -SSL_CTX_use_RSAPrivateKey_ASN1() adds the private key of type RSA -stored at memory location B<d> (length B<len>) to B<ctx>. -SSL_use_PrivateKey_ASN1() and SSL_use_RSAPrivateKey_ASN1() add the private -key to B<ssl>. - -SSL_CTX_use_PrivateKey_file() adds the first private key found in -B<file> to B<ctx>. The formatting B<type> of the certificate must be specified -from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. -SSL_CTX_use_RSAPrivateKey_file() adds the first private RSA key found in -B<file> to B<ctx>. SSL_use_PrivateKey_file() adds the first private key found -in B<file> to B<ssl>; SSL_use_RSAPrivateKey_file() adds the first private -RSA key found to B<ssl>. - -SSL_CTX_check_private_key() checks the consistency of a private key with -the corresponding certificate loaded into B<ctx>. If more than one -key/certificate pair (RSA/DSA) is installed, the last item installed will -be checked. If e.g. the last item was a RSA certificate or key, the RSA -key/certificate pair will be checked. SSL_check_private_key() performs -the same check for B<ssl>. If no key/certificate was explicitly added for -this B<ssl>, the last item added into B<ctx> will be checked. - -=head1 NOTES - -The internal certificate store of OpenSSL can hold two private key/certificate -pairs at a time: one key/certificate of type RSA and one key/certificate -of type DSA. The certificate used depends on the cipher select, see -also L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>. - -When reading certificates and private keys from file, files of type -SSL_FILETYPE_ASN1 (also known as B<DER>, binary encoding) can only contain -one certificate or private key, consequently -SSL_CTX_use_certificate_chain_file() is only applicable to PEM formatting. -Files of type SSL_FILETYPE_PEM can contain more than one item. - -SSL_CTX_use_certificate_chain_file() adds the first certificate found -in the file to the certificate store. The other certificates are added -to the store of chain certificates using -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>. -There exists only one extra chain store, so that the same chain is appended -to both types of certificates, RSA and DSA! If it is not intended to use -both type of certificate at the same time, it is recommended to use the -SSL_CTX_use_certificate_chain_file() instead of the -SSL_CTX_use_certificate_file() function in order to allow the use of -complete certificate chains even when no trusted CA storage is used or -when the CA issuing the certificate shall not be added to the trusted -CA storage. - -If additional certificates are needed to complete the chain during the -TLS negotiation, CA certificates are additionally looked up in the -locations of trusted CA certificates, see -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. - -The private keys loaded from file can be encrypted. In order to successfully -load encrypted keys, a function returning the passphrase must have been -supplied, see -L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>. -(Certificate files might be encrypted as well from the technical point -of view, it however does not make sense as the data in the certificate -is considered public anyway.) - -=head1 RETURN VALUES - -On success, the functions return 1. -Otherwise check out the error stack to find out the reason. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, -L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, -L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> - -=head1 HISTORY - -Support for DER encoded private keys (SSL_FILETYPE_ASN1) in -SSL_CTX_use_PrivateKey_file() and SSL_use_PrivateKey_file() was added -in 0.9.8 . - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_free.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_free.pod deleted file mode 100644 index 558de01df..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_free.pod +++ /dev/null @@ -1,55 +0,0 @@ -=pod - -=head1 NAME - -SSL_SESSION_free - free an allocated SSL_SESSION structure - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_SESSION_free(SSL_SESSION *session); - -=head1 DESCRIPTION - -SSL_SESSION_free() decrements the reference count of B<session> and removes -the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated -memory, if the the reference count has reached 0. - -=head1 NOTES - -SSL_SESSION objects are allocated, when a TLS/SSL handshake operation -is successfully completed. Depending on the settings, see -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -the SSL_SESSION objects are internally referenced by the SSL_CTX and -linked into its session cache. SSL objects may be using the SSL_SESSION object; -as a session may be reused, several SSL objects may be using one SSL_SESSION -object at the same time. It is therefore crucial to keep the reference -count (usage information) correct and not delete a SSL_SESSION object -that is still used, as this may lead to program failures due to -dangling pointers. These failures may also appear delayed, e.g. -when an SSL_SESSION object was completely freed as the reference count -incorrectly became 0, but it is still referenced in the internal -session cache and the cache list is processed during a -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> operation. - -SSL_SESSION_free() must only be called for SSL_SESSION objects, for -which the reference count was explicitly incremented (e.g. -by calling SSL_get1_session(), see L<SSL_get_session(3)|SSL_get_session(3)>) -or when the SSL_SESSION object was generated outside a TLS handshake -operation, e.g. by using L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>. -It must not be called on other SSL_SESSION objects, as this would cause -incorrect reference counts and therefore program failures. - -=head1 RETURN VALUES - -SSL_SESSION_free() does not provide diagnostic information. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, - L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_ex_new_index.pod deleted file mode 100644 index 657cda931..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_ex_new_index.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data - internal application specific data functions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_SESSION_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg); - - void *SSL_SESSION_get_ex_data(const SSL_SESSION *session, int idx); - - typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); - -=head1 DESCRIPTION - -Several OpenSSL structures can have application specific data attached to them. -These functions are used internally by OpenSSL to manipulate application -specific data attached to a specific structure. - -SSL_SESSION_get_ex_new_index() is used to register a new index for application -specific data. - -SSL_SESSION_set_ex_data() is used to store application data at B<arg> for B<idx> -into the B<session> object. - -SSL_SESSION_get_ex_data() is used to retrieve the information for B<idx> from -B<session>. - -A detailed description for the B<*_get_ex_new_index()> functionality -can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. -The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. - -=head1 WARNINGS - -The application data is only maintained for sessions held in memory. The -application data is not included when dumping the session with -i2d_SSL_SESSION() (and all functions indirectly calling the dump functions -like PEM_write_SSL_SESSION() and PEM_write_bio_SSL_SESSION()) and can -therefore not be restored. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_time.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_time.pod deleted file mode 100644 index 490337a32..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_SESSION_get_time.pod +++ /dev/null @@ -1,64 +0,0 @@ -=pod - -=head1 NAME - -SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, SSL_SESSION_set_timeout - retrieve and manipulate session time and timeout settings - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_SESSION_get_time(const SSL_SESSION *s); - long SSL_SESSION_set_time(SSL_SESSION *s, long tm); - long SSL_SESSION_get_timeout(const SSL_SESSION *s); - long SSL_SESSION_set_timeout(SSL_SESSION *s, long tm); - - long SSL_get_time(const SSL_SESSION *s); - long SSL_set_time(SSL_SESSION *s, long tm); - long SSL_get_timeout(const SSL_SESSION *s); - long SSL_set_timeout(SSL_SESSION *s, long tm); - -=head1 DESCRIPTION - -SSL_SESSION_get_time() returns the time at which the session B<s> was -established. The time is given in seconds since the Epoch and therefore -compatible to the time delivered by the time() call. - -SSL_SESSION_set_time() replaces the creation time of the session B<s> with -the chosen value B<tm>. - -SSL_SESSION_get_timeout() returns the timeout value set for session B<s> -in seconds. - -SSL_SESSION_set_timeout() sets the timeout value for session B<s> in seconds -to B<tm>. - -The SSL_get_time(), SSL_set_time(), SSL_get_timeout(), and SSL_set_timeout() -functions are synonyms for the SSL_SESSION_*() counterparts. - -=head1 NOTES - -Sessions are expired by examining the creation time and the timeout value. -Both are set at creation time of the session to the actual time and the -default timeout value at creation, respectively, as set by -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>. -Using these functions it is possible to extend or shorten the lifetime -of the session. - -=head1 RETURN VALUES - -SSL_SESSION_get_time() and SSL_SESSION_get_timeout() return the currently -valid values. - -SSL_SESSION_set_time() and SSL_SESSION_set_timeout() return 1 on success. - -If any of the function is passed the NULL pointer for the session B<s>, -0 is returned. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, -L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_accept.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_accept.pod deleted file mode 100644 index cc724c0d5..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_accept.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_accept(SSL *ssl); - -=head1 DESCRIPTION - -SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. -The communication channel must already have been set and assigned to the -B<ssl> by setting an underlying B<BIO>. - -=head1 NOTES - -The behaviour of SSL_accept() depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_accept() will only return once the -handshake has been finished or an error occurred, except for SGC (Server -Gated Cryptography). For SGC, SSL_accept() may return with -1, but -SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept() -should be called again. - -If the underlying BIO is B<non-blocking>, SSL_accept() will also return -when the underlying BIO could not satisfy the needs of SSL_accept() -to continue the handshake, indicating the problem by the return value -1. -In this case a call to SSL_get_error() with the -return value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_accept(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been -established. - -=item 0 - -The TLS/SSL handshake was not successful but was shut down controlled and -by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=item E<lt>0 - -The TLS/SSL handshake was not successful because a fatal error occurred either -at the protocol level or a connection failure occurred. The shutdown was -not clean. It can also occur of action is need to continue the operation -for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, -L<SSL_do_handshake(3)|SSL_do_handshake(3)>, -L<SSL_CTX_new(3)|SSL_CTX_new(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_alert_type_string.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_alert_type_string.pod deleted file mode 100644 index 94e28cc30..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_alert_type_string.pod +++ /dev/null @@ -1,228 +0,0 @@ -=pod - -=head1 NAME - -SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, SSL_alert_desc_string_long - get textual description of alert information - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_alert_type_string(int value); - const char *SSL_alert_type_string_long(int value); - - const char *SSL_alert_desc_string(int value); - const char *SSL_alert_desc_string_long(int value); - -=head1 DESCRIPTION - -SSL_alert_type_string() returns a one letter string indicating the -type of the alert specified by B<value>. - -SSL_alert_type_string_long() returns a string indicating the type of the alert -specified by B<value>. - -SSL_alert_desc_string() returns a two letter string as a short form -describing the reason of the alert specified by B<value>. - -SSL_alert_desc_string_long() returns a string describing the reason -of the alert specified by B<value>. - -=head1 NOTES - -When one side of an SSL/TLS communication wants to inform the peer about -a special situation, it sends an alert. The alert is sent as a special message -and does not influence the normal data stream (unless its contents results -in the communication being canceled). - -A warning alert is sent, when a non-fatal error condition occurs. The -"close notify" alert is sent as a warning alert. Other examples for -non-fatal errors are certificate errors ("certificate expired", -"unsupported certificate"), for which a warning alert may be sent. -(The sending party may however decide to send a fatal error.) The -receiving side may cancel the connection on reception of a warning -alert on it discretion. - -Several alert messages must be sent as fatal alert messages as specified -by the TLS RFC. A fatal alert always leads to a connection abort. - -=head1 RETURN VALUES - -The following strings can occur for SSL_alert_type_string() or -SSL_alert_type_string_long(): - -=over 4 - -=item "W"/"warning" - -=item "F"/"fatal" - -=item "U"/"unknown" - -This indicates that no support is available for this alert type. -Probably B<value> does not contain a correct alert message. - -=back - -The following strings can occur for SSL_alert_desc_string() or -SSL_alert_desc_string_long(): - -=over 4 - -=item "CN"/"close notify" - -The connection shall be closed. This is a warning alert. - -=item "UM"/"unexpected message" - -An inappropriate message was received. This alert is always fatal -and should never be observed in communication between proper -implementations. - -=item "BM"/"bad record mac" - -This alert is returned if a record is received with an incorrect -MAC. This message is always fatal. - -=item "DF"/"decompression failure" - -The decompression function received improper input (e.g. data -that would expand to excessive length). This message is always -fatal. - -=item "HF"/"handshake failure" - -Reception of a handshake_failure alert message indicates that the -sender was unable to negotiate an acceptable set of security -parameters given the options available. This is a fatal error. - -=item "NC"/"no certificate" - -A client, that was asked to send a certificate, does not send a certificate -(SSLv3 only). - -=item "BC"/"bad certificate" - -A certificate was corrupt, contained signatures that did not -verify correctly, etc - -=item "UC"/"unsupported certificate" - -A certificate was of an unsupported type. - -=item "CR"/"certificate revoked" - -A certificate was revoked by its signer. - -=item "CE"/"certificate expired" - -A certificate has expired or is not currently valid. - -=item "CU"/"certificate unknown" - -Some other (unspecified) issue arose in processing the -certificate, rendering it unacceptable. - -=item "IP"/"illegal parameter" - -A field in the handshake was out of range or inconsistent with -other fields. This is always fatal. - -=item "DC"/"decryption failed" - -A TLSCiphertext decrypted in an invalid way: either it wasn't an -even multiple of the block length or its padding values, when -checked, weren't correct. This message is always fatal. - -=item "RO"/"record overflow" - -A TLSCiphertext record was received which had a length more than -2^14+2048 bytes, or a record decrypted to a TLSCompressed record -with more than 2^14+1024 bytes. This message is always fatal. - -=item "CA"/"unknown CA" - -A valid certificate chain or partial chain was received, but the -certificate was not accepted because the CA certificate could not -be located or couldn't be matched with a known, trusted CA. This -message is always fatal. - -=item "AD"/"access denied" - -A valid certificate was received, but when access control was -applied, the sender decided not to proceed with negotiation. -This message is always fatal. - -=item "DE"/"decode error" - -A message could not be decoded because some field was out of the -specified range or the length of the message was incorrect. This -message is always fatal. - -=item "CY"/"decrypt error" - -A handshake cryptographic operation failed, including being -unable to correctly verify a signature, decrypt a key exchange, -or validate a finished message. - -=item "ER"/"export restriction" - -A negotiation not in compliance with export restrictions was -detected; for example, attempting to transfer a 1024 bit -ephemeral RSA key for the RSA_EXPORT handshake method. This -message is always fatal. - -=item "PV"/"protocol version" - -The protocol version the client has attempted to negotiate is -recognized, but not supported. (For example, old protocol -versions might be avoided for security reasons). This message is -always fatal. - -=item "IS"/"insufficient security" - -Returned instead of handshake_failure when a negotiation has -failed specifically because the server requires ciphers more -secure than those supported by the client. This message is always -fatal. - -=item "IE"/"internal error" - -An internal error unrelated to the peer or the correctness of the -protocol makes it impossible to continue (such as a memory -allocation failure). This message is always fatal. - -=item "US"/"user canceled" - -This handshake is being canceled for some reason unrelated to a -protocol failure. If the user cancels an operation after the -handshake is complete, just closing the connection by sending a -close_notify is more appropriate. This alert should be followed -by a close_notify. This message is generally a warning. - -=item "NR"/"no renegotiation" - -Sent by the client in response to a hello request or by the -server in response to a client hello after initial handshaking. -Either of these would normally lead to renegotiation; when that -is not appropriate, the recipient should respond with this alert; -at that point, the original requester can decide whether to -proceed with the connection. One case where this would be -appropriate would be where a server has spawned a process to -satisfy a request; the process might receive security parameters -(key length, authentication, etc.) at startup and it might be -difficult to communicate changes to these parameters after that -point. This message is always a warning. - -=item "UK"/"unknown" - -This indicates that no description is available for this alert type. -Probably B<value> does not contain a correct alert message. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_clear.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_clear.pod deleted file mode 100644 index 8e077e31c..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_clear.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -SSL_clear - reset SSL object to allow another connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_clear(SSL *ssl); - -=head1 DESCRIPTION - -Reset B<ssl> to allow another connection. All settings (method, ciphers, -BIOs) are kept. - -=head1 NOTES - -SSL_clear is used to prepare an SSL object for a new connection. While all -settings are kept, a side effect is the handling of the current SSL session. -If a session is still B<open>, it is considered bad and will be removed -from the session cache, as required by RFC2246. A session is considered open, -if L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection -or at least L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was used to -set the SSL_SENT_SHUTDOWN state. - -If a session was closed cleanly, the session object will be kept and all -settings corresponding. This explicitly means, that e.g. the special method -used during the session will be kept for the next handshake. So if the -session was a TLSv1 session, a SSL client object will use a TLSv1 client -method for the next handshake and a SSL server object will use a TLSv1 -server method, even if SSLv23_*_methods were chosen on startup. This -will might lead to connection failures (see L<SSL_new(3)|SSL_new(3)>) -for a description of the method's properties. - -=head1 WARNINGS - -SSL_clear() resets the SSL object to allow for another connection. The -reset operation however keeps several settings of the last sessions -(some of these settings were made automatically during the last -handshake). It only makes sense when opening a new session (or reusing -an old one) with the same peer that shares these settings. -SSL_clear() is not a short form for the sequence -L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>; . - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The SSL_clear() operation could not be performed. Check the error stack to -find out the reason. - -=item 1 - -The SSL_clear() operation was successful. - -=back - -L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_connect.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_connect.pod deleted file mode 100644 index cc56ebb75..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_connect.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_connect(SSL *ssl); - -=head1 DESCRIPTION - -SSL_connect() initiates the TLS/SSL handshake with a server. The communication -channel must already have been set and assigned to the B<ssl> by setting an -underlying B<BIO>. - -=head1 NOTES - -The behaviour of SSL_connect() depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_connect() will only return once the -handshake has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_connect() will also return -when the underlying BIO could not satisfy the needs of SSL_connect() -to continue the handshake, indicating the problem by the return value -1. -In this case a call to SSL_get_error() with the -return value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_connect(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been -established. - -=item 0 - -The TLS/SSL handshake was not successful but was shut down controlled and -by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=item E<lt>0 - -The TLS/SSL handshake was not successful, because a fatal error occurred either -at the protocol level or a connection failure occurred. The shutdown was -not clean. It can also occur of action is need to continue the operation -for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, -L<SSL_do_handshake(3)|SSL_do_handshake(3)>, -L<SSL_CTX_new(3)|SSL_CTX_new(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_do_handshake.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_do_handshake.pod deleted file mode 100644 index 243576451..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_do_handshake.pod +++ /dev/null @@ -1,75 +0,0 @@ -=pod - -=head1 NAME - -SSL_do_handshake - perform a TLS/SSL handshake - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_do_handshake(SSL *ssl); - -=head1 DESCRIPTION - -SSL_do_handshake() will wait for a SSL/TLS handshake to take place. If the -connection is in client mode, the handshake will be started. The handshake -routines may have to be explicitly set in advance using either -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or -L<SSL_set_accept_state(3)|SSL_set_accept_state(3)>. - -=head1 NOTES - -The behaviour of SSL_do_handshake() depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_do_handshake() will only return -once the handshake has been finished or an error occurred, except for SGC -(Server Gated Cryptography). For SGC, SSL_do_handshake() may return with -1, -but SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and -SSL_do_handshake() should be called again. - -If the underlying BIO is B<non-blocking>, SSL_do_handshake() will also return -when the underlying BIO could not satisfy the needs of SSL_do_handshake() -to continue the handshake. In this case a call to SSL_get_error() with the -return value of SSL_do_handshake() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_do_handshake(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been -established. - -=item 0 - -The TLS/SSL handshake was not successful but was shut down controlled and -by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=item E<lt>0 - -The TLS/SSL handshake was not successful because a fatal error occurred either -at the protocol level or a connection failure occurred. The shutdown was -not clean. It can also occur of action is need to continue the operation -for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_free.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_free.pod deleted file mode 100644 index 2d4f8b616..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_free.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -SSL_free - free an allocated SSL structure - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_free(SSL *ssl); - -=head1 DESCRIPTION - -SSL_free() decrements the reference count of B<ssl>, and removes the SSL -structure pointed to by B<ssl> and frees up the allocated memory if the -the reference count has reached 0. - -=head1 NOTES - -SSL_free() also calls the free()ing procedures for indirectly affected items, if -applicable: the buffering BIO, the read and write BIOs, -cipher lists specially created for this B<ssl>, the B<SSL_SESSION>. -Do not explicitly free these indirectly freed up items before or after -calling SSL_free(), as trying to free things twice may lead to program -failure. - -The ssl session has reference counts from two users: the SSL object, for -which the reference count is removed by SSL_free() and the internal -session cache. If the session is considered bad, because -L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection -and L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was not used to set the -SSL_SENT_SHUTDOWN state, the session will also be removed -from the session cache as required by RFC2246. - -=head1 RETURN VALUES - -SSL_free() does not provide diagnostic information. - -L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_SSL_CTX.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_SSL_CTX.pod deleted file mode 100644 index 659c482c7..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_SSL_CTX.pod +++ /dev/null @@ -1,26 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_SSL_CTX() returns a pointer to the SSL_CTX object, from which -B<ssl> was created with L<SSL_new(3)|SSL_new(3)>. - -=head1 RETURN VALUES - -The pointer to the SSL_CTX object is returned. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ciphers.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ciphers.pod deleted file mode 100644 index aecadd913..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ciphers.pod +++ /dev/null @@ -1,42 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl); - const char *SSL_get_cipher_list(const SSL *ssl, int priority); - -=head1 DESCRIPTION - -SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>, -sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL -is returned. - -SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER -listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are -available, or there are less ciphers than B<priority> available, NULL -is returned. - -=head1 NOTES - -The details of the ciphers obtained by SSL_get_ciphers() can be obtained using -the L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> family of functions. - -Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the -sorted list of available ciphers, until NULL is returned. - -=head1 RETURN VALUES - -See DESCRIPTION - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_client_CA_list.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_client_CA_list.pod deleted file mode 100644 index 68181b240..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_client_CA_list.pod +++ /dev/null @@ -1,53 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_client_CA_list, SSL_CTX_get_client_CA_list - get list of client CAs - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); - STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_get_client_CA_list() returns the list of client CAs explicitly set for -B<ctx> using L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>. - -SSL_get_client_CA_list() returns the list of client CAs explicitly -set for B<ssl> using SSL_set_client_CA_list() or B<ssl>'s SSL_CTX object with -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, when in -server mode. In client mode, SSL_get_client_CA_list returns the list of -client CAs sent from the server, if any. - -=head1 RETURN VALUES - -SSL_CTX_set_client_CA_list() and SSL_set_client_CA_list() do not return -diagnostic information. - -SSL_CTX_add_client_CA() and SSL_add_client_CA() have the following return -values: - -=over 4 - -=item STACK_OF(X509_NAMES) - -List of CA names explicitly set (for B<ctx> or in server mode) or send -by the server (client mode). - -=item NULL - -No client CA list was explicitly set (for B<ctx> or in server mode) or -the server did not send a list of CAs (client mode). - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, -L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_current_cipher.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_current_cipher.pod deleted file mode 100644 index e5ab12491..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_current_cipher.pod +++ /dev/null @@ -1,43 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_current_cipher, SSL_get_cipher, SSL_get_cipher_name, -SSL_get_cipher_bits, SSL_get_cipher_version - get SSL_CIPHER of a connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl); - #define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) - #define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) - #define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) - #define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) - -=head1 DESCRIPTION - -SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing -the description of the actually used cipher of a connection established with -the B<ssl> object. - -SSL_get_cipher() and SSL_get_cipher_name() are identical macros to obtain the -name of the currently used cipher. SSL_get_cipher_bits() is a -macro to obtain the number of secret/algorithm bits used and -SSL_get_cipher_version() returns the protocol name. -See L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> for more details. - -=head1 RETURN VALUES - -SSL_get_current_cipher() returns the cipher actually used or NULL, when -no session has been established. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_default_timeout.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_default_timeout.pod deleted file mode 100644 index a648a9b82..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_default_timeout.pod +++ /dev/null @@ -1,41 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_default_timeout - get default session timeout value - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_get_default_timeout(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_default_timeout() returns the default timeout value assigned to -SSL_SESSION objects negotiated for the protocol valid for B<ssl>. - -=head1 NOTES - -Whenever a new session is negotiated, it is assigned a timeout value, -after which it will not be accepted for session reuse. If the timeout -value was not explicitly set using -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, the hardcoded default -timeout for the protocol will be used. - -SSL_get_default_timeout() return this hardcoded value, which is 300 seconds -for all currently supported protocols (SSLv2, SSLv3, and TLSv1). - -=head1 RETURN VALUES - -See description. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, -L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_error.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_error.pod deleted file mode 100644 index 48c6b15db..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_error.pod +++ /dev/null @@ -1,114 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_error - obtain result code for TLS/SSL I/O operation - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_get_error(const SSL *ssl, int ret); - -=head1 DESCRIPTION - -SSL_get_error() returns a result code (suitable for the C "switch" -statement) for a preceding call to SSL_connect(), SSL_accept(), SSL_do_handshake(), -SSL_read(), SSL_peek(), or SSL_write() on B<ssl>. The value returned by -that TLS/SSL I/O function must be passed to SSL_get_error() in parameter -B<ret>. - -In addition to B<ssl> and B<ret>, SSL_get_error() inspects the -current thread's OpenSSL error queue. Thus, SSL_get_error() must be -used in the same thread that performed the TLS/SSL I/O operation, and no -other OpenSSL function calls should appear in between. The current -thread's error queue must be empty before the TLS/SSL I/O operation is -attempted, or SSL_get_error() will not work reliably. - -=head1 RETURN VALUES - -The following return values can currently occur: - -=over 4 - -=item SSL_ERROR_NONE - -The TLS/SSL I/O operation completed. This result code is returned -if and only if B<ret E<gt> 0>. - -=item SSL_ERROR_ZERO_RETURN - -The TLS/SSL connection has been closed. If the protocol version is SSL 3.0 -or TLS 1.0, this result code is returned only if a closure -alert has occurred in the protocol, i.e. if the connection has been -closed cleanly. Note that in this case B<SSL_ERROR_ZERO_RETURN> -does not necessarily indicate that the underlying transport -has been closed. - -=item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE - -The operation did not complete; the same TLS/SSL I/O function should be -called again later. If, by then, the underlying B<BIO> has data -available for reading (if the result code is B<SSL_ERROR_WANT_READ>) -or allows writing data (B<SSL_ERROR_WANT_WRITE>), then some TLS/SSL -protocol progress will take place, i.e. at least part of an TLS/SSL -record will be read or written. Note that the retry may again lead to -a B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE> condition. -There is no fixed upper limit for the number of iterations that -may be necessary until progress becomes visible at application -protocol level. - -For socket B<BIO>s (e.g. when SSL_set_fd() was used), select() or -poll() on the underlying socket can be used to find out when the -TLS/SSL I/O function should be retried. - -Caveat: Any TLS/SSL I/O function can lead to either of -B<SSL_ERROR_WANT_READ> and B<SSL_ERROR_WANT_WRITE>. In particular, -SSL_read() or SSL_peek() may want to write data and SSL_write() may want -to read data. This is mainly because TLS/SSL handshakes may occur at any -time during the protocol (initiated by either the client or the server); -SSL_read(), SSL_peek(), and SSL_write() will handle any pending handshakes. - -=item SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT - -The operation did not complete; the same TLS/SSL I/O function should be -called again later. The underlying BIO was not connected yet to the peer -and the call would block in connect()/accept(). The SSL function should be -called again when the connection is established. These messages can only -appear with a BIO_s_connect() or BIO_s_accept() BIO, respectively. -In order to find out, when the connection has been successfully established, -on many platforms select() or poll() for writing on the socket file descriptor -can be used. - -=item SSL_ERROR_WANT_X509_LOOKUP - -The operation did not complete because an application callback set by -SSL_CTX_set_client_cert_cb() has asked to be called again. -The TLS/SSL I/O function should be called again later. -Details depend on the application. - -=item SSL_ERROR_SYSCALL - -Some I/O error occurred. The OpenSSL error queue may contain more -information on the error. If the error queue is empty -(i.e. ERR_get_error() returns 0), B<ret> can be used to find out more -about the error: If B<ret == 0>, an EOF was observed that violates -the protocol. If B<ret == -1>, the underlying B<BIO> reported an -I/O error (for socket I/O on Unix systems, consult B<errno> for details). - -=item SSL_ERROR_SSL - -A failure in the SSL library occurred, usually a protocol error. The -OpenSSL error queue contains more information on the error. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<err(3)|err(3)> - -=head1 HISTORY - -SSL_get_error() was added in SSLeay 0.8. - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod deleted file mode 100644 index 165c6a5b2..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_ex_data_X509_STORE_CTX_idx - get ex_data index to access SSL structure -from X509_STORE_CTX - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_get_ex_data_X509_STORE_CTX_idx(void); - -=head1 DESCRIPTION - -SSL_get_ex_data_X509_STORE_CTX_idx() returns the index number under which -the pointer to the SSL object is stored into the X509_STORE_CTX object. - -=head1 NOTES - -Whenever a X509_STORE_CTX object is created for the verification of the -peers certificate during a handshake, a pointer to the SSL object is -stored into the X509_STORE_CTX object to identify the connection affected. -To retrieve this pointer the X509_STORE_CTX_get_ex_data() function can -be used with the correct index. This index is globally the same for all -X509_STORE_CTX objects and can be retrieved using -SSL_get_ex_data_X509_STORE_CTX_idx(). The index value is set when -SSL_get_ex_data_X509_STORE_CTX_idx() is first called either by the application -program directly or indirectly during other SSL setup functions or during -the handshake. - -The value depends on other index values defined for X509_STORE_CTX objects -before the SSL index is created. - -=head1 RETURN VALUES - -=over 4 - -=item E<gt>=0 - -The index value to access the pointer. - -=item E<lt>0 - -An error occurred, check the error stack for a detailed error message. - -=back - -=head1 EXAMPLES - -The index returned from SSL_get_ex_data_X509_STORE_CTX_idx() allows to -access the SSL object for the connection to be accessed during the -verify_callback() when checking the peers certificate. Please check -the example in L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_new_index.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_new_index.pod deleted file mode 100644 index 228d23d8c..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_ex_new_index.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data - internal application specific data functions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_get_ex_new_index(long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); - - int SSL_set_ex_data(SSL *ssl, int idx, void *arg); - - void *SSL_get_ex_data(const SSL *ssl, int idx); - - typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); - typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); - -=head1 DESCRIPTION - -Several OpenSSL structures can have application specific data attached to them. -These functions are used internally by OpenSSL to manipulate application -specific data attached to a specific structure. - -SSL_get_ex_new_index() is used to register a new index for application -specific data. - -SSL_set_ex_data() is used to store application data at B<arg> for B<idx> into -the B<ssl> object. - -SSL_get_ex_data() is used to retrieve the information for B<idx> from -B<ssl>. - -A detailed description for the B<*_get_ex_new_index()> functionality -can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. -The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. - -=head1 EXAMPLES - -An example on how to use the functionality is included in the example -verify_callback() in L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, -L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>, -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_fd.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_fd.pod deleted file mode 100644 index 89260b522..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_fd.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_fd - get file descriptor linked to an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_get_fd(const SSL *ssl); - int SSL_get_rfd(const SSL *ssl); - int SSL_get_wfd(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_fd() returns the file descriptor which is linked to B<ssl>. -SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the -read or the write channel, which can be different. If the read and the -write channel are different, SSL_get_fd() will return the file descriptor -of the read channel. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item -1 - -The operation failed, because the underlying BIO is not of the correct type -(suitable for file descriptors). - -=item E<gt>=0 - -The file descriptor linked to B<ssl>. - -=back - -=head1 SEE ALSO - -L<SSL_set_fd(3)|SSL_set_fd(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_cert_chain.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_cert_chain.pod deleted file mode 100644 index 49fb88f86..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_cert_chain.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_peer_cert_chain - get the X509 certificate chain of the peer - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACKOF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_peer_cert_chain() returns a pointer to STACKOF(X509) certificates -forming the certificate chain of the peer. If called on the client side, -the stack also contains the peer's certificate; if called on the server -side, the peer's certificate must be obtained separately using -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. -If the peer did not present a certificate, NULL is returned. - -=head1 NOTES - -The peer certificate chain is not necessarily available after reusing -a session, in which case a NULL pointer is returned. - -The reference count of the STACKOF(X509) object is not incremented. -If the corresponding session is freed, the pointer must not be used -any longer. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No certificate was presented by the peer or no connection was established -or the certificate chain is no longer available when a session is reused. - -=item Pointer to a STACKOF(X509) - -The return value points to the certificate chain presented by the peer. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_certificate.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_certificate.pod deleted file mode 100644 index ef7c8be18..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_peer_certificate.pod +++ /dev/null @@ -1,55 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_peer_certificate - get the X509 certificate of the peer - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - X509 *SSL_get_peer_certificate(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_peer_certificate() returns a pointer to the X509 certificate the -peer presented. If the peer did not present a certificate, NULL is returned. - -=head1 NOTES - -Due to the protocol definition, a TLS/SSL server will always send a -certificate, if present. A client will only send a certificate when -explicitly requested to do so by the server (see -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>). If an anonymous cipher -is used, no certificates are sent. - -That a certificate is returned does not indicate information about the -verification state, use L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> -to check the verification state. - -The reference count of the X509 object is incremented by one, so that it -will not be destroyed when the session containing the peer certificate is -freed. The X509 object must be explicitly freed using X509_free(). - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No certificate was presented by the peer or no connection was established. - -=item Pointer to an X509 certificate - -The return value points to the certificate presented by the peer. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_rbio.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_rbio.pod deleted file mode 100644 index 3d98233ca..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_rbio.pod +++ /dev/null @@ -1,40 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_rbio - get BIO linked to an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - BIO *SSL_get_rbio(SSL *ssl); - BIO *SSL_get_wbio(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the -read or the write channel, which can be different. The reference count -of the BIO is not incremented. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No BIO was connected to the SSL object - -=item Any other pointer - -The BIO linked to B<ssl>. - -=back - -=head1 SEE ALSO - -L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_session.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_session.pod deleted file mode 100644 index 0c41caa92..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_session.pod +++ /dev/null @@ -1,73 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_session - retrieve TLS/SSL session data - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_SESSION *SSL_get_session(const SSL *ssl); - SSL_SESSION *SSL_get0_session(const SSL *ssl); - SSL_SESSION *SSL_get1_session(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_session() returns a pointer to the B<SSL_SESSION> actually used in -B<ssl>. The reference count of the B<SSL_SESSION> is not incremented, so -that the pointer can become invalid by other operations. - -SSL_get0_session() is the same as SSL_get_session(). - -SSL_get1_session() is the same as SSL_get_session(), but the reference -count of the B<SSL_SESSION> is incremented by one. - -=head1 NOTES - -The ssl session contains all information required to re-establish the -connection without a new handshake. - -SSL_get0_session() returns a pointer to the actual session. As the -reference counter is not incremented, the pointer is only valid while -the connection is in use. If L<SSL_clear(3)|SSL_clear(3)> or -L<SSL_free(3)|SSL_free(3)> is called, the session may be removed completely -(if considered bad), and the pointer obtained will become invalid. Even -if the session is valid, it can be removed at any time due to timeout -during L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>. - -If the data is to be kept, SSL_get1_session() will increment the reference -count, so that the session will not be implicitly removed by other operations -but stays in memory. In order to remove the session -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> must be explicitly called once -to decrement the reference count again. - -SSL_SESSION objects keep internal link information about the session cache -list, when being inserted into one SSL_CTX object's session cache. -One SSL_SESSION object, regardless of its reference count, must therefore -only be used with one SSL_CTX object (and the SSL objects created -from this SSL_CTX object). - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -There is no session available in B<ssl>. - -=item Pointer to an SSL - -The return value points to the data of an SSL session. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_free(3)|SSL_free(3)>, -L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_verify_result.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_verify_result.pod deleted file mode 100644 index 55b56a53f..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_verify_result.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_verify_result - get result of peer certificate verification - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_get_verify_result(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_verify_result() returns the result of the verification of the -X509 certificate presented by the peer, if any. - -=head1 NOTES - -SSL_get_verify_result() can only return one error code while the verification -of a certificate can fail because of many reasons at the same time. Only -the last verification error that occurred during the processing is available -from SSL_get_verify_result(). - -The verification result is part of the established session and is restored -when a session is reused. - -=head1 BUGS - -If no peer certificate was presented, the returned result code is -X509_V_OK. This is because no verification error occurred, it does however -not indicate success. SSL_get_verify_result() is only useful in connection -with L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. - -=head1 RETURN VALUES - -The following return values can currently occur: - -=over 4 - -=item X509_V_OK - -The verification succeeded or no peer certificate was presented. - -=item Any other value - -Documented in L<verify(1)|verify(1)>. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_set_verify_result(3)|SSL_set_verify_result(3)>, -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, -L<verify(1)|verify(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_version.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_get_version.pod deleted file mode 100644 index cc271db2c..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_get_version.pod +++ /dev/null @@ -1,46 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_version - get the protocol version of a connection. - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_get_version(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_cipher_version() returns the name of the protocol used for the -connection B<ssl>. - -=head1 RETURN VALUES - -The following strings can occur: - -=over 4 - -=item SSLv2 - -The connection uses the SSLv2 protocol. - -=item SSLv3 - -The connection uses the SSLv3 protocol. - -=item TLSv1 - -The connection uses the TLSv1 protocol. - -=item unknown - -This indicates that no version has been set (no connection established). - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_library_init.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_library_init.pod deleted file mode 100644 index ecf3c4858..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_library_init.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -SSL_library_init, OpenSSL_add_ssl_algorithms, SSLeay_add_ssl_algorithms -- initialize SSL library by registering algorithms - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_library_init(void); - #define OpenSSL_add_ssl_algorithms() SSL_library_init() - #define SSLeay_add_ssl_algorithms() SSL_library_init() - -=head1 DESCRIPTION - -SSL_library_init() registers the available ciphers and digests. - -OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms -for SSL_library_init(). - -=head1 NOTES - -SSL_library_init() must be called before any other action takes place. - -=head1 WARNING - -SSL_library_init() only registers ciphers. Another important initialization -is the seeding of the PRNG (Pseudo Random Number Generator), which has to -be performed separately. - -=head1 EXAMPLES - -A typical TLS/SSL application will start with the library initialization, -will provide readable error messages and will seed the PRNG. - - SSL_load_error_strings(); /* readable error messages */ - SSL_library_init(); /* initialize library */ - actions_to_seed_PRNG(); - -=head1 RETURN VALUES - -SSL_library_init() always returns "1", so it is safe to discard the return -value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>, -L<RAND_add(3)|RAND_add(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_load_client_CA_file.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_load_client_CA_file.pod deleted file mode 100644 index 02527dc2e..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_load_client_CA_file.pod +++ /dev/null @@ -1,62 +0,0 @@ -=pod - -=head1 NAME - -SSL_load_client_CA_file - load certificate names from file - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); - -=head1 DESCRIPTION - -SSL_load_client_CA_file() reads certificates from B<file> and returns -a STACK_OF(X509_NAME) with the subject names found. - -=head1 NOTES - -SSL_load_client_CA_file() reads a file of PEM formatted certificates and -extracts the X509_NAMES of the certificates found. While the name suggests -the specific usage as support function for -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, -it is not limited to CA certificates. - -=head1 EXAMPLES - -Load names of CAs from file and use it as a client CA list: - - SSL_CTX *ctx; - STACK_OF(X509_NAME) *cert_names; - - ... - cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem"); - if (cert_names != NULL) - SSL_CTX_set_client_CA_list(ctx, cert_names); - else - error_handling(); - ... - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -The operation failed, check out the error stack for the reason. - -=item Pointer to STACK_OF(X509_NAME) - -Pointer to the subject names of the successfully read certificates. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_new.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_new.pod deleted file mode 100644 index 25300e978..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_new.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -SSL_new - create a new SSL structure for a connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL *SSL_new(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_new() creates a new B<SSL> structure which is needed to hold the -data for a TLS/SSL connection. The new structure inherits the settings -of the underlying context B<ctx>: connection method (SSLv2/v3/TLSv1), -options, verification settings, timeout settings. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -The creation of a new SSL structure failed. Check the error stack to -find out the reason. - -=item Pointer to an SSL structure - -The return value points to an allocated SSL structure. - -=back - -=head1 SEE ALSO - -L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, -L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_pending.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_pending.pod deleted file mode 100644 index 43f2874e8..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_pending.pod +++ /dev/null @@ -1,43 +0,0 @@ -=pod - -=head1 NAME - -SSL_pending - obtain number of readable bytes buffered in an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_pending(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_pending() returns the number of bytes which are available inside -B<ssl> for immediate read. - -=head1 NOTES - -Data are received in blocks from the peer. Therefore data can be buffered -inside B<ssl> and are ready for immediate retrieval with -L<SSL_read(3)|SSL_read(3)>. - -=head1 RETURN VALUES - -The number of bytes pending is returned. - -=head1 BUGS - -SSL_pending() takes into account only bytes from the TLS/SSL record -that is currently being processed (if any). If the B<SSL> object's -I<read_ahead> flag is set, additional protocol bytes may have been -read containing more TLS/SSL records; these are ignored by -SSL_pending(). - -Up to OpenSSL 0.9.6, SSL_pending() does not check if the record type -of pending data is application data. - -=head1 SEE ALSO - -L<SSL_read(3)|SSL_read(3)>, L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_read.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_read.pod deleted file mode 100644 index f6c37f77e..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_read.pod +++ /dev/null @@ -1,118 +0,0 @@ -=pod - -=head1 NAME - -SSL_read - read bytes from a TLS/SSL connection. - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_read(SSL *ssl, void *buf, int num); - -=head1 DESCRIPTION - -SSL_read() tries to read B<num> bytes from the specified B<ssl> into the -buffer B<buf>. - -=head1 NOTES - -If necessary, SSL_read() will negotiate a TLS/SSL session, if -not already explicitly performed by L<SSL_connect(3)|SSL_connect(3)> or -L<SSL_accept(3)|SSL_accept(3)>. If the -peer requests a re-negotiation, it will be performed transparently during -the SSL_read() operation. The behaviour of SSL_read() depends on the -underlying BIO. - -For the transparent negotiation to succeed, the B<ssl> must have been -initialized to client or server mode. This is being done by calling -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() -before the first call to an SSL_read() or L<SSL_write(3)|SSL_write(3)> -function. - -SSL_read() works based on the SSL/TLS records. The data are received in -records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a -record has been completely received, it can be processed (decryption and -check of integrity). Therefore data that was not retrieved at the last -call of SSL_read() can still be buffered inside the SSL layer and will be -retrieved on the next call to SSL_read(). If B<num> is higher than the -number of bytes buffered, SSL_read() will return with the bytes buffered. -If no more bytes are in the buffer, SSL_read() will trigger the processing -of the next record. Only when the record has been received and processed -completely, SSL_read() will return reporting success. At most the contents -of the record will be returned. As the size of an SSL/TLS record may exceed -the maximum packet size of the underlying transport (e.g. TCP), it may -be necessary to read several packets from the transport layer before the -record is complete and SSL_read() can succeed. - -If the underlying BIO is B<blocking>, SSL_read() will only return, once the -read operation has been finished or an error occurred, except when a -renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. -This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call. - -If the underlying BIO is B<non-blocking>, SSL_read() will also return -when the underlying BIO could not satisfy the needs of SSL_read() -to continue the operation. In this case a call to -L<SSL_get_error(3)|SSL_get_error(3)> with the -return value of SSL_read() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a -call to SSL_read() can also cause write operations! The calling process -then must repeat the call after taking appropriate action to satisfy the -needs of SSL_read(). The action depends on the underlying BIO. When using a -non-blocking socket, nothing is to be done, but select() can be used to check -for the required condition. When using a buffering BIO, like a BIO pair, data -must be written into or retrieved out of the BIO before being able to continue. - -=head1 WARNING - -When an SSL_read() operation has to be repeated because of -B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated -with the same arguments. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item E<gt>0 - -The read operation was successful; the return value is the number of -bytes actually read from the TLS/SSL connection. - -=item 0 - -The read operation was not successful. The reason may either be a clean -shutdown due to a "close notify" alert sent by the peer (in which case -the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set -(see L<SSL_shutdown(3)|SSL_shutdown(3)>, -L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>). It is also possible, that -the peer simply shut down the underlying transport and the shutdown is -incomplete. Call SSL_get_error() with the return value B<ret> to find out, -whether an error occurred or the connection was shut down cleanly -(SSL_ERROR_ZERO_RETURN). - -SSLv2 (deprecated) does not support a shutdown alert protocol, so it can -only be detected, whether the underlying connection was closed. It cannot -be checked, whether the closure was initiated by the peer or by something -else. - -=item E<lt>0 - -The read operation was not successful, because either an error occurred -or action must be taken by the calling process. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_write(3)|SSL_write(3)>, -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, -L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_rstate_string.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_rstate_string.pod deleted file mode 100644 index bdb8a1fcd..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_rstate_string.pod +++ /dev/null @@ -1,59 +0,0 @@ -=pod - -=head1 NAME - -SSL_rstate_string, SSL_rstate_string_long - get textual description of state of an SSL object during read operation - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_rstate_string(SSL *ssl); - const char *SSL_rstate_string_long(SSL *ssl); - -=head1 DESCRIPTION - -SSL_rstate_string() returns a 2 letter string indicating the current read state -of the SSL object B<ssl>. - -SSL_rstate_string_long() returns a string indicating the current read state of -the SSL object B<ssl>. - -=head1 NOTES - -When performing a read operation, the SSL/TLS engine must parse the record, -consisting of header and body. When working in a blocking environment, -SSL_rstate_string[_long]() should always return "RD"/"read done". - -This function should only seldom be needed in applications. - -=head1 RETURN VALUES - -SSL_rstate_string() and SSL_rstate_string_long() can return the following -values: - -=over 4 - -=item "RH"/"read header" - -The header of the record is being evaluated. - -=item "RB"/"read body" - -The body of the record is being evaluated. - -=item "RD"/"read done" - -The record has been completely processed. - -=item "unknown"/"unknown" - -The read state is unknown. This should never happen. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_session_reused.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_session_reused.pod deleted file mode 100644 index da7d06264..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_session_reused.pod +++ /dev/null @@ -1,45 +0,0 @@ -=pod - -=head1 NAME - -SSL_session_reused - query whether a reused session was negotiated during handshake - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_session_reused(SSL *ssl); - -=head1 DESCRIPTION - -Query, whether a reused session was negotiated during the handshake. - -=head1 NOTES - -During the negotiation, a client can propose to reuse a session. The server -then looks up the session in its cache. If both client and server agree -on the session, it will be reused and a flag is being set that can be -queried by the application. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -A new session was negotiated. - -=item 1 - -A session was reused. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_bio.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_bio.pod deleted file mode 100644 index 67c9756d3..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_bio.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_bio - connect the SSL object with a BIO - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio); - -=head1 DESCRIPTION - -SSL_set_bio() connects the BIOs B<rbio> and B<wbio> for the read and write -operations of the TLS/SSL (encrypted) side of B<ssl>. - -The SSL engine inherits the behaviour of B<rbio> and B<wbio>, respectively. -If a BIO is non-blocking, the B<ssl> will also have non-blocking behaviour. - -If there was already a BIO connected to B<ssl>, BIO_free() will be called -(for both the reading and writing side, if different). - -=head1 RETURN VALUES - -SSL_set_bio() cannot fail. - -=head1 SEE ALSO - -L<SSL_get_rbio(3)|SSL_get_rbio(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_connect_state.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_connect_state.pod deleted file mode 100644 index d88a057de..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_connect_state.pod +++ /dev/null @@ -1,55 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_connect_state, SSL_get_accept_state - prepare SSL object to work in client or server mode - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_connect_state(SSL *ssl); - - void SSL_set_accept_state(SSL *ssl); - -=head1 DESCRIPTION - -SSL_set_connect_state() sets B<ssl> to work in client mode. - -SSL_set_accept_state() sets B<ssl> to work in server mode. - -=head1 NOTES - -When the SSL_CTX object was created with L<SSL_CTX_new(3)|SSL_CTX_new(3)>, -it was either assigned a dedicated client method, a dedicated server -method, or a generic method, that can be used for both client and -server connections. (The method might have been changed with -L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> or -SSL_set_ssl_method().) - -When beginning a new handshake, the SSL engine must know whether it must -call the connect (client) or accept (server) routines. Even though it may -be clear from the method chosen, whether client or server mode was -requested, the handshake routines must be explicitly set. - -When using the L<SSL_connect(3)|SSL_connect(3)> or -L<SSL_accept(3)|SSL_accept(3)> routines, the correct handshake -routines are automatically set. When performing a transparent negotiation -using L<SSL_write(3)|SSL_write(3)> or L<SSL_read(3)|SSL_read(3)>, the -handshake routines must be explicitly set in advance using either -SSL_set_connect_state() or SSL_set_accept_state(). - -=head1 RETURN VALUES - -SSL_set_connect_state() and SSL_set_accept_state() do not return diagnostic -information. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_write(3)|SSL_write(3)>, L<SSL_read(3)|SSL_read(3)>, -L<SSL_do_handshake(3)|SSL_do_handshake(3)>, -L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_fd.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_fd.pod deleted file mode 100644 index 70291128f..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_fd.pod +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_fd - connect the SSL object with a file descriptor - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_set_fd(SSL *ssl, int fd); - int SSL_set_rfd(SSL *ssl, int fd); - int SSL_set_wfd(SSL *ssl, int fd); - -=head1 DESCRIPTION - -SSL_set_fd() sets the file descriptor B<fd> as the input/output facility -for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the -socket file descriptor of a network connection. - -When performing the operation, a B<socket BIO> is automatically created to -interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine -inherit the behaviour of B<fd>. If B<fd> is non-blocking, the B<ssl> will -also have non-blocking behaviour. - -If there was already a BIO connected to B<ssl>, BIO_free() will be called -(for both the reading and writing side, if different). - -SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only -for the read channel or the write channel, which can be set independently. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The operation failed. Check the error stack to find out why. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<SSL_get_fd(3)|SSL_get_fd(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_session.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_session.pod deleted file mode 100644 index 5f54714ad..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_session.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_set_session(SSL *ssl, SSL_SESSION *session); - -=head1 DESCRIPTION - -SSL_set_session() sets B<session> to be used when the TLS/SSL connection -is to be established. SSL_set_session() is only useful for TLS/SSL clients. -When the session is set, the reference count of B<session> is incremented -by 1. If the session is not reused, the reference count is decremented -again during SSL_connect(). Whether the session was reused can be queried -with the L<SSL_session_reused(3)|SSL_session_reused(3)> call. - -If there is already a session set inside B<ssl> (because it was set with -SSL_set_session() before or because the same B<ssl> was already used for -a connection), SSL_SESSION_free() will be called for that session. - -=head1 NOTES - -SSL_SESSION objects keep internal link information about the session cache -list, when being inserted into one SSL_CTX object's session cache. -One SSL_SESSION object, regardless of its reference count, must therefore -only be used with one SSL_CTX object (and the SSL objects created -from this SSL_CTX object). - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The operation failed; check the error stack to find out the reason. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, -L<SSL_get_session(3)|SSL_get_session(3)>, -L<SSL_session_reused(3)|SSL_session_reused(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_shutdown.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_shutdown.pod deleted file mode 100644 index 011a022a1..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_shutdown.pod +++ /dev/null @@ -1,72 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_shutdown(SSL *ssl, int mode); - - int SSL_get_shutdown(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>. - -SSL_get_shutdown() returns the shutdown mode of B<ssl>. - -=head1 NOTES - -The shutdown state of an ssl connection is a bitmask of: - -=over 4 - -=item 0 - -No shutdown setting, yet. - -=item SSL_SENT_SHUTDOWN - -A "close notify" shutdown alert was sent to the peer, the connection is being -considered closed and the session is closed and correct. - -=item SSL_RECEIVED_SHUTDOWN - -A shutdown alert was received form the peer, either a normal "close notify" -or a fatal error. - -=back - -SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time. - -The shutdown state of the connection is used to determine the state of -the ssl session. If the session is still open, when -L<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called, -it is considered bad and removed according to RFC2246. -The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN -(according to the TLS RFC, it is acceptable to only send the "close notify" -alert but to not wait for the peer's answer, when the underlying connection -is closed). -SSL_set_shutdown() can be used to set this state without sending a -close alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>). - -If a "close notify" was received, SSL_RECEIVED_SHUTDOWN will be set, -for setting SSL_SENT_SHUTDOWN the application must however still call -L<SSL_shutdown(3)|SSL_shutdown(3)> or SSL_set_shutdown() itself. - -=head1 RETURN VALUES - -SSL_set_shutdown() does not return diagnostic information. - -SSL_get_shutdown() returns the current setting. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, -L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_verify_result.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_set_verify_result.pod deleted file mode 100644 index 04ab101aa..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_set_verify_result.pod +++ /dev/null @@ -1,38 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_verify_result - override result of peer certificate verification - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_verify_result(SSL *ssl, long verify_result); - -=head1 DESCRIPTION - -SSL_set_verify_result() sets B<verify_result> of the object B<ssl> to be the -result of the verification of the X509 certificate presented by the peer, -if any. - -=head1 NOTES - -SSL_set_verify_result() overrides the verification result. It only changes -the verification result of the B<ssl> object. It does not become part of the -established session, so if the session is to be reused later, the original -value will reappear. - -The valid codes for B<verify_result> are documented in L<verify(1)|verify(1)>. - -=head1 RETURN VALUES - -SSL_set_verify_result() does not provide a return value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, -L<verify(1)|verify(1)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_shutdown.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_shutdown.pod deleted file mode 100644 index 89911acbc..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_shutdown.pod +++ /dev/null @@ -1,125 +0,0 @@ -=pod - -=head1 NAME - -SSL_shutdown - shut down a TLS/SSL connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_shutdown(SSL *ssl); - -=head1 DESCRIPTION - -SSL_shutdown() shuts down an active TLS/SSL connection. It sends the -"close notify" shutdown alert to the peer. - -=head1 NOTES - -SSL_shutdown() tries to send the "close notify" shutdown alert to the peer. -Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and -a currently open session is considered closed and good and will be kept in the -session cache for further reuse. - -The shutdown procedure consists of 2 steps: the sending of the "close notify" -shutdown alert and the reception of the peer's "close notify" shutdown -alert. According to the TLS standard, it is acceptable for an application -to only send its shutdown alert and then close the underlying connection -without waiting for the peer's response (this way resources can be saved, -as the process can already terminate or serve another connection). -When the underlying connection shall be used for more communications, the -complete shutdown procedure (bidirectional "close notify" alerts) must be -performed, so that the peers stay synchronized. - -SSL_shutdown() supports both uni- and bidirectional shutdown by its 2 step -behaviour. - -=over 4 - -=item When the application is the first party to send the "close notify" -alert, SSL_shutdown() will only send the alert and then set the -SSL_SENT_SHUTDOWN flag (so that the session is considered good and will -be kept in cache). SSL_shutdown() will then return with 0. If a unidirectional -shutdown is enough (the underlying connection shall be closed anyway), this -first call to SSL_shutdown() is sufficient. In order to complete the -bidirectional shutdown handshake, SSL_shutdown() must be called again. -The second call will make SSL_shutdown() wait for the peer's "close notify" -shutdown alert. On success, the second call to SSL_shutdown() will return -with 1. - -=item If the peer already sent the "close notify" alert B<and> it was -already processed implicitly inside another function -(L<SSL_read(3)|SSL_read(3)>), the SSL_RECEIVED_SHUTDOWN flag is set. -SSL_shutdown() will send the "close notify" alert, set the SSL_SENT_SHUTDOWN -flag and will immediately return with 1. -Whether SSL_RECEIVED_SHUTDOWN is already set can be checked using the -SSL_get_shutdown() (see also L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> call. - -=back - -It is therefore recommended, to check the return value of SSL_shutdown() -and call SSL_shutdown() again, if the bidirectional shutdown is not yet -complete (return value of the first call is 0). As the shutdown is not -specially handled in the SSLv2 protocol, SSL_shutdown() will succeed on -the first call. - -The behaviour of SSL_shutdown() additionally depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the -handshake step has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return -when the underlying BIO could not satisfy the needs of SSL_shutdown() -to continue the handshake. In this case a call to SSL_get_error() with the -return value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_shutdown(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -SSL_shutdown() can be modified to only set the connection to "shutdown" -state but not actually send the "close notify" alert messages, -see L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>. -When "quiet shutdown" is enabled, SSL_shutdown() will always succeed -and return 1. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The shutdown was successfully completed. The "close notify" alert was sent -and the peer's "close notify" alert was received. - -=item 0 - -The shutdown is not yet finished. Call SSL_shutdown() for a second time, -if a bidirectional shutdown shall be performed. -The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an -erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. - -=item -1 - -The shutdown was not successful because a fatal error occurred either -at the protocol level or a connection failure occurred. It can also occur if -action is need to continue the operation for non-blocking BIOs. -Call L<SSL_get_error(3)|SSL_get_error(3)> with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_accept(3)|SSL_accept(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, -L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>, -L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_state_string.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_state_string.pod deleted file mode 100644 index fe25d47c7..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_state_string.pod +++ /dev/null @@ -1,45 +0,0 @@ -=pod - -=head1 NAME - -SSL_state_string, SSL_state_string_long - get textual description of state of an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_state_string(const SSL *ssl); - const char *SSL_state_string_long(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_state_string() returns a 6 letter string indicating the current state -of the SSL object B<ssl>. - -SSL_state_string_long() returns a string indicating the current state of -the SSL object B<ssl>. - -=head1 NOTES - -During its use, an SSL objects passes several states. The state is internally -maintained. Querying the state information is not very informative before -or when a connection has been established. It however can be of significant -interest during the handshake. - -When using non-blocking sockets, the function call performing the handshake -may return with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition, -so that SSL_state_string[_long]() may be called. - -For both blocking or non-blocking sockets, the details state information -can be used within the info_callback function set with the -SSL_set_info_callback() call. - -=head1 RETURN VALUES - -Detailed description of possible states to be included later. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_want.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_want.pod deleted file mode 100644 index c0059c0d4..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_want.pod +++ /dev/null @@ -1,77 +0,0 @@ -=pod - -=head1 NAME - -SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup - obtain state information TLS/SSL I/O operation - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_want(const SSL *ssl); - int SSL_want_nothing(const SSL *ssl); - int SSL_want_read(const SSL *ssl); - int SSL_want_write(const SSL *ssl); - int SSL_want_x509_lookup(const SSL *ssl); - -=head1 DESCRIPTION - -SSL_want() returns state information for the SSL object B<ssl>. - -The other SSL_want_*() calls are shortcuts for the possible states returned -by SSL_want(). - -=head1 NOTES - -SSL_want() examines the internal state information of the SSL object. Its -return values are similar to that of L<SSL_get_error(3)|SSL_get_error(3)>. -Unlike L<SSL_get_error(3)|SSL_get_error(3)>, which also evaluates the -error queue, the results are obtained by examining an internal state flag -only. The information must therefore only be used for normal operation under -non-blocking I/O. Error conditions are not handled and must be treated -using L<SSL_get_error(3)|SSL_get_error(3)>. - -The result returned by SSL_want() should always be consistent with -the result of L<SSL_get_error(3)|SSL_get_error(3)>. - -=head1 RETURN VALUES - -The following return values can currently occur for SSL_want(): - -=over 4 - -=item SSL_NOTHING - -There is no data to be written or to be read. - -=item SSL_WRITING - -There are data in the SSL buffer that must be written to the underlying -B<BIO> layer in order to complete the actual SSL_*() operation. -A call to L<SSL_get_error(3)|SSL_get_error(3)> should return -SSL_ERROR_WANT_WRITE. - -=item SSL_READING - -More data must be read from the underlying B<BIO> layer in order to -complete the actual SSL_*() operation. -A call to L<SSL_get_error(3)|SSL_get_error(3)> should return -SSL_ERROR_WANT_READ. - -=item SSL_X509_LOOKUP - -The operation did not complete because an application callback set by -SSL_CTX_set_client_cert_cb() has asked to be called again. -A call to L<SSL_get_error(3)|SSL_get_error(3)> should return -SSL_ERROR_WANT_X509_LOOKUP. - -=back - -SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup() -return 1, when the corresponding condition is true or 0 otherwise. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<err(3)|err(3)>, L<SSL_get_error(3)|SSL_get_error(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/SSL_write.pod b/sys/src/ape/lib/openssl/doc/ssl/SSL_write.pod deleted file mode 100644 index e013c12d5..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/SSL_write.pod +++ /dev/null @@ -1,109 +0,0 @@ -=pod - -=head1 NAME - -SSL_write - write bytes to a TLS/SSL connection. - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_write(SSL *ssl, const void *buf, int num); - -=head1 DESCRIPTION - -SSL_write() writes B<num> bytes from the buffer B<buf> into the specified -B<ssl> connection. - -=head1 NOTES - -If necessary, SSL_write() will negotiate a TLS/SSL session, if -not already explicitly performed by L<SSL_connect(3)|SSL_connect(3)> or -L<SSL_accept(3)|SSL_accept(3)>. If the -peer requests a re-negotiation, it will be performed transparently during -the SSL_write() operation. The behaviour of SSL_write() depends on the -underlying BIO. - -For the transparent negotiation to succeed, the B<ssl> must have been -initialized to client or server mode. This is being done by calling -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() -before the first call to an L<SSL_read(3)|SSL_read(3)> or SSL_write() function. - -If the underlying BIO is B<blocking>, SSL_write() will only return, once the -write operation has been finished or an error occurred, except when a -renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. -This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call. - -If the underlying BIO is B<non-blocking>, SSL_write() will also return, -when the underlying BIO could not satisfy the needs of SSL_write() -to continue the operation. In this case a call to -L<SSL_get_error(3)|SSL_get_error(3)> with the -return value of SSL_write() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a -call to SSL_write() can also cause read operations! The calling process -then must repeat the call after taking appropriate action to satisfy the -needs of SSL_write(). The action depends on the underlying BIO. When using a -non-blocking socket, nothing is to be done, but select() can be used to check -for the required condition. When using a buffering BIO, like a BIO pair, data -must be written into or retrieved out of the BIO before being able to continue. - -SSL_write() will only return with success, when the complete contents -of B<buf> of length B<num> has been written. This default behaviour -can be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option of -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>. When this flag is set, -SSL_write() will also return with success, when a partial write has been -successfully completed. In this case the SSL_write() operation is considered -completed. The bytes are sent and a new SSL_write() operation with a new -buffer (with the already sent bytes removed) must be started. -A partial write is performed with the size of a message block, which is -16kB for SSLv3/TLSv1. - -=head1 WARNING - -When an SSL_write() operation has to be repeated because of -B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated -with the same arguments. - -When calling SSL_write() with num=0 bytes to be sent the behaviour is -undefined. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item E<gt>0 - -The write operation was successful, the return value is the number of -bytes actually written to the TLS/SSL connection. - -=item 0 - -The write operation was not successful. Probably the underlying connection -was closed. Call SSL_get_error() with the return value B<ret> to find out, -whether an error occurred or the connection was shut down cleanly -(SSL_ERROR_ZERO_RETURN). - -SSLv2 (deprecated) does not support a shutdown alert protocol, so it can -only be detected, whether the underlying connection was closed. It cannot -be checked, why the closure happened. - -=item E<lt>0 - -The write operation was not successful, because either an error occurred -or action must be taken by the calling process. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_read(3)|SSL_read(3)>, -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, -L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/d2i_SSL_SESSION.pod b/sys/src/ape/lib/openssl/doc/ssl/d2i_SSL_SESSION.pod deleted file mode 100644 index 81d276477..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/d2i_SSL_SESSION.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 representation - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); - int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); - -=head1 DESCRIPTION - -d2i_SSL_SESSION() transforms the external ASN1 representation of an SSL/TLS -session, stored as binary data at location B<pp> with length B<length>, into -an SSL_SESSION object. - -i2d_SSL_SESSION() transforms the SSL_SESSION object B<in> into the ASN1 -representation and stores it into the memory location pointed to by B<pp>. -The length of the resulting ASN1 representation is returned. If B<pp> is -the NULL pointer, only the length is calculated and returned. - -=head1 NOTES - -The SSL_SESSION object is built from several malloc()ed parts, it can -therefore not be moved, copied or stored directly. In order to store -session data on disk or into a database, it must be transformed into -a binary ASN1 representation. - -When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically -allocated. The reference count is 1, so that the session must be -explicitly removed using L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, -unless the SSL_SESSION object is completely taken over, when being called -inside the get_session_cb() (see -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>). - -SSL_SESSION objects keep internal link information about the session cache -list, when being inserted into one SSL_CTX object's session cache. -One SSL_SESSION object, regardless of its reference count, must therefore -only be used with one SSL_CTX object (and the SSL objects created -from this SSL_CTX object). - -When using i2d_SSL_SESSION(), the memory location pointed to by B<pp> must be -large enough to hold the binary representation of the session. There is no -known limit on the size of the created ASN1 representation, so the necessary -amount of space should be obtained by first calling i2d_SSL_SESSION() with -B<pp=NULL>, and obtain the size needed, then allocate the memory and -call i2d_SSL_SESSION() again. - -=head1 RETURN VALUES - -d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION -object. In case of failure the NULL-pointer is returned and the error message -can be retrieved from the error stack. - -i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes. -When the session is not valid, B<0> is returned and no operation is performed. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> - -=cut diff --git a/sys/src/ape/lib/openssl/doc/ssl/ssl.pod b/sys/src/ape/lib/openssl/doc/ssl/ssl.pod deleted file mode 100644 index 266697d22..000000000 --- a/sys/src/ape/lib/openssl/doc/ssl/ssl.pod +++ /dev/null @@ -1,736 +0,0 @@ - -=pod - -=head1 NAME - -SSL - OpenSSL SSL/TLS library - -=head1 SYNOPSIS - -=head1 DESCRIPTION - -The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and -Transport Layer Security (TLS v1) protocols. It provides a rich API which is -documented here. - -At first the library must be initialized; see -L<SSL_library_init(3)|SSL_library_init(3)>. - -Then an B<SSL_CTX> object is created as a framework to establish -TLS/SSL enabled connections (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>). -Various options regarding certificates, algorithms etc. can be set -in this object. - -When a network connection has been created, it can be assigned to an -B<SSL> object. After the B<SSL> object has been created using -L<SSL_new(3)|SSL_new(3)>, L<SSL_set_fd(3)|SSL_set_fd(3)> or -L<SSL_set_bio(3)|SSL_set_bio(3)> can be used to associate the network -connection with the object. - -Then the TLS/SSL handshake is performed using -L<SSL_accept(3)|SSL_accept(3)> or L<SSL_connect(3)|SSL_connect(3)> -respectively. -L<SSL_read(3)|SSL_read(3)> and L<SSL_write(3)|SSL_write(3)> are used -to read and write data on the TLS/SSL connection. -L<SSL_shutdown(3)|SSL_shutdown(3)> can be used to shut down the -TLS/SSL connection. - -=head1 DATA STRUCTURES - -Currently the OpenSSL B<ssl> library functions deals with the following data -structures: - -=over 4 - -=item B<SSL_METHOD> (SSL Method) - -That's a dispatch structure describing the internal B<ssl> library -methods/functions which implement the various protocol versions (SSLv1, SSLv2 -and TLSv1). It's needed to create an B<SSL_CTX>. - -=item B<SSL_CIPHER> (SSL Cipher) - -This structure holds the algorithm information for a particular cipher which -are a core part of the SSL/TLS protocol. The available ciphers are configured -on a B<SSL_CTX> basis and the actually used ones are then part of the -B<SSL_SESSION>. - -=item B<SSL_CTX> (SSL Context) - -That's the global context structure which is created by a server or client -once per program life-time and which holds mainly default values for the -B<SSL> structures which are later created for the connections. - -=item B<SSL_SESSION> (SSL Session) - -This is a structure containing the current TLS/SSL session details for a -connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. - -=item B<SSL> (SSL Connection) - -That's the main SSL/TLS structure which is created by a server or client per -established connection. This actually is the core structure in the SSL API. -Under run-time the application usually deals with this structure which has -links to mostly all other structures. - -=back - - -=head1 HEADER FILES - -Currently the OpenSSL B<ssl> library provides the following C header files -containing the prototypes for the data structures and and functions: - -=over 4 - -=item B<ssl.h> - -That's the common header file for the SSL/TLS API. Include it into your -program to make the API of the B<ssl> library available. It internally -includes both more private SSL headers and headers from the B<crypto> library. -Whenever you need hard-core details on the internals of the SSL API, look -inside this header file. - -=item B<ssl2.h> - -That's the sub header file dealing with the SSLv2 protocol only. -I<Usually you don't have to include it explicitly because -it's already included by ssl.h>. - -=item B<ssl3.h> - -That's the sub header file dealing with the SSLv3 protocol only. -I<Usually you don't have to include it explicitly because -it's already included by ssl.h>. - -=item B<ssl23.h> - -That's the sub header file dealing with the combined use of the SSLv2 and -SSLv3 protocols. -I<Usually you don't have to include it explicitly because -it's already included by ssl.h>. - -=item B<tls1.h> - -That's the sub header file dealing with the TLSv1 protocol only. -I<Usually you don't have to include it explicitly because -it's already included by ssl.h>. - -=back - -=head1 API FUNCTIONS - -Currently the OpenSSL B<ssl> library exports 214 API functions. -They are documented in the following: - -=head2 DEALING WITH PROTOCOL METHODS - -Here we document the various API functions which deal with the SSL/TLS -protocol methods defined in B<SSL_METHOD> structures. - -=over 4 - -=item SSL_METHOD *B<SSLv2_client_method>(void); - -Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. - -=item SSL_METHOD *B<SSLv2_server_method>(void); - -Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. - -=item SSL_METHOD *B<SSLv2_method>(void); - -Constructor for the SSLv2 SSL_METHOD structure for combined client and server. - -=item SSL_METHOD *B<SSLv3_client_method>(void); - -Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. - -=item SSL_METHOD *B<SSLv3_server_method>(void); - -Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. - -=item SSL_METHOD *B<SSLv3_method>(void); - -Constructor for the SSLv3 SSL_METHOD structure for combined client and server. - -=item SSL_METHOD *B<TLSv1_client_method>(void); - -Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. - -=item SSL_METHOD *B<TLSv1_server_method>(void); - -Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. - -=item SSL_METHOD *B<TLSv1_method>(void); - -Constructor for the TLSv1 SSL_METHOD structure for combined client and server. - -=back - -=head2 DEALING WITH CIPHERS - -Here we document the various API functions which deal with the SSL/TLS -ciphers defined in B<SSL_CIPHER> structures. - -=over 4 - -=item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len); - -Write a string to I<buf> (with a maximum size of I<len>) containing a human -readable description of I<cipher>. Returns I<buf>. - -=item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits); - -Determine the number of bits in I<cipher>. Because of export crippled ciphers -there are two bits: The bits the algorithm supports in general (stored to -I<alg_bits>) and the bits which are actually used (the return value). - -=item const char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); - -Return the internal name of I<cipher> as a string. These are the various -strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx> -definitions in the header files. - -=item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher); - -Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the -SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined -in the specification the first time). - -=back - -=head2 DEALING WITH PROTOCOL CONTEXTS - -Here we document the various API functions which deal with the SSL/TLS -protocol context defined in the B<SSL_CTX> structure. - -=over 4 - -=item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x); - -=item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509); - -=item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); - -=item int B<SSL_CTX_check_private_key>(const SSL_CTX *ctx); - -=item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); - -=item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t); - -=item void B<SSL_CTX_free>(SSL_CTX *a); - -=item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx); - -=item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); - -=item STACK *B<SSL_CTX_get_client_CA_list>(const SSL_CTX *ctx); - -=item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); - -=item char *B<SSL_CTX_get_ex_data>(const SSL_CTX *s, int idx); - -=item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) - -=item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); - -=item int B<SSL_CTX_get_quiet_shutdown>(const SSL_CTX *ctx); - -=item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); - -=item long B<SSL_CTX_get_timeout>(const SSL_CTX *ctx); - -=item int (*B<SSL_CTX_get_verify_callback>(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); - -=item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); - -=item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath); - -=item long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx); - -=item SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth); - -=item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c); - -=item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx); - -=item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); - -=item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); - -=item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); - -=item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx); - -=item int B<SSL_CTX_sess_number>(SSL_CTX *ctx); - -=item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx,t); - -=item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); - -=item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); - -=item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); - -=item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx); - -=item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx); - -=item void B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg); - -=item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); - -=item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(), char *arg) - -=item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); - -=item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list); - -=item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); - -=item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void)) - -=item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m); - -=item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx); - -=item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg); - -=item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); - -=item void B<SSL_CTX_set_msg_callback>(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); - -=item void B<SSL_CTX_set_msg_callback_arg>(SSL_CTX *ctx, void *arg); - -=item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); - -=item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); - -=item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode); - -=item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth); - -=item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t); - -=item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh); - -=item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void)); - -=item long B<SSL_CTX_set_tmp_rsa>(SSL_CTX *ctx, RSA *rsa); - -=item SSL_CTX_set_tmp_rsa_callback - -C<long B<SSL_CTX_set_tmp_rsa_callback>(SSL_CTX *B<ctx>, RSA *(*B<cb>)(SSL *B<ssl>, int B<export>, int B<keylength>));> - -Sets the callback which will be called when a temporary private key is -required. The B<C<export>> flag will be set if the reason for needing -a temp key is that an export ciphersuite is in use, in which case, -B<C<keylength>> will contain the required keylength in bits. Generate a key of -appropriate size (using ???) and return it. - -=item SSL_set_tmp_rsa_callback - -long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); - -The same as B<SSL_CTX_set_tmp_rsa_callback>, except it operates on an SSL -session instead of a context. - -=item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void)) - -=item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey); - -=item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len); - -=item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type); - -=item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa); - -=item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len); - -=item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type); - -=item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x); - -=item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d); - -=item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type); - -=back - -=head2 DEALING WITH SESSIONS - -Here we document the various API functions which deal with the SSL/TLS -sessions defined in the B<SSL_SESSION> structures. - -=over 4 - -=item int B<SSL_SESSION_cmp>(const SSL_SESSION *a, const SSL_SESSION *b); - -=item void B<SSL_SESSION_free>(SSL_SESSION *ss); - -=item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); - -=item char *B<SSL_SESSION_get_ex_data>(const SSL_SESSION *s, int idx); - -=item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) - -=item long B<SSL_SESSION_get_time>(const SSL_SESSION *s); - -=item long B<SSL_SESSION_get_timeout>(const SSL_SESSION *s); - -=item unsigned long B<SSL_SESSION_hash>(const SSL_SESSION *a); - -=item SSL_SESSION *B<SSL_SESSION_new>(void); - -=item int B<SSL_SESSION_print>(BIO *bp, const SSL_SESSION *x); - -=item int B<SSL_SESSION_print_fp>(FILE *fp, const SSL_SESSION *x); - -=item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); - -=item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg); - -=item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t); - -=item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t); - -=back - -=head2 DEALING WITH CONNECTIONS - -Here we document the various API functions which deal with the SSL/TLS -connection defined in the B<SSL> structure. - -=over 4 - -=item int B<SSL_accept>(SSL *ssl); - -=item int B<SSL_add_dir_cert_subjects_to_stack>(STACK *stack, const char *dir); - -=item int B<SSL_add_file_cert_subjects_to_stack>(STACK *stack, const char *file); - -=item int B<SSL_add_client_CA>(SSL *ssl, X509 *x); - -=item char *B<SSL_alert_desc_string>(int value); - -=item char *B<SSL_alert_desc_string_long>(int value); - -=item char *B<SSL_alert_type_string>(int value); - -=item char *B<SSL_alert_type_string_long>(int value); - -=item int B<SSL_check_private_key>(const SSL *ssl); - -=item void B<SSL_clear>(SSL *ssl); - -=item long B<SSL_clear_num_renegotiations>(SSL *ssl); - -=item int B<SSL_connect>(SSL *ssl); - -=item void B<SSL_copy_session_id>(SSL *t, const SSL *f); - -=item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); - -=item int B<SSL_do_handshake>(SSL *ssl); - -=item SSL *B<SSL_dup>(SSL *ssl); - -=item STACK *B<SSL_dup_CA_list>(STACK *sk); - -=item void B<SSL_free>(SSL *ssl); - -=item SSL_CTX *B<SSL_get_SSL_CTX>(const SSL *ssl); - -=item char *B<SSL_get_app_data>(SSL *ssl); - -=item X509 *B<SSL_get_certificate>(const SSL *ssl); - -=item const char *B<SSL_get_cipher>(const SSL *ssl); - -=item int B<SSL_get_cipher_bits>(const SSL *ssl, int *alg_bits); - -=item char *B<SSL_get_cipher_list>(const SSL *ssl, int n); - -=item char *B<SSL_get_cipher_name>(const SSL *ssl); - -=item char *B<SSL_get_cipher_version>(const SSL *ssl); - -=item STACK *B<SSL_get_ciphers>(const SSL *ssl); - -=item STACK *B<SSL_get_client_CA_list>(const SSL *ssl); - -=item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); - -=item long B<SSL_get_default_timeout>(const SSL *ssl); - -=item int B<SSL_get_error>(const SSL *ssl, int i); - -=item char *B<SSL_get_ex_data>(const SSL *ssl, int idx); - -=item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); - -=item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) - -=item int B<SSL_get_fd>(const SSL *ssl); - -=item void (*B<SSL_get_info_callback>(const SSL *ssl);)() - -=item STACK *B<SSL_get_peer_cert_chain>(const SSL *ssl); - -=item X509 *B<SSL_get_peer_certificate>(const SSL *ssl); - -=item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); - -=item int B<SSL_get_quiet_shutdown>(const SSL *ssl); - -=item BIO *B<SSL_get_rbio>(const SSL *ssl); - -=item int B<SSL_get_read_ahead>(const SSL *ssl); - -=item SSL_SESSION *B<SSL_get_session>(const SSL *ssl); - -=item char *B<SSL_get_shared_ciphers>(const SSL *ssl, char *buf, int len); - -=item int B<SSL_get_shutdown>(const SSL *ssl); - -=item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); - -=item int B<SSL_get_state>(const SSL *ssl); - -=item long B<SSL_get_time>(const SSL *ssl); - -=item long B<SSL_get_timeout>(const SSL *ssl); - -=item int (*B<SSL_get_verify_callback>(const SSL *ssl))(int,X509_STORE_CTX *) - -=item int B<SSL_get_verify_mode>(const SSL *ssl); - -=item long B<SSL_get_verify_result>(const SSL *ssl); - -=item char *B<SSL_get_version>(const SSL *ssl); - -=item BIO *B<SSL_get_wbio>(const SSL *ssl); - -=item int B<SSL_in_accept_init>(SSL *ssl); - -=item int B<SSL_in_before>(SSL *ssl); - -=item int B<SSL_in_connect_init>(SSL *ssl); - -=item int B<SSL_in_init>(SSL *ssl); - -=item int B<SSL_is_init_finished>(SSL *ssl); - -=item STACK *B<SSL_load_client_CA_file>(char *file); - -=item void B<SSL_load_error_strings>(void); - -=item SSL *B<SSL_new>(SSL_CTX *ctx); - -=item long B<SSL_num_renegotiations>(SSL *ssl); - -=item int B<SSL_peek>(SSL *ssl, void *buf, int num); - -=item int B<SSL_pending>(const SSL *ssl); - -=item int B<SSL_read>(SSL *ssl, void *buf, int num); - -=item int B<SSL_renegotiate>(SSL *ssl); - -=item char *B<SSL_rstate_string>(SSL *ssl); - -=item char *B<SSL_rstate_string_long>(SSL *ssl); - -=item long B<SSL_session_reused>(SSL *ssl); - -=item void B<SSL_set_accept_state>(SSL *ssl); - -=item void B<SSL_set_app_data>(SSL *ssl, char *arg); - -=item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio); - -=item int B<SSL_set_cipher_list>(SSL *ssl, char *str); - -=item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list); - -=item void B<SSL_set_connect_state>(SSL *ssl); - -=item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg); - -=item int B<SSL_set_fd>(SSL *ssl, int fd); - -=item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) - -=item void B<SSL_set_msg_callback>(SSL *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); - -=item void B<SSL_set_msg_callback_arg>(SSL *ctx, void *arg); - -=item void B<SSL_set_options>(SSL *ssl, unsigned long op); - -=item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); - -=item void B<SSL_set_read_ahead>(SSL *ssl, int yes); - -=item int B<SSL_set_rfd>(SSL *ssl, int fd); - -=item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session); - -=item void B<SSL_set_shutdown>(SSL *ssl, int mode); - -=item int B<SSL_set_ssl_method>(SSL *ssl, SSL_METHOD *meth); - -=item void B<SSL_set_time>(SSL *ssl, long t); - -=item void B<SSL_set_timeout>(SSL *ssl, long t); - -=item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void)) - -=item void B<SSL_set_verify_result>(SSL *ssl, long arg); - -=item int B<SSL_set_wfd>(SSL *ssl, int fd); - -=item int B<SSL_shutdown>(SSL *ssl); - -=item int B<SSL_state>(const SSL *ssl); - -=item char *B<SSL_state_string>(const SSL *ssl); - -=item char *B<SSL_state_string_long>(const SSL *ssl); - -=item long B<SSL_total_renegotiations>(SSL *ssl); - -=item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey); - -=item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len); - -=item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type); - -=item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa); - -=item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len); - -=item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type); - -=item int B<SSL_use_certificate>(SSL *ssl, X509 *x); - -=item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d); - -=item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); - -=item int B<SSL_version>(const SSL *ssl); - -=item int B<SSL_want>(const SSL *ssl); - -=item int B<SSL_want_nothing>(const SSL *ssl); - -=item int B<SSL_want_read>(const SSL *ssl); - -=item int B<SSL_want_write>(const SSL *ssl); - -=item int B<SSL_want_x509_lookup>(const SSL *ssl); - -=item int B<SSL_write>(SSL *ssl, const void *buf, int num); - -=back - -=head1 SEE ALSO - -L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, -L<SSL_accept(3)|SSL_accept(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)>, -L<SSL_COMP_add_compression_method(3)|SSL_COMP_add_compression_method(3)>, -L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, -L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, -L<SSL_CTX_ctrl(3)|SSL_CTX_ctrl(3)>, -L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, -L<SSL_CTX_get_ex_new_index(3)|SSL_CTX_get_ex_new_index(3)>, -L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, -L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> -L<SSL_CTX_new(3)|SSL_CTX_new(3)>, -L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, -L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, -L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, -L<SSL_CTX_sessions(3)|SSL_CTX_sessions(3)>, -L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)>, -L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, -L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, -L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, -L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, -L<SSL_CTX_set_generate_session_id(3)|SSL_CTX_set_generate_session_id(3)>, -L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)>, -L<SSL_CTX_set_max_cert_list(3)|SSL_CTX_set_max_cert_list(3)>, -L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, -L<SSL_CTX_set_msg_callback(3)|SSL_CTX_set_msg_callback(3)>, -L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, -L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, -L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, -L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, -L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)>, -L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, -L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, -L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, -L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, -L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, -L<SSL_alert_type_string(3)|SSL_alert_type_string(3)>, -L<SSL_do_handshake(3)|SSL_do_handshake(3)>, -L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, -L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, -L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, -L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>, -L<SSL_get_error(3)|SSL_get_error(3)>, -L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, -L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, -L<SSL_get_fd(3)|SSL_get_fd(3)>, -L<SSL_get_peer_cert_chain(3)|SSL_get_peer_cert_chain(3)>, -L<SSL_get_rbio(3)|SSL_get_rbio(3)>, -L<SSL_get_session(3)|SSL_get_session(3)>, -L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_get_version(3)|SSL_get_version(3)>, -L<SSL_library_init(3)|SSL_library_init(3)>, -L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, -L<SSL_new(3)|SSL_new(3)>, -L<SSL_pending(3)|SSL_pending(3)>, -L<SSL_read(3)|SSL_read(3)>, -L<SSL_rstate_string(3)|SSL_rstate_string(3)>, -L<SSL_session_reused(3)|SSL_session_reused(3)>, -L<SSL_set_bio(3)|SSL_set_bio(3)>, -L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, -L<SSL_set_fd(3)|SSL_set_fd(3)>, -L<SSL_set_session(3)|SSL_set_session(3)>, -L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, -L<SSL_state_string(3)|SSL_state_string(3)>, -L<SSL_want(3)|SSL_want(3)>, -L<SSL_write(3)|SSL_write(3)>, -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, -L<SSL_SESSION_get_ex_new_index(3)|SSL_SESSION_get_ex_new_index(3)>, -L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, -L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> - -=head1 HISTORY - -The L<ssl(3)|ssl(3)> document appeared in OpenSSL 0.9.2 - -=cut - diff --git a/sys/src/ape/lib/openssl/doc/ssleay.txt b/sys/src/ape/lib/openssl/doc/ssleay.txt deleted file mode 100644 index c75312911..000000000 --- a/sys/src/ape/lib/openssl/doc/ssleay.txt +++ /dev/null @@ -1,7030 +0,0 @@ - -Bundle of old SSLeay documentation files [OBSOLETE!] - -*** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! *** - -OBSOLETE means that nothing in this document should be trusted. This -document is provided mostly for historical purposes (it wasn't even up -to date at the time SSLeay 0.8.1 was released) and as inspiration. If -you copy some snippet of code from this document, please _check_ that -it really is correct from all points of view. For example, you can -check with the other documents in this directory tree, or by comparing -with relevant parts of the include files. - -People have done the mistake of trusting what's written here. Please -don't do that. - -*** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! *** - - -==== readme ======================================================== - -This is the old 0.6.6 docuementation. Most of the cipher stuff is still -relevent but I'm working (very slowly) on new docuemtation. -The current version can be found online at - -http://www.cryptsoft.com/ssleay/doc - -==== API.doc ======================================================== - -SSL - SSLv2/v3/v23 etc. - -BIO - methods and how they plug together - -MEM - memory allocation callback - -CRYPTO - locking for threads - -EVP - Ciphers/Digests/signatures - -RSA - methods - -X509 - certificate retrieval - -X509 - validation - -X509 - X509v3 extensions - -Objects - adding object identifiers - -ASN.1 - parsing - -PEM - parsing - -==== ssl/readme ===================================================== - -22 Jun 1996 -This file belongs in ../apps, but I'll leave it here because it deals -with SSL :-) It is rather dated but it gives you an idea of how -things work. -=== - -17 Jul 1995 -I have been changing things quite a bit and have not fully updated -this file, so take what you read with a grain of salt -eric -=== -The s_client and s_server programs can be used to test SSL capable -IP/port addresses and the verification of the X509 certificates in use -by these services. I strongly advise having a look at the code to get -an idea of how to use the authentication under SSLeay. Any feedback -on changes and improvements would be greatly accepted. - -This file will probably be gibberish unless you have read -rfc1421, rfc1422, rfc1423 and rfc1424 which describe PEM -authentication. - -A Brief outline (and examples) how to use them to do so. - -NOTE: -The environment variable SSL_CIPER is used to specify the prefered -cipher to use, play around with setting it's value to combinations of -RC4-MD5, EXP-RC4-MD5, CBC-DES-MD5, CBC3-DES-MD5, CFB-DES-NULL -in a : separated list. - -This directory contains 3 X509 certificates which can be used by these programs. -client.pem: a file containing a certificate and private key to be used - by s_client. -server.pem :a file containing a certificate and private key to be used - by s_server. -eay1024.pem:the certificate used to sign client.pem and server.pem. - This would be your CA's certificate. There is also a link - from the file a8556381.0 to eay1024.PEM. The value a8556381 - is returned by 'x509 -hash -noout <eay1024.pem' and is the - value used by X509 verification routines to 'find' this - certificte when search a directory for it. - [the above is not true any more, the CA cert is - ../certs/testca.pem which is signed by ../certs/mincomca.pem] - -When testing the s_server, you may get -bind: Address already in use -errors. These indicate the port is still being held by the unix -kernel and you are going to have to wait for it to let go of it. If -this is the case, remember to use the port commands on the s_server and -s_client to talk on an alternative port. - -===== -s_client. -This program can be used to connect to any IP/hostname:port that is -talking SSL. Once connected, it will attempt to authenticate the -certificate it was passed and if everything works as expected, a 2 -directional channel will be open. Any text typed will be sent to the -other end. type Q<cr> to exit. Flags are as follows. --host arg : Arg is the host or IP address to connect to. --port arg : Arg is the port to connect to (https is 443). --verify arg : Turn on authentication of the server certificate. - : Arg specifies the 'depth', this will covered below. --cert arg : The optional certificate to use. This certificate - : will be returned to the server if the server - : requests it for client authentication. --key arg : The private key that matches the certificate - : specified by the -cert option. If this is not - : specified (but -cert is), the -cert file will be - : searched for the Private key. Both files are - : assumed to be in PEM format. --CApath arg : When to look for certificates when 'verifying' the - : certificate from the server. --CAfile arg : A file containing certificates to be used for - : 'verifying' the server certificate. --reconnect : Once a connection has been made, drop it and - : reconnect with same session-id. This is for testing :-). - -The '-verify n' parameter specifies not only to verify the servers -certificate but to also only take notice of 'n' levels. The best way -to explain is to show via examples. -Given -s_server -cert server.PEM is running. - -s_client - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify error:num=1:unable to get issuer certificate - verify return:1 - CIPHER is CBC-DES-MD5 -What has happened is that the 'SSLeay demo server' certificate's -issuer ('CA') could not be found but because verify is not on, we -don't care and the connection has been made anyway. It is now 'up' -using CBC-DES-MD5 mode. This is an unauthenticate secure channel. -You may not be talking to the right person but the data going to them -is encrypted. - -s_client -verify 0 - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify error:num=1:unable to get issuer certificate - verify return:1 - CIPHER is CBC-DES-MD5 -We are 'verifying' but only to depth 0, so since the 'SSLeay demo server' -certificate passed the date and checksum, we are happy to proceed. - -s_client -verify 1 - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify error:num=1:unable to get issuer certificate - verify return:0 - ERROR - verify error:unable to get issuer certificate -In this case we failed to make the connection because we could not -authenticate the certificate because we could not find the -'CA' certificate. - -s_client -verify 1 -CAfile eay1024.PEM - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 -We loaded the certificates from the file eay1024.PEM. Everything -checked out and so we made the connection. - -s_client -verify 1 -CApath . - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 -We looked in out local directory for issuer certificates and 'found' -a8556381.0 and so everything is ok. - -It is worth noting that 'CA' is a self certified certificate. If you -are passed one of these, it will fail to 'verify' at depth 0 because -we need to lookup the certifier of a certificate from some information -that we trust and keep locally. - -SSL_CIPHER=CBC3-DES-MD5:RC4-MD5 -export SSL_CIPHER -s_client -verify 10 -CApath . -reconnect - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - drop the connection and reconnect with the same session id - CIPHER is CBC3-DES-MD5 -This has done a full connection and then re-estabished it with the -same session id but a new socket. No RSA stuff occures on the second -connection. Note that we said we would prefer to use CBC3-DES-MD5 -encryption and so, since the server supports it, we are. - -===== -s_server -This program accepts SSL connections on a specified port -Once connected, it will estabish an SSL connection and optionaly -attempt to authenticate the client. A 2 directional channel will be -open. Any text typed will be sent to the other end. Type Q<cr> to exit. -Flags are as follows. --port arg : Arg is the port to listen on. --verify arg : Turn on authentication of the client if they have a - : certificate. Arg specifies the 'depth'. --Verify arg : Turn on authentication of the client. If they don't - : have a valid certificate, drop the connection. --cert arg : The certificate to use. This certificate - : will be passed to the client. If it is not - : specified, it will default to server.PEM --key arg : The private key that matches the certificate - : specified by the -cert option. If this is not - : specified (but -cert is), the -cert file will be - : searched for the Private key. Both files are - : assumed to be in PEM format. Default is server.PEM --CApath arg : When to look for certificates when 'verifying' the - : certificate from the client. --CAfile arg : A file containing certificates to be used for - : 'verifying' the client certificate. - -For the following 'demo' I will specify the s_server command and -the s_client command and then list the output from the s_server. -s_server -s_client - CONNECTED - CIPHER is CBC-DES-MD5 -Everything up and running - -s_server -verify 0 -s_client - CONNECTED - CIPHER is CBC-DES-MD5 -Ok since no certificate was returned and we don't care. - -s_server -verify 0 -./s_client -cert client.PEM - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client - issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify error:num=1:unable to get issuer certificate - verify return:1 - CIPHER is CBC-DES-MD5 -Ok since we were only verifying to level 0 - -s_server -verify 4 -s_client -cert client.PEM - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client - issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify error:num=1:unable to get issuer certificate - verify return:0 - ERROR - verify error:unable to get issuer certificate -Bad because we could not authenticate the returned certificate. - -s_server -verify 4 -CApath . -s_client -cert client.PEM - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 -Ok because we could authenticate the returned certificate :-). - -s_server -Verify 0 -CApath . -s_client - CONNECTED - ERROR - SSL error:function is:REQUEST_CERTIFICATE - :error is :client end did not return a certificate -Error because no certificate returned. - -s_server -Verify 4 -CApath . -s_client -cert client.PEM - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 -Full authentication of the client. - -So in summary to do full authentication of both ends -s_server -Verify 9 -CApath . -s_client -cert client.PEM -CApath . -verify 9 -From the server side - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 -From the client side - CONNECTED - depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server - verify return:1 - depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA - verify return:1 - CIPHER is CBC-DES-MD5 - -For general probing of the 'internet https' servers for the -distribution area, run -s_client -host www.netscape.com -port 443 -verify 4 -CApath ../rsa/hash -Then enter -GET / -and you should be talking to the https server on that host. - -www.rsa.com was refusing to respond to connections on 443 when I was -testing. - -have fun :-). - -eric - -==== a_verify.doc ======================================================== - -From eay@mincom.com Fri Oct 4 18:29:06 1996 -Received: by orb.mincom.oz.au id AA29080 - (5.65c/IDA-1.4.4 for eay); Fri, 4 Oct 1996 08:29:07 +1000 -Date: Fri, 4 Oct 1996 08:29:06 +1000 (EST) -From: Eric Young <eay@mincom.oz.au> -X-Sender: eay@orb -To: wplatzer <wplatzer@iaik.tu-graz.ac.at> -Cc: Eric Young <eay@mincom.oz.au>, SSL Mailing List <ssl-users@mincom.com> -Subject: Re: Netscape's Public Key -In-Reply-To: <19961003134837.NTM0049@iaik.tu-graz.ac.at> -Message-Id: <Pine.SOL.3.91.961004081346.8018K-100000@orb> -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII -Status: RO -X-Status: - -On Thu, 3 Oct 1996, wplatzer wrote: -> I get Public Key from Netscape (Gold 3.0b4), but cannot do anything -> with it... It looks like (asn1parse): -> -> 0:d=0 hl=3 l=180 cons: SEQUENCE -> 3:d=1 hl=2 l= 96 cons: SEQUENCE -> 5:d=2 hl=2 l= 92 cons: SEQUENCE -> 7:d=3 hl=2 l= 13 cons: SEQUENCE -> 9:d=4 hl=2 l= 9 prim: OBJECT :rsaEncryption -> 20:d=4 hl=2 l= 0 prim: NULL -> 22:d=3 hl=2 l= 75 prim: BIT STRING -> 99:d=2 hl=2 l= 0 prim: IA5STRING : -> 101:d=1 hl=2 l= 13 cons: SEQUENCE -> 103:d=2 hl=2 l= 9 prim: OBJECT :md5withRSAEncryption -> 114:d=2 hl=2 l= 0 prim: NULL -> 116:d=1 hl=2 l= 65 prim: BIT STRING -> -> The first BIT STRING is the public key and the second BIT STRING is -> the signature. -> But a public key consists of the public exponent and the modulus. Are -> both numbers in the first BIT STRING? -> Is there a document simply describing this coding stuff (checking -> signature, get the public key, etc.)? - -Minimal in SSLeay. If you want to see what the modulus and exponent are, -try asn1parse -offset 25 -length 75 <key.pem -asn1parse will currently stuff up on the 'length 75' part (fixed in next -release) but it will print the stuff. If you are after more -documentation on ASN.1, have a look at www.rsa.com and get their PKCS -documents, most of my initial work on SSLeay was done using them. - -As for SSLeay, -util/crypto.num and util/ssl.num are lists of all exported functions in -the library (but not macros :-(. - -The ones for extracting public keys from certificates and certificate -requests are EVP_PKEY * X509_REQ_extract_key(X509_REQ *req); -EVP_PKEY * X509_extract_key(X509 *x509); - -To verify a signature on a signed ASN.1 object -int X509_verify(X509 *a,EVP_PKEY *key); -int X509_REQ_verify(X509_REQ *a,EVP_PKEY *key); -int X509_CRL_verify(X509_CRL *a,EVP_PKEY *key); -int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a,EVP_PKEY *key); - -I should mention that EVP_PKEY can be used to hold a public or a private key, -since for things like RSA and DSS, a public key is just a subset of what -is stored for the private key. - -To sign any of the above structures - -int X509_sign(X509 *a,EVP_PKEY *key,EVP_MD *md); -int X509_REQ_sign(X509_REQ *a,EVP_PKEY *key,EVP_MD *md); -int X509_CRL_sign(X509_CRL *a,EVP_PKEY *key,EVP_MD *md); -int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *a,EVP_PKEY *key,EVP_MD *md); - -where md is the message digest to sign with. - -There are all defined in x509.h and all the _sign and _verify functions are -actually macros to the ASN1_sign() and ASN1_verify() functions. -These functions will put the correct algorithm identifiers in the correct -places in the structures. - -eric --- -Eric Young | BOOL is tri-state according to Bill Gates. -AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). - -==== x509 ======================================================= - -X509_verify() -X509_sign() - -X509_get_version() -X509_get_serialNumber() -X509_get_issuer() -X509_get_subject() -X509_get_notBefore() -X509_get_notAfter() -X509_get_pubkey() - -X509_set_version() -X509_set_serialNumber() -X509_set_issuer() -X509_set_subject() -X509_set_notBefore() -X509_set_notAfter() -X509_set_pubkey() - -X509_get_extensions() -X509_set_extensions() - -X509_EXTENSIONS_clear() -X509_EXTENSIONS_retrieve() -X509_EXTENSIONS_add() -X509_EXTENSIONS_delete() - -==== x509 attribute ================================================ - -PKCS7 - STACK of X509_ATTRIBUTES - ASN1_OBJECT - STACK of ASN1_TYPE - -So it is - -p7.xa[].obj -p7.xa[].data[] - -get_obj_by_nid(STACK , nid) -get_num_by_nid(STACK , nid) -get_data_by_nid(STACK , nid, index) - -X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); -void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); - -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **ex, - int nid, STACK *value); - -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **ex, - int nid, STACK *value); - -int X509_ATTRIBUTE_set_object(X509_ATTRIBUTE *ex,ASN1_OBJECT *obj); -int X509_ATTRIBUTE_add_data(X509_ATTRIBUTE *ex, int index, - ASN1_TYPE *value); - -ASN1_OBJECT * X509_ATTRIBUTE_get_object(X509_ATTRIBUTE *ex); -int X509_ATTRIBUTE_get_num(X509_ATTRIBUTE *ne); -ASN1_TYPE * X509_ATTRIBUTE_get_data(X509_ATTRIBUTE *ne,int index); - -ASN1_TYPE * X509_ATTRIBUTE_get_data_by_NID(X509_ATTRIBUTE *ne, - ASN1_OBJECT *obj); - -X509_ATTRIBUTE *PKCS7_get_s_att_by_NID(PKCS7 *p7,int nid); -X509_ATTRIBUTE *PKCS7_get_u_att_by_NID(PKCS7 *p7,int nid); - -==== x509 v3 ======================================================== - -The 'new' system. - -The X509_EXTENSION_METHOD includes extensions and attributes and/or names. -Basically everthing that can be added to an X509 with an OID identifying it. - -It operates via 2 methods per object id. -int a2i_XXX(X509 *x,char *str,int len); -int i2a_XXX(BIO *bp,X509 *x); - -The a2i_XXX function will add the object with a value converted from the -string into the X509. Len can be -1 in which case the length is calculated -via strlen(str). Applications can always use direct knowledge to load and -unload the relevent objects themselves. - -i2a_XXX will print to the passed BIO, a text representation of the -relevet object. Use a memory BIO if you want it printed to a buffer :-). - -X509_add_by_NID(X509 *x,int nid,char *str,int len); -X509_add_by_OBJ(X509 *x,ASN1_OBJECT *obj,char *str,int len); - -X509_print_by_name(BIO *bp,X509 *x); -X509_print_by_NID(BIO *bp,X509 *x); -X509_print_by_OBJ(BIO *bp,X509 *x); - -==== verify ======================================================== - -X509_verify_cert_chain( - CERT_STORE *cert_store, - STACK /* X509 */ *certs, - int *verify_result, - int (*verify_error_callback)() - char *argument_to_callback, /* SSL */ - -app_verify_callback( - char *app_verify_arg, /* from SSL_CTX */ - STACK /* X509 */ *certs, - int *verify_result, - int (*verify_error_callback)() - SSL *s, - -int X509_verify_cert( - CERT_STORE *cert_store, - X509 *x509, - int *verify_result, - int (*verify_error_callback)(), - char *arg, - -==== apps.doc ======================================================== - -The applications - -Ok, where to begin.... -In the begining, when SSLeay was small (April 1995), there -were but few applications, they did happily cohabit in -the one bin directory. Then over time, they did multiply and grow, -and they started to look like microsoft software; 500k to print 'hello world'. -A new approach was needed. They were coalessed into one 'Monolithic' -application, ssleay. This one program is composed of many programs that -can all be compiled independantly. - -ssleay has 3 modes of operation. -1) If the ssleay binaray has the name of one of its component programs, it -executes that program and then exits. This can be achieve by using hard or -symbolic links, or failing that, just renaming the binary. -2) If the first argument to ssleay is the name of one of the component -programs, that program runs that program and then exits. -3) If there are no arguments, ssleay enters a 'command' mode. Each line is -interpreted as a program name plus arguments. After each 'program' is run, -ssleay returns to the comand line. - -dgst - message digests -enc - encryption and base64 encoding - -ans1parse - 'pulls' appart ASN.1 encoded objects like certificates. - -dh - Diffle-Hellman parameter manipulation. -rsa - RSA manipulations. -crl - Certificate revokion list manipulations -x509 - X509 cert fiddles, including signing. -pkcs7 - pkcs7 manipulation, only DER versions right now. - -genrsa - generate an RSA private key. -gendh - Generate a set of Diffle-Hellman parameters. -req - Generate a PKCS#10 object, a certificate request. - -s_client - SSL client program -s_server - SSL server program -s_time - A SSL protocol timing program -s_mult - Another SSL server, but it multiplexes - connections. -s_filter - under development - -errstr - Convert SSLeay error numbers to strings. -ca - Sign certificate requests, and generate - certificate revokion lists -crl2pkcs7 - put a crl and certifcates into a pkcs7 object. -speed - Benchmark the ciphers. -verify - Check certificates -hashdir - under development - -[ there a now a few more options, play with the program to see what they - are ] - -==== asn1.doc ======================================================== - -The ASN.1 Routines. - -ASN.1 is a specification for how to encode structured 'data' in binary form. -The approach I have take to the manipulation of structures and their encoding -into ASN.1 is as follows. - -For each distinct structure there are 4 function of the following form -TYPE *TYPE_new(void); -void TYPE_free(TYPE *); -TYPE *d2i_TYPE(TYPE **a,unsigned char **pp,long length); -long i2d_TYPE(TYPE *a,unsigned char **pp); /* CHECK RETURN VALUE */ - -where TYPE is the type of the 'object'. The TYPE that have these functions -can be in one of 2 forms, either the internal C malloc()ed data structure -or in the DER (a variant of ASN.1 encoding) binary encoding which is just -an array of unsigned bytes. The 'i2d' functions converts from the internal -form to the DER form and the 'd2i' functions convert from the DER form to -the internal form. - -The 'new' function returns a malloc()ed version of the structure with all -substructures either created or left as NULL pointers. For 'optional' -fields, they are normally left as NULL to indicate no value. For variable -size sub structures (often 'SET OF' or 'SEQUENCE OF' in ASN.1 syntax) the -STACK data type is used to hold the values. Have a read of stack.doc -and have a look at the relevant header files to see what I mean. If there -is an error while malloc()ing the structure, NULL is returned. - -The 'free' function will free() all the sub components of a particular -structure. If any of those sub components have been 'removed', replace -them with NULL pointers, the 'free' functions are tolerant of NULL fields. - -The 'd2i' function copies a binary representation into a C structure. It -operates as follows. 'a' is a pointer to a pointer to -the structure to populate, 'pp' is a pointer to a pointer to where the DER -byte string is located and 'length' is the length of the '*pp' data. -If there are no errors, a pointer to the populated structure is returned. -If there is an error, NULL is returned. Errors can occur because of -malloc() failures but normally they will be due to syntax errors in the DER -encoded data being parsed. It is also an error if there was an -attempt to read more that 'length' bytes from '*p'. If -everything works correctly, the value in '*p' is updated -to point at the location just beyond where the DER -structure was read from. In this way, chained calls to 'd2i' type -functions can be made, with the pointer into the 'data' array being -'walked' along the input byte array. -Depending on the value passed for 'a', different things will be done. If -'a' is NULL, a new structure will be malloc()ed and returned. If '*a' is -NULL, a new structure will be malloc()ed and put into '*a' and returned. -If '*a' is not NULL, the structure in '*a' will be populated, or in the -case of an error, free()ed and then returned. -Having these semantics means that a structure -can call a 'd2i' function to populate a field and if the field is currently -NULL, the structure will be created. - -The 'i2d' function type is used to copy a C structure to a byte array. -The parameter 'a' is the structure to convert and '*p' is where to put it. -As for the 'd2i' type structure, 'p' is updated to point after the last -byte written. If p is NULL, no data is written. The function also returns -the number of bytes written. Where this becomes useful is that if the -function is called with a NULL 'p' value, the length is returned. This can -then be used to malloc() an array of bytes and then the same function can -be recalled passing the malloced array to be written to. e.g. - -int len; -unsigned char *bytes,*p; -len=i2d_X509(x,NULL); /* get the size of the ASN1 encoding of 'x' */ -if ((bytes=(unsigned char *)malloc(len)) == NULL) - goto err; -p=bytes; -i2d_X509(x,&p); - -Please note that a new variable, 'p' was passed to i2d_X509. After the -call to i2d_X509 p has been incremented by len bytes. - -Now the reason for this functional organisation is that it allows nested -structures to be built up by calling these functions as required. There -are various macros used to help write the general 'i2d', 'd2i', 'new' and -'free' functions. They are discussed in another file and would only be -used by some-one wanting to add new structures to the library. As you -might be able to guess, the process of writing ASN.1 files can be a bit CPU -expensive for complex structures. I'm willing to live with this since the -simpler library code make my life easier and hopefully most programs using -these routines will have their execution profiles dominated by cipher or -message digest routines. -What follows is a list of 'TYPE' values and the corresponding ASN.1 -structure and where it is used. - -TYPE ASN.1 -ASN1_INTEGER INTEGER -ASN1_BIT_STRING BIT STRING -ASN1_OCTET_STRING OCTET STRING -ASN1_OBJECT OBJECT IDENTIFIER -ASN1_PRINTABLESTRING PrintableString -ASN1_T61STRING T61String -ASN1_IA5STRING IA5String -ASN1_UTCTIME UTCTime -ASN1_TYPE Any of the above mentioned types plus SEQUENCE and SET - -Most of the above mentioned types are actualled stored in the -ASN1_BIT_STRING type and macros are used to differentiate between them. -The 3 types used are - -typedef struct asn1_object_st - { - /* both null if a dynamic ASN1_OBJECT, one is - * defined if a 'static' ASN1_OBJECT */ - char *sn,*ln; - int nid; - int length; - unsigned char *data; - } ASN1_OBJECT; -This is used to store ASN1 OBJECTS. Read 'objects.doc' for details ono -routines to manipulate this structure. 'sn' and 'ln' are used to hold text -strings that represent the object (short name and long or lower case name). -These are used by the 'OBJ' library. 'nid' is a number used by the OBJ -library to uniquely identify objects. The ASN1 routines will populate the -'length' and 'data' fields which will contain the bit string representing -the object. - -typedef struct asn1_bit_string_st - { - int length; - int type; - unsigned char *data; - } ASN1_BIT_STRING; -This structure is used to hold all the other base ASN1 types except for -ASN1_UTCTIME (which is really just a 'char *'). Length is the number of -bytes held in data and type is the ASN1 type of the object (there is a list -in asn1.h). - -typedef struct asn1_type_st - { - int type; - union { - char *ptr; - ASN1_INTEGER * integer; - ASN1_BIT_STRING * bit_string; - ASN1_OCTET_STRING * octet_string; - ASN1_OBJECT * object; - ASN1_PRINTABLESTRING * printablestring; - ASN1_T61STRING * t61string; - ASN1_IA5STRING * ia5string; - ASN1_UTCTIME * utctime; - ASN1_BIT_STRING * set; - ASN1_BIT_STRING * sequence; - } value; - } ASN1_TYPE; -This structure is used in a few places when 'any' type of object can be -expected. - -X509 Certificate -X509_CINF CertificateInfo -X509_ALGOR AlgorithmIdentifier -X509_NAME Name -X509_NAME_ENTRY A single sub component of the name. -X509_VAL Validity -X509_PUBKEY SubjectPublicKeyInfo -The above mentioned types are declared in x509.h. They are all quite -straight forward except for the X509_NAME/X509_NAME_ENTRY pair. -A X509_NAME is a STACK (see stack.doc) of X509_NAME_ENTRY's. -typedef struct X509_name_entry_st - { - ASN1_OBJECT *object; - ASN1_BIT_STRING *value; - int set; - int size; /* temp variable */ - } X509_NAME_ENTRY; -The size is a temporary variable used by i2d_NAME and set is the set number -for the particular NAME_ENTRY. A X509_NAME is encoded as a sequence of -sequence of sets. Normally each set contains only a single item. -Sometimes it contains more. Normally throughout this library there will be -only one item per set. The set field contains the 'set' that this entry is -a member of. So if you have just created a X509_NAME structure and -populated it with X509_NAME_ENTRYs, you should then traverse the X509_NAME -(which is just a STACK) and set the 'set/' field to incrementing numbers. -For more details on why this is done, read the ASN.1 spec for Distinguished -Names. - -X509_REQ CertificateRequest -X509_REQ_INFO CertificateRequestInfo -These are used to hold certificate requests. - -X509_CRL CertificateRevocationList -These are used to hold a certificate revocation list - -RSAPrivateKey PrivateKeyInfo -RSAPublicKey PublicKeyInfo -Both these 'function groups' operate on 'RSA' structures (see rsa.doc). -The difference is that the RSAPublicKey operations only manipulate the m -and e fields in the RSA structure. - -DSAPrivateKey DSS private key -DSAPublicKey DSS public key -Both these 'function groups' operate on 'DSS' structures (see dsa.doc). -The difference is that the RSAPublicKey operations only manipulate the -XXX fields in the DSA structure. - -DHparams DHParameter -This is used to hold the p and g value for The Diffie-Hellman operation. -The function deal with the 'DH' strucure (see dh.doc). - -Now all of these function types can be used with several other functions to give -quite useful set of general manipulation routines. Normally one would -not uses these functions directly but use them via macros. - -char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); -'x' is the input structure case to a 'char *', 'i2d' is the 'i2d_TYPE' -function for the type that 'x' is and d2i is the 'd2i_TYPE' function for the -type that 'x' is. As is obvious from the parameters, this function -duplicates the strucutre by transforming it into the DER form and then -re-loading it into a new strucutre and returning the new strucutre. This -is obviously a bit cpu intensive but when faced with a complex dynamic -structure this is the simplest programming approach. There are macros for -duplicating the major data types but is simple to add extras. - -char *ASN1_d2i_fp(char *(*new)(),char *(*d2i)(),FILE *fp,unsigned char **x); -'x' is a pointer to a pointer of the 'desired type'. new and d2i are the -corresponding 'TYPE_new' and 'd2i_TYPE' functions for the type and 'fp' is -an open file pointer to read from. This function reads from 'fp' as much -data as it can and then uses 'd2i' to parse the bytes to load and return -the parsed strucutre in 'x' (if it was non-NULL) and to actually return the -strucutre. The behavior of 'x' is as per all the other d2i functions. - -char *ASN1_d2i_bio(char *(*new)(),char *(*d2i)(),BIO *fp,unsigned char **x); -The 'BIO' is the new IO type being used in SSLeay (see bio.doc). This -function is the same as ASN1_d2i_fp() except for the BIO argument. -ASN1_d2i_fp() actually calls this function. - -int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); -'x' is converted to bytes by 'i2d' and then written to 'out'. ASN1_i2d_fp -and ASN1_d2i_fp are not really symetric since ASN1_i2d_fp will read all -available data from the file pointer before parsing a single item while -ASN1_i2d_fp can be used to write a sequence of data objects. To read a -series of objects from a file I would sugest loading the file into a buffer -and calling the relevent 'd2i' functions. - -char *ASN1_d2i_bio(char *(*new)(),char *(*d2i)(),BIO *fp,unsigned char **x); -This function is the same as ASN1_i2d_fp() except for the BIO argument. -ASN1_i2d_fp() actually calls this function. - -char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x,int (*cb)()); -This function will read the next PEM encoded (base64) object of the same -type as 'x' (loaded by the d2i function). 'name' is the name that is in -the '-----BEGIN name-----' that designates the start of that object type. -If the data is encrypted, 'cb' will be called to prompt for a password. If -it is NULL a default function will be used to prompt from the password. -'x' is delt with as per the standard 'd2i' function interface. This -function can be used to read a series of objects from a file. While any -data type can be encrypted (see PEM_ASN1_write) only RSA private keys tend -to be encrypted. - -char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *fp, - char **x,int (*cb)()); -Same as PEM_ASN1_read() except using a BIO. This is called by -PEM_ASN1_read(). - -int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x,EVP_CIPHER *enc, - unsigned char *kstr,int klen,int (*callback)()); - -int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *fp, - char *x,EVP_CIPHER *enc,unsigned char *kstr,int klen, - int (*callback)()); - -int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, - ASN1_BIT_STRING *signature, char *data, RSA *rsa, EVP_MD *type); -int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, - ASN1_BIT_STRING *signature,char *data, RSA *rsa); - -int ASN1_BIT_STRING_cmp(ASN1_BIT_STRING *a, ASN1_BIT_STRING *b); -ASN1_BIT_STRING *ASN1_BIT_STRING_type_new(int type ); - -int ASN1_UTCTIME_check(ASN1_UTCTIME *a); -void ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); -ASN1_UTCTIME *ASN1_UTCTIME_dup(ASN1_UTCTIME *a); - -ASN1_BIT_STRING *d2i_asn1_print_type(ASN1_BIT_STRING **a,unsigned char **pp, - long length,int type); - -int i2d_ASN1_SET(STACK *a, unsigned char **pp, - int (*func)(), int ex_tag, int ex_class); -STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, - char *(*func)(), int ex_tag, int ex_class); - -int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *object); -int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); -int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); - -int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); -long ASN1_INTEGER_get(ASN1_INTEGER *a); -ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); -BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); - -/* given a string, return the correct type. Max is the maximum number - * of bytes to parse. It stops parsing when 'max' bytes have been - * processed or a '\0' is hit */ -int ASN1_PRINTABLE_type(unsigned char *s,int max); - -void ASN1_parse(BIO *fp,unsigned char *pp,long len); - -int i2d_ASN1_bytes(ASN1_BIT_STRING *a, unsigned char **pp, int tag, int class); -ASN1_BIT_STRING *d2i_ASN1_bytes(ASN1_OCTET_STRING **a, unsigned char **pp, - long length, int Ptag, int Pclass); - -/* PARSING */ -int asn1_Finish(ASN1_CTX *c); - -/* SPECIALS */ -int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax); -int ASN1_check_infinite_end(unsigned char **p,long len); -void ASN1_put_object(unsigned char **pp, int constructed, int length, - int tag, int class); -int ASN1_object_size(int constructed, int length, int tag); - -X509 * X509_get_cert(CERTIFICATE_CTX *ctx,X509_NAME * name,X509 *tmp_x509); -int X509_add_cert(CERTIFICATE_CTX *ctx,X509 *); - -char * X509_cert_verify_error_string(int n); -int X509_add_cert_file(CERTIFICATE_CTX *c,char *file, int type); -char * X509_gmtime (char *s, long adj); -int X509_add_cert_dir (CERTIFICATE_CTX *c,char *dir, int type); -int X509_load_verify_locations (CERTIFICATE_CTX *ctx, - char *file_env, char *dir_env); -int X509_set_default_verify_paths(CERTIFICATE_CTX *cts); -X509 * X509_new_D2i_X509(int len, unsigned char *p); -char * X509_get_default_cert_area(void ); -char * X509_get_default_cert_dir(void ); -char * X509_get_default_cert_file(void ); -char * X509_get_default_cert_dir_env(void ); -char * X509_get_default_cert_file_env(void ); -char * X509_get_default_private_dir(void ); -X509_REQ *X509_X509_TO_req(X509 *x, RSA *rsa); -int X509_cert_verify(CERTIFICATE_CTX *ctx,X509 *xs, int (*cb)()); - -CERTIFICATE_CTX *CERTIFICATE_CTX_new(); -void CERTIFICATE_CTX_free(CERTIFICATE_CTX *c); - -void X509_NAME_print(BIO *fp, X509_NAME *name, int obase); -int X509_print_fp(FILE *fp,X509 *x); -int X509_print(BIO *fp,X509 *x); - -X509_INFO * X509_INFO_new(void); -void X509_INFO_free(X509_INFO *a); - -char * X509_NAME_oneline(X509_NAME *a); - -#define X509_verify(x,rsa) -#define X509_REQ_verify(x,rsa) -#define X509_CRL_verify(x,rsa) - -#define X509_sign(x,rsa,md) -#define X509_REQ_sign(x,rsa,md) -#define X509_CRL_sign(x,rsa,md) - -#define X509_dup(x509) -#define d2i_X509_fp(fp,x509) -#define i2d_X509_fp(fp,x509) -#define d2i_X509_bio(bp,x509) -#define i2d_X509_bio(bp,x509) - -#define X509_CRL_dup(crl) -#define d2i_X509_CRL_fp(fp,crl) -#define i2d_X509_CRL_fp(fp,crl) -#define d2i_X509_CRL_bio(bp,crl) -#define i2d_X509_CRL_bio(bp,crl) - -#define X509_REQ_dup(req) -#define d2i_X509_REQ_fp(fp,req) -#define i2d_X509_REQ_fp(fp,req) -#define d2i_X509_REQ_bio(bp,req) -#define i2d_X509_REQ_bio(bp,req) - -#define RSAPrivateKey_dup(rsa) -#define d2i_RSAPrivateKey_fp(fp,rsa) -#define i2d_RSAPrivateKey_fp(fp,rsa) -#define d2i_RSAPrivateKey_bio(bp,rsa) -#define i2d_RSAPrivateKey_bio(bp,rsa) - -#define X509_NAME_dup(xn) -#define X509_NAME_ENTRY_dup(ne) - -void X509_REQ_print_fp(FILE *fp,X509_REQ *req); -void X509_REQ_print(BIO *fp,X509_REQ *req); - -RSA *X509_REQ_extract_key(X509_REQ *req); -RSA *X509_extract_key(X509 *x509); - -int X509_issuer_and_serial_cmp(X509 *a, X509 *b); -unsigned long X509_issuer_and_serial_hash(X509 *a); - -X509_NAME * X509_get_issuer_name(X509 *a); -int X509_issuer_name_cmp(X509 *a, X509 *b); -unsigned long X509_issuer_name_hash(X509 *a); - -X509_NAME * X509_get_subject_name(X509 *a); -int X509_subject_name_cmp(X509 *a,X509 *b); -unsigned long X509_subject_name_hash(X509 *x); - -int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); -unsigned long X509_NAME_hash(X509_NAME *x); - - -==== bio.doc ======================================================== - -BIO Routines - -This documentation is rather sparse, you are probably best -off looking at the code for specific details. - -The BIO library is a IO abstraction that was originally -inspired by the need to have callbacks to perform IO to FILE -pointers when using Windows 3.1 DLLs. There are two types -of BIO; a source/sink type and a filter type. -The source/sink methods are as follows: -- BIO_s_mem() memory buffer - a read/write byte array that - grows until memory runs out :-). -- BIO_s_file() FILE pointer - A wrapper around the normal - 'FILE *' commands, good for use with stdin/stdout. -- BIO_s_fd() File descriptor - A wrapper around file - descriptors, often used with pipes. -- BIO_s_socket() Socket - Used around sockets. It is - mostly in the Microsoft world that sockets are different - from file descriptors and there are all those ugly winsock - commands. -- BIO_s_null() Null - read nothing and write nothing.; a - useful endpoint for filter type BIO's specifically things - like the message digest BIO. - -The filter types are -- BIO_f_buffer() IO buffering - does output buffering into - larger chunks and performs input buffering to allow gets() - type functions. -- BIO_f_md() Message digest - a transparent filter that can - be asked to return a message digest for the data that has - passed through it. -- BIO_f_cipher() Encrypt or decrypt all data passing - through the filter. -- BIO_f_base64() Base64 decode on read and encode on write. -- BIO_f_ssl() A filter that performs SSL encryption on the - data sent through it. - -Base BIO functions. -The BIO library has a set of base functions that are -implemented for each particular type. Filter BIOs will -normally call the equivalent function on the source/sink BIO -that they are layered on top of after they have performed -some modification to the data stream. Multiple filter BIOs -can be 'push' into a stack of modifers, so to read from a -file, unbase64 it, then decrypt it, a BIO_f_cipher, -BIO_f_base64 and a BIO_s_file would probably be used. If a -sha-1 and md5 message digest needed to be generated, a stack -two BIO_f_md() BIOs and a BIO_s_null() BIO could be used. -The base functions are -- BIO *BIO_new(BIO_METHOD *type); Create a new BIO of type 'type'. -- int BIO_free(BIO *a); Free a BIO structure. Depending on - the configuration, this will free the underlying data - object for a source/sink BIO. -- int BIO_read(BIO *b, char *data, int len); Read upto 'len' - bytes into 'data'. -- int BIO_gets(BIO *bp,char *buf, int size); Depending on - the BIO, this can either be a 'get special' or a get one - line of data, as per fgets(); -- int BIO_write(BIO *b, char *data, int len); Write 'len' - bytes from 'data' to the 'b' BIO. -- int BIO_puts(BIO *bp,char *buf); Either a 'put special' or - a write null terminated string as per fputs(). -- long BIO_ctrl(BIO *bp,int cmd,long larg,char *parg); A - control function which is used to manipulate the BIO - structure and modify it's state and or report on it. This - function is just about never used directly, rather it - should be used in conjunction with BIO_METHOD specific - macros. -- BIO *BIO_push(BIO *new_top, BIO *old); new_top is apped to the - top of the 'old' BIO list. new_top should be a filter BIO. - All writes will go through 'new_top' first and last on read. - 'old' is returned. -- BIO *BIO_pop(BIO *bio); the new topmost BIO is returned, NULL if - there are no more. - -If a particular low level BIO method is not supported -(normally BIO_gets()), -2 will be returned if that method is -called. Otherwise the IO methods (read, write, gets, puts) -will return the number of bytes read or written, and 0 or -1 -for error (or end of input). For the -1 case, -BIO_should_retry(bio) can be called to determine if it was a -genuine error or a temporary problem. -2 will also be -returned if the BIO has not been initalised yet, in all -cases, the correct error codes are set (accessible via the -ERR library). - - -The following functions are convenience functions: -- int BIO_printf(BIO *bio, char * format, ..); printf but - to a BIO handle. -- long BIO_ctrl_int(BIO *bp,int cmd,long larg,int iarg); a - convenience function to allow a different argument types - to be passed to BIO_ctrl(). -- int BIO_dump(BIO *b,char *bytes,int len); output 'len' - bytes from 'bytes' in a hex dump debug format. -- long BIO_debug_callback(BIO *bio, int cmd, char *argp, int - argi, long argl, long ret) - a default debug BIO callback, - this is mentioned below. To use this one normally has to - use the BIO_set_callback_arg() function to assign an - output BIO for the callback to use. -- BIO *BIO_find_type(BIO *bio,int type); when there is a 'stack' - of BIOs, this function scan the list and returns the first - that is of type 'type', as listed in buffer.h under BIO_TYPE_XXX. -- void BIO_free_all(BIO *bio); Free the bio and all other BIOs - in the list. It walks the bio->next_bio list. - - - -Extra commands are normally implemented as macros calling BIO_ctrl(). -- BIO_number_read(BIO *bio) - the number of bytes processed - by BIO_read(bio,.). -- BIO_number_written(BIO *bio) - the number of bytes written - by BIO_write(bio,.). -- BIO_reset(BIO *bio) - 'reset' the BIO. -- BIO_eof(BIO *bio) - non zero if we are at the current end - of input. -- BIO_set_close(BIO *bio, int close_flag) - set the close flag. -- BIO_get_close(BIO *bio) - return the close flag. - BIO_pending(BIO *bio) - return the number of bytes waiting - to be read (normally buffered internally). -- BIO_flush(BIO *bio) - output any data waiting to be output. -- BIO_should_retry(BIO *io) - after a BIO_read/BIO_write - operation returns 0 or -1, a call to this function will - return non zero if you should retry the call later (this - is for non-blocking IO). -- BIO_should_read(BIO *io) - we should retry when data can - be read. -- BIO_should_write(BIO *io) - we should retry when data can - be written. -- BIO_method_name(BIO *io) - return a string for the method name. -- BIO_method_type(BIO *io) - return the unique ID of the BIO method. -- BIO_set_callback(BIO *io, long (*callback)(BIO *io, int - cmd, char *argp, int argi, long argl, long ret); - sets - the debug callback. -- BIO_get_callback(BIO *io) - return the assigned function - as mentioned above. -- BIO_set_callback_arg(BIO *io, char *arg) - assign some - data against the BIO. This is normally used by the debug - callback but could in reality be used for anything. To - get an idea of how all this works, have a look at the code - in the default debug callback mentioned above. The - callback can modify the return values. - -Details of the BIO_METHOD structure. -typedef struct bio_method_st - { - int type; - char *name; - int (*bwrite)(); - int (*bread)(); - int (*bputs)(); - int (*bgets)(); - long (*ctrl)(); - int (*create)(); - int (*destroy)(); - } BIO_METHOD; - -The 'type' is the numeric type of the BIO, these are listed in buffer.h; -'Name' is a textual representation of the BIO 'type'. -The 7 function pointers point to the respective function -methods, some of which can be NULL if not implemented. -The BIO structure -typedef struct bio_st - { - BIO_METHOD *method; - long (*callback)(BIO * bio, int mode, char *argp, int - argi, long argl, long ret); - char *cb_arg; /* first argument for the callback */ - int init; - int shutdown; - int flags; /* extra storage */ - int num; - char *ptr; - struct bio_st *next_bio; /* used by filter BIOs */ - int references; - unsigned long num_read; - unsigned long num_write; - } BIO; - -- 'Method' is the BIO method. -- 'callback', when configured, is called before and after - each BIO method is called for that particular BIO. This - is intended primarily for debugging and of informational feedback. -- 'init' is 0 when the BIO can be used for operation. - Often, after a BIO is created, a number of operations may - need to be performed before it is available for use. An - example is for BIO_s_sock(). A socket needs to be - assigned to the BIO before it can be used. -- 'shutdown', this flag indicates if the underlying - comunication primative being used should be closed/freed - when the BIO is closed. -- 'flags' is used to hold extra state. It is primarily used - to hold information about why a non-blocking operation - failed and to record startup protocol information for the - SSL BIO. -- 'num' and 'ptr' are used to hold instance specific state - like file descriptors or local data structures. -- 'next_bio' is used by filter BIOs to hold the pointer of the - next BIO in the chain. written data is sent to this BIO and - data read is taken from it. -- 'references' is used to indicate the number of pointers to - this structure. This needs to be '1' before a call to - BIO_free() is made if the BIO_free() function is to - actually free() the structure, otherwise the reference - count is just decreased. The actual BIO subsystem does - not really use this functionality but it is useful when - used in more advanced applicaion. -- num_read and num_write are the total number of bytes - read/written via the 'read()' and 'write()' methods. - -BIO_ctrl operations. -The following is the list of standard commands passed as the -second parameter to BIO_ctrl() and should be supported by -all BIO as best as possible. Some are optional, some are -manditory, in any case, where is makes sense, a filter BIO -should pass such requests to underlying BIO's. -- BIO_CTRL_RESET - Reset the BIO back to an initial state. -- BIO_CTRL_EOF - return 0 if we are not at the end of input, - non 0 if we are. -- BIO_CTRL_INFO - BIO specific special command, normal - information return. -- BIO_CTRL_SET - set IO specific parameter. -- BIO_CTRL_GET - get IO specific parameter. -- BIO_CTRL_GET_CLOSE - Get the close on BIO_free() flag, one - of BIO_CLOSE or BIO_NOCLOSE. -- BIO_CTRL_SET_CLOSE - Set the close on BIO_free() flag. -- BIO_CTRL_PENDING - Return the number of bytes available - for instant reading -- BIO_CTRL_FLUSH - Output pending data, return number of bytes output. -- BIO_CTRL_SHOULD_RETRY - After an IO error (-1 returned) - should we 'retry' when IO is possible on the underlying IO object. -- BIO_CTRL_RETRY_TYPE - What kind of IO are we waiting on. - -The following command is a special BIO_s_file() specific option. -- BIO_CTRL_SET_FILENAME - specify a file to open for IO. - -The BIO_CTRL_RETRY_TYPE needs a little more explanation. -When performing non-blocking IO, or say reading on a memory -BIO, when no data is present (or cannot be written), -BIO_read() and/or BIO_write() will return -1. -BIO_should_retry(bio) will return true if this is due to an -IO condition rather than an actual error. In the case of -BIO_s_mem(), a read when there is no data will return -1 and -a should retry when there is more 'read' data. -The retry type is deduced from 2 macros -BIO_should_read(bio) and BIO_should_write(bio). -Now while it may appear obvious that a BIO_read() failure -should indicate that a retry should be performed when more -read data is available, this is often not true when using -things like an SSL BIO. During the SSL protocol startup -multiple reads and writes are performed, triggered by any -SSL_read or SSL_write. -So to write code that will transparently handle either a -socket or SSL BIO, - i=BIO_read(bio,..) - if (I == -1) - { - if (BIO_should_retry(bio)) - { - if (BIO_should_read(bio)) - { - /* call us again when BIO can be read */ - } - if (BIO_should_write(bio)) - { - /* call us again when BIO can be written */ - } - } - } - -At this point in time only read and write conditions can be -used but in the future I can see the situation for other -conditions, specifically with SSL there could be a condition -of a X509 certificate lookup taking place and so the non- -blocking BIO_read would require a retry when the certificate -lookup subsystem has finished it's lookup. This is all -makes more sense and is easy to use in a event loop type -setup. -When using the SSL BIO, either SSL_read() or SSL_write()s -can be called during the protocol startup and things will -still work correctly. -The nice aspect of the use of the BIO_should_retry() macro -is that all the errno codes that indicate a non-fatal error -are encapsulated in one place. The Windows specific error -codes and WSAGetLastError() calls are also hidden from the -application. - -Notes on each BIO method. -Normally buffer.h is just required but depending on the -BIO_METHOD, ssl.h or evp.h will also be required. - -BIO_METHOD *BIO_s_mem(void); -- BIO_set_mem_buf(BIO *bio, BUF_MEM *bm, int close_flag) - - set the underlying BUF_MEM structure for the BIO to use. -- BIO_get_mem_ptr(BIO *bio, char **pp) - if pp is not NULL, - set it to point to the memory array and return the number - of bytes available. -A read/write BIO. Any data written is appended to the -memory array and any read is read from the front. This BIO -can be used for read/write at the same time. BIO_gets() is -supported in the fgets() sense. -BIO_CTRL_INFO can be used to retrieve pointers to the memory -buffer and it's length. - -BIO_METHOD *BIO_s_file(void); -- BIO_set_fp(BIO *bio, FILE *fp, int close_flag) - set 'FILE *' to use. -- BIO_get_fp(BIO *bio, FILE **fp) - get the 'FILE *' in use. -- BIO_read_filename(BIO *bio, char *name) - read from file. -- BIO_write_filename(BIO *bio, char *name) - write to file. -- BIO_append_filename(BIO *bio, char *name) - append to file. -This BIO sits over the normal system fread()/fgets() type -functions. Gets() is supported. This BIO in theory could be -used for read and write but it is best to think of each BIO -of this type as either a read or a write BIO, not both. - -BIO_METHOD *BIO_s_socket(void); -BIO_METHOD *BIO_s_fd(void); -- BIO_sock_should_retry(int i) - the underlying function - used to determine if a call should be retried; the - argument is the '0' or '-1' returned by the previous BIO - operation. -- BIO_fd_should_retry(int i) - same as the -- BIO_sock_should_retry() except that it is different internally. -- BIO_set_fd(BIO *bio, int fd, int close_flag) - set the - file descriptor to use -- BIO_get_fd(BIO *bio, int *fd) - get the file descriptor. -These two methods are very similar. Gets() is not -supported, if you want this functionality, put a -BIO_f_buffer() onto it. This BIO is bi-directional if the -underlying file descriptor is. This is normally the case -for sockets but not the case for stdio descriptors. - -BIO_METHOD *BIO_s_null(void); -Read and write as much data as you like, it all disappears -into this BIO. - -BIO_METHOD *BIO_f_buffer(void); -- BIO_get_buffer_num_lines(BIO *bio) - return the number of - complete lines in the buffer. -- BIO_set_buffer_size(BIO *bio, long size) - set the size of - the buffers. -This type performs input and output buffering. It performs -both at the same time. The size of the buffer can be set -via the set buffer size option. Data buffered for output is -only written when the buffer fills. - -BIO_METHOD *BIO_f_ssl(void); -- BIO_set_ssl(BIO *bio, SSL *ssl, int close_flag) - the SSL - structure to use. -- BIO_get_ssl(BIO *bio, SSL **ssl) - get the SSL structure - in use. -The SSL bio is a little different from normal BIOs because -the underlying SSL structure is a little different. A SSL -structure performs IO via a read and write BIO. These can -be different and are normally set via the -SSL_set_rbio()/SSL_set_wbio() calls. The SSL_set_fd() calls -are just wrappers that create socket BIOs and then call -SSL_set_bio() where the read and write BIOs are the same. -The BIO_push() operation makes the SSLs IO BIOs the same, so -make sure the BIO pushed is capable of two directional -traffic. If it is not, you will have to install the BIOs -via the more conventional SSL_set_bio() call. BIO_pop() will retrieve -the 'SSL read' BIO. - -BIO_METHOD *BIO_f_md(void); -- BIO_set_md(BIO *bio, EVP_MD *md) - set the message digest - to use. -- BIO_get_md(BIO *bio, EVP_MD **mdp) - return the digest - method in use in mdp, return 0 if not set yet. -- BIO_reset() reinitializes the digest (EVP_DigestInit()) - and passes the reset to the underlying BIOs. -All data read or written via BIO_read() or BIO_write() to -this BIO will be added to the calculated digest. This -implies that this BIO is only one directional. If read and -write operations are performed, two separate BIO_f_md() BIOs -are reuqired to generate digests on both the input and the -output. BIO_gets(BIO *bio, char *md, int size) will place the -generated digest into 'md' and return the number of bytes. -The EVP_MAX_MD_SIZE should probably be used to size the 'md' -array. Reading the digest will also reset it. - -BIO_METHOD *BIO_f_cipher(void); -- BIO_reset() reinitializes the cipher. -- BIO_flush() should be called when the last bytes have been - output to flush the final block of block ciphers. -- BIO_get_cipher_status(BIO *b), when called after the last - read from a cipher BIO, returns non-zero if the data - decrypted correctly, otherwise, 0. -- BIO_set_cipher(BIO *b, EVP_CIPHER *c, unsigned char *key, - unsigned char *iv, int encrypt) This function is used to - setup a cipher BIO. The length of key and iv are - specified by the choice of EVP_CIPHER. Encrypt is 1 to - encrypt and 0 to decrypt. - -BIO_METHOD *BIO_f_base64(void); -- BIO_flush() should be called when the last bytes have been output. -This BIO base64 encodes when writing and base64 decodes when -reading. It will scan the input until a suitable begin line -is found. After reading data, BIO_reset() will reset the -BIO to start scanning again. Do not mix reading and writing -on the same base64 BIO. It is meant as a single stream BIO. - -Directions type -both BIO_s_mem() -one/both BIO_s_file() -both BIO_s_fd() -both BIO_s_socket() -both BIO_s_null() -both BIO_f_buffer() -one BIO_f_md() -one BIO_f_cipher() -one BIO_f_base64() -both BIO_f_ssl() - -It is easy to mix one and two directional BIOs, all one has -to do is to keep two separate BIO pointers for reading and -writing and be careful about usage of underlying BIOs. The -SSL bio by it's very nature has to be two directional but -the BIO_push() command will push the one BIO into the SSL -BIO for both reading and writing. - -The best example program to look at is apps/enc.c and/or perhaps apps/dgst.c. - - -==== blowfish.doc ======================================================== - -The Blowfish library. - -Blowfish is a block cipher that operates on 64bit (8 byte) quantities. It -uses variable size key, but 128bit (16 byte) key would normally be considered -good. It can be used in all the modes that DES can be used. This -library implements the ecb, cbc, cfb64, ofb64 modes. - -Blowfish is quite a bit faster that DES, and much faster than IDEA or -RC2. It is one of the faster block ciphers. - -For all calls that have an 'input' and 'output' variables, they can be the -same. - -This library requires the inclusion of 'blowfish.h'. - -All of the encryption functions take what is called an BF_KEY as an -argument. An BF_KEY is an expanded form of the Blowfish key. -For all modes of the Blowfish algorithm, the BF_KEY used for -decryption is the same one that was used for encryption. - -The define BF_ENCRYPT is passed to specify encryption for the functions -that require an encryption/decryption flag. BF_DECRYPT is passed to -specify decryption. - -Please note that any of the encryption modes specified in my DES library -could be used with Blowfish. I have only implemented ecb, cbc, cfb64 and -ofb64 for the following reasons. -- ecb is the basic Blowfish encryption. -- cbc is the normal 'chaining' form for block ciphers. -- cfb64 can be used to encrypt single characters, therefore input and output - do not need to be a multiple of 8. -- ofb64 is similar to cfb64 but is more like a stream cipher, not as - secure (not cipher feedback) but it does not have an encrypt/decrypt mode. -- If you want triple Blowfish, thats 384 bits of key and you must be totally - obsessed with security. Still, if you want it, it is simple enough to - copy the function from the DES library and change the des_encrypt to - BF_encrypt; an exercise left for the paranoid reader :-). - -The functions are as follows: - -void BF_set_key( -BF_KEY *ks; -int len; -unsigned char *key; - BF_set_key converts an 'len' byte key into a BF_KEY. - A 'ks' is an expanded form of the 'key' which is used to - perform actual encryption. It can be regenerated from the Blowfish key - so it only needs to be kept when encryption or decryption is about - to occur. Don't save or pass around BF_KEY's since they - are CPU architecture dependent, 'key's are not. Blowfish is an - interesting cipher in that it can be used with a variable length - key. 'len' is the length of 'key' to be used as the key. - A 'len' of 16 is recomended by me, but blowfish can use upto - 72 bytes. As a warning, blowfish has a very very slow set_key - function, it actually runs BF_encrypt 521 times. - -void BF_encrypt(unsigned long *data, BF_KEY *key); -void BF_decrypt(unsigned long *data, BF_KEY *key); - These are the Blowfish encryption function that gets called by just - about every other Blowfish routine in the library. You should not - use this function except to implement 'modes' of Blowfish. - I say this because the - functions that call this routine do the conversion from 'char *' to - long, and this needs to be done to make sure 'non-aligned' memory - access do not occur. - Data is a pointer to 2 unsigned long's and key is the - BF_KEY to use. - -void BF_ecb_encrypt( -unsigned char *in, -unsigned char *out, -BF_KEY *key, -int encrypt); - This is the basic Electronic Code Book form of Blowfish (in DES this - mode is called Electronic Code Book so I'm going to use the term - for blowfish as well. - Input is encrypted into output using the key represented by - key. Depending on the encrypt, encryption or - decryption occurs. Input is 8 bytes long and output is 8 bytes. - -void BF_cbc_encrypt( -unsigned char *in, -unsigned char *out, -long length, -BF_KEY *ks, -unsigned char *ivec, -int encrypt); - This routine implements Blowfish in Cipher Block Chaining mode. - Input, which should be a multiple of 8 bytes is encrypted - (or decrypted) to output which will also be a multiple of 8 bytes. - The number of bytes is in length (and from what I've said above, - should be a multiple of 8). If length is not a multiple of 8, bad - things will probably happen. ivec is the initialisation vector. - This function updates iv after each call so that it can be passed to - the next call to BF_cbc_encrypt(). - -void BF_cfb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -BF_KEY *schedule, -unsigned char *ivec, -int *num, -int encrypt); - This is one of the more useful functions in this Blowfish library, it - implements CFB mode of Blowfish with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - 'Encrypt' is used to indicate encryption or decryption. - CFB64 mode operates by using the cipher to generate a stream - of bytes which is used to encrypt the plain text. - The cipher text is then encrypted to generate the next 64 bits to - be xored (incrementally) with the next 64 bits of plain - text. As can be seen from this, to encrypt or decrypt, - the same 'cipher stream' needs to be generated but the way the next - block of data is gathered for encryption is different for - encryption and decryption. - -void BF_ofb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -BF_KEY *schedule, -unsigned char *ivec, -int *num); - This functions implements OFB mode of Blowfish with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - This is in effect a stream cipher, there is no encryption or - decryption mode. - -For reading passwords, I suggest using des_read_pw_string() from my DES library. -To generate a password from a text string, I suggest using MD5 (or MD2) to -produce a 16 byte message digest that can then be passed directly to -BF_set_key(). - -===== -For more information about the specific Blowfish modes in this library -(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the -documentation on my DES library. What is said about DES is directly -applicable for Blowfish. - - -==== bn.doc ======================================================== - -The Big Number library. - -#include "bn.h" when using this library. - -This big number library was written for use in implementing the RSA and DH -public key encryption algorithms. As such, features such as negative -numbers have not been extensively tested but they should work as expected. -This library uses dynamic memory allocation for storing its data structures -and so there are no limit on the size of the numbers manipulated by these -routines but there is always the requirement to check return codes from -functions just in case a memory allocation error has occurred. - -The basic object in this library is a BIGNUM. It is used to hold a single -large integer. This type should be considered opaque and fields should not -be modified or accessed directly. -typedef struct bignum_st - { - int top; /* Index of last used d. */ - BN_ULONG *d; /* Pointer to an array of 'BITS2' bit chunks. */ - int max; /* Size of the d array. */ - int neg; - } BIGNUM; -The big number is stored in a malloced array of BN_ULONG's. A BN_ULONG can -be either 16, 32 or 64 bits in size, depending on the 'number of bits' -specified in bn.h. -The 'd' field is this array. 'max' is the size of the 'd' array that has -been allocated. 'top' is the 'last' entry being used, so for a value of 4, -bn.d[0]=4 and bn.top=1. 'neg' is 1 if the number is negative. -When a BIGNUM is '0', the 'd' field can be NULL and top == 0. - -Various routines in this library require the use of 'temporary' BIGNUM -variables during their execution. Due to the use of dynamic memory -allocation to create BIGNUMs being rather expensive when used in -conjunction with repeated subroutine calls, the BN_CTX structure is -used. This structure contains BN_CTX BIGNUMs. BN_CTX -is the maximum number of temporary BIGNUMs any publicly exported -function will use. - -#define BN_CTX 12 -typedef struct bignum_ctx - { - int tos; /* top of stack */ - BIGNUM *bn[BN_CTX]; /* The variables */ - } BN_CTX; - -The functions that follow have been grouped according to function. Most -arithmetic functions return a result in the first argument, sometimes this -first argument can also be an input parameter, sometimes it cannot. These -restrictions are documented. - -extern BIGNUM *BN_value_one; -There is one variable defined by this library, a BIGNUM which contains the -number 1. This variable is useful for use in comparisons and assignment. - -Get Size functions. - -int BN_num_bits(BIGNUM *a); - This function returns the size of 'a' in bits. - -int BN_num_bytes(BIGNUM *a); - This function (macro) returns the size of 'a' in bytes. - For conversion of BIGNUMs to byte streams, this is the number of - bytes the output string will occupy. If the output byte - format specifies that the 'top' bit indicates if the number is - signed, so an extra '0' byte is required if the top bit on a - positive number is being written, it is upto the application to - make this adjustment. Like I said at the start, I don't - really support negative numbers :-). - -Creation/Destruction routines. - -BIGNUM *BN_new(); - Return a new BIGNUM object. The number initially has a value of 0. If - there is an error, NULL is returned. - -void BN_free(BIGNUM *a); - Free()s a BIGNUM. - -void BN_clear(BIGNUM *a); - Sets 'a' to a value of 0 and also zeros all unused allocated - memory. This function is used to clear a variable of 'sensitive' - data that was held in it. - -void BN_clear_free(BIGNUM *a); - This function zeros the memory used by 'a' and then free()'s it. - This function should be used to BN_free() BIGNUMS that have held - sensitive numeric values like RSA private key values. Both this - function and BN_clear tend to only be used by RSA and DH routines. - -BN_CTX *BN_CTX_new(void); - Returns a new BN_CTX. NULL on error. - -void BN_CTX_free(BN_CTX *c); - Free a BN_CTX structure. The BIGNUMs in 'c' are BN_clear_free()ed. - -BIGNUM *bn_expand(BIGNUM *b, int bits); - This is an internal function that should not normally be used. It - ensures that 'b' has enough room for a 'bits' bit number. It is - mostly used by the various BIGNUM routines. If there is an error, - NULL is returned. if not, 'b' is returned. - -BIGNUM *BN_copy(BIGNUM *to, BIGNUM *from); - The 'from' is copied into 'to'. NULL is returned if there is an - error, otherwise 'to' is returned. - -BIGNUM *BN_dup(BIGNUM *a); - A new BIGNUM is created and returned containing the value of 'a'. - NULL is returned on error. - -Comparison and Test Functions. - -int BN_is_zero(BIGNUM *a) - Return 1 if 'a' is zero, else 0. - -int BN_is_one(a) - Return 1 is 'a' is one, else 0. - -int BN_is_word(a,w) - Return 1 if 'a' == w, else 0. 'w' is a BN_ULONG. - -int BN_cmp(BIGNUM *a, BIGNUM *b); - Return -1 if 'a' is less than 'b', 0 if 'a' and 'b' are the same - and 1 is 'a' is greater than 'b'. This is a signed comparison. - -int BN_ucmp(BIGNUM *a, BIGNUM *b); - This function is the same as BN_cmp except that the comparison - ignores the sign of the numbers. - -Arithmetic Functions -For all of these functions, 0 is returned if there is an error and 1 is -returned for success. The return value should always be checked. eg. -if (!BN_add(r,a,b)) goto err; -Unless explicitly mentioned, the 'return' value can be one of the -'parameters' to the function. - -int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); - Add 'a' and 'b' and return the result in 'r'. This is r=a+b. - -int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); - Subtract 'a' from 'b' and put the result in 'r'. This is r=a-b. - -int BN_lshift(BIGNUM *r, BIGNUM *a, int n); - Shift 'a' left by 'n' bits. This is r=a*(2^n). - -int BN_lshift1(BIGNUM *r, BIGNUM *a); - Shift 'a' left by 1 bit. This form is more efficient than - BN_lshift(r,a,1). This is r=a*2. - -int BN_rshift(BIGNUM *r, BIGNUM *a, int n); - Shift 'a' right by 'n' bits. This is r=int(a/(2^n)). - -int BN_rshift1(BIGNUM *r, BIGNUM *a); - Shift 'a' right by 1 bit. This form is more efficient than - BN_rshift(r,a,1). This is r=int(a/2). - -int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b); - Multiply a by b and return the result in 'r'. 'r' must not be - either 'a' or 'b'. It has to be a different BIGNUM. - This is r=a*b. - -int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); - Multiply a by a and return the result in 'r'. 'r' must not be - 'a'. This function is alot faster than BN_mul(r,a,a). This is r=a*a. - -int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); - Divide 'm' by 'd' and return the result in 'dv' and the remainder - in 'rem'. Either of 'dv' or 'rem' can be NULL in which case that - value is not returned. 'ctx' needs to be passed as a source of - temporary BIGNUM variables. - This is dv=int(m/d), rem=m%d. - -int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); - Find the remainder of 'm' divided by 'd' and return it in 'rem'. - 'ctx' holds the temporary BIGNUMs required by this function. - This function is more efficient than BN_div(NULL,rem,m,d,ctx); - This is rem=m%d. - -int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *m,BN_CTX *ctx); - Multiply 'a' by 'b' and return the remainder when divided by 'm'. - 'ctx' holds the temporary BIGNUMs required by this function. - This is r=(a*b)%m. - -int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); - Raise 'a' to the 'p' power and return the remainder when divided by - 'm'. 'ctx' holds the temporary BIGNUMs required by this function. - This is r=(a^p)%m. - -int BN_reciprocal(BIGNUM *r, BIGNUM *m, BN_CTX *ctx); - Return the reciprocal of 'm'. 'ctx' holds the temporary variables - required. This function returns -1 on error, otherwise it returns - the number of bits 'r' is shifted left to make 'r' into an integer. - This number of bits shifted is required in BN_mod_mul_reciprocal(). - This is r=(1/m)<<(BN_num_bits(m)+1). - -int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BIGNUM *m, - BIGNUM *i, int nb, BN_CTX *ctx); - This function is used to perform an efficient BN_mod_mul() - operation. If one is going to repeatedly perform BN_mod_mul() with - the same modulus is worth calculating the reciprocal of the modulus - and then using this function. This operation uses the fact that - a/b == a*r where r is the reciprocal of b. On modern computers - multiplication is very fast and big number division is very slow. - 'x' is multiplied by 'y' and then divided by 'm' and the remainder - is returned. 'i' is the reciprocal of 'm' and 'nb' is the number - of bits as returned from BN_reciprocal(). Normal usage is as follows. - bn=BN_reciprocal(i,m); - for (...) - { BN_mod_mul_reciprocal(r,x,y,m,i,bn,ctx); } - This is r=(x*y)%m. Internally it is approximately - r=(x*y)-m*(x*y/m) or r=(x*y)-m*((x*y*i) >> bn) - This function is used in BN_mod_exp() and BN_is_prime(). - -Assignment Operations - -int BN_one(BIGNUM *a) - Set 'a' to hold the value one. - This is a=1. - -int BN_zero(BIGNUM *a) - Set 'a' to hold the value zero. - This is a=0. - -int BN_set_word(BIGNUM *a, unsigned long w); - Set 'a' to hold the value of 'w'. 'w' is an unsigned long. - This is a=w. - -unsigned long BN_get_word(BIGNUM *a); - Returns 'a' in an unsigned long. Not remarkably, often 'a' will - be biger than a word, in which case 0xffffffffL is returned. - -Word Operations -These functions are much more efficient that the normal bignum arithmetic -operations. - -BN_ULONG BN_mod_word(BIGNUM *a, unsigned long w); - Return the remainder of 'a' divided by 'w'. - This is return(a%w). - -int BN_add_word(BIGNUM *a, unsigned long w); - Add 'w' to 'a'. This function does not take the sign of 'a' into - account. This is a+=w; - -Bit operations. - -int BN_is_bit_set(BIGNUM *a, int n); - This function return 1 if bit 'n' is set in 'a' else 0. - -int BN_set_bit(BIGNUM *a, int n); - This function sets bit 'n' to 1 in 'a'. - This is a&= ~(1<<n); - -int BN_clear_bit(BIGNUM *a, int n); - This function sets bit 'n' to zero in 'a'. Return 0 if less - than 'n' bits in 'a' else 1. This is a&= ~(1<<n); - -int BN_mask_bits(BIGNUM *a, int n); - Truncate 'a' to n bits long. This is a&= ~((~0)<<n) - -Format conversion routines. - -BIGNUM *BN_bin2bn(unsigned char *s, int len,BIGNUM *ret); - This function converts 'len' bytes in 's' into a BIGNUM which - is put in 'ret'. If ret is NULL, a new BIGNUM is created. - Either this new BIGNUM or ret is returned. The number is - assumed to be in bigendian form in 's'. By this I mean that - to 'ret' is created as follows for 'len' == 5. - ret = s[0]*2^32 + s[1]*2^24 + s[2]*2^16 + s[3]*2^8 + s[4]; - This function cannot be used to convert negative numbers. It - is always assumed the number is positive. The application - needs to diddle the 'neg' field of th BIGNUM its self. - The better solution would be to save the numbers in ASN.1 format - since this is a defined standard for storing big numbers. - Look at the functions - - ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); - BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); - int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); - ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, - long length; - -int BN_bn2bin(BIGNUM *a, unsigned char *to); - This function converts 'a' to a byte string which is put into - 'to'. The representation is big-endian in that the most - significant byte of 'a' is put into to[0]. This function - returns the number of bytes used to hold 'a'. BN_num_bytes(a) - would return the same value and can be used to determine how - large 'to' needs to be. If the number is negative, this - information is lost. Since this library was written to - manipulate large positive integers, the inability to save and - restore them is not considered to be a problem by me :-). - As for BN_bin2bn(), look at the ASN.1 integer encoding funtions - for SSLeay. They use BN_bin2bn() and BN_bn2bin() internally. - -char *BN_bn2ascii(BIGNUM *a); - This function returns a malloc()ed string that contains the - ascii hexadecimal encoding of 'a'. The number is in bigendian - format with a '-' in front if the number is negative. - -int BN_ascii2bn(BIGNUM **bn, char *a); - The inverse of BN_bn2ascii. The function returns the number of - characters from 'a' were processed in generating a the bignum. - error is inticated by 0 being returned. The number is a - hex digit string, optionally with a leading '-'. If *bn - is null, a BIGNUM is created and returned via that variable. - -int BN_print_fp(FILE *fp, BIGNUM *a); - 'a' is printed to file pointer 'fp'. It is in the same format - that is output from BN_bn2ascii(). 0 is returned on error, - 1 if things are ok. - -int BN_print(BIO *bp, BIGNUM *a); - Same as BN_print except that the output is done to the SSLeay libraries - BIO routines. BN_print_fp() actually calls this function. - -Miscellaneous Routines. - -int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); - This function returns in 'rnd' a random BIGNUM that is bits - long. If bottom is 1, the number returned is odd. If top is set, - the top 2 bits of the number are set. This is useful because if - this is set, 2 'n; bit numbers multiplied together will return a 2n - bit number. If top was not set, they could produce a 2n-1 bit - number. - -BIGNUM *BN_mod_inverse(BIGNUM *a, BIGNUM *n,BN_CTX *ctx); - This function create a new BIGNUM and returns it. This number - is the inverse mod 'n' of 'a'. By this it is meant that the - returned value 'r' satisfies (a*r)%n == 1. This function is - used in the generation of RSA keys. 'ctx', as per usual, - is used to hold temporary variables that are required by the - function. NULL is returned on error. - -int BN_gcd(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx); - 'r' has the greatest common divisor of 'a' and 'b'. 'ctx' is - used for temporary variables and 0 is returned on error. - -int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(),BN_CTX *ctx, - char *cb_arg); - This function is used to check if a BIGNUM ('p') is prime. - It performs this test by using the Miller-Rabin randomised - primality test. This is a probalistic test that requires a - number of rounds to ensure the number is prime to a high - degree of probability. Since this can take quite some time, a - callback function can be passed and it will be called each - time 'p' passes a round of the prime testing. 'callback' will - be called as follows, callback(1,n,cb_arg) where n is the number of - the round, just passed. As per usual 'ctx' contains temporary - variables used. If ctx is NULL, it does not matter, a local version - will be malloced. This parameter is present to save some mallocing - inside the function but probably could be removed. - 0 is returned on error. - 'ncheck' is the number of Miller-Rabin tests to run. It is - suggested to use the value 'BN_prime_checks' by default. - -BIGNUM *BN_generate_prime( -int bits, -int strong, -BIGNUM *a, -BIGNUM *rems, -void (*callback)()); -char *cb_arg - This function is used to generate prime numbers. It returns a - new BIGNUM that has a high probability of being a prime. - 'bits' is the number of bits that - are to be in the prime. If 'strong' is true, the returned prime - will also be a strong prime ((p-1)/2 is also prime). - While searching for the prime ('p'), we - can add the requirement that the prime fill the following - condition p%a == rem. This can be used to help search for - primes with specific features, which is required when looking - for primes suitable for use with certain 'g' values in the - Diffie-Hellman key exchange algorithm. If 'a' is NULL, - this condition is not checked. If rem is NULL, rem is assumed - to be 1. Since this search for a prime - can take quite some time, if callback is not NULL, it is called - in the following situations. - We have a suspected prime (from a quick sieve), - callback(0,sus_prime++,cb_arg). Each item to be passed to BN_is_prime(). - callback(1,round++,cb_arg). Each successful 'round' in BN_is_prime(). - callback(2,round,cb_arg). For each successful BN_is_prime() test. - -Hints ------ - -DSA wants 64*32 to use word mont mul, but RSA wants to use full. - -==== callback.doc ======================================================== - -Callback functions used in SSLeay. - --------------------------- -The BIO library. - -Each BIO structure can have a callback defined against it. This callback is -called 2 times for each BIO 'function'. It is passed 6 parameters. -BIO_debug_callback() is an example callback which is defined in -crypto/buffer/bio_cb.c and is used in apps/dgst.c This is intended mostly -for debuging or to notify the application of IO. - -long BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi,long argl, - long ret); -bio is the BIO being called, cmd is the type of BIO function being called. -Look at the BIO_CB_* defines in buffer.h. Argp and argi are the arguments -passed to BIO_read(), BIO_write, BIO_gets(), BIO_puts(). In the case of -BIO_ctrl(), argl is also defined. The first time the callback is called, -before the underlying function has been executed, 0 is passed as 'ret', and -if the return code from the callback is not > 0, the call is aborted -and the returned <= 0 value is returned. -The second time the callback is called, the 'cmd' value also has -BIO_CB_RETURN logically 'or'ed with it. The 'ret' value is the value returned -from the actuall function call and whatever the callback returns is returned -from the BIO function. - -BIO_set_callback(b,cb) can be used to set the callback function -(b is a BIO), and BIO_set_callback_arg(b,arg) can be used to -set the cb_arg argument in the BIO strucutre. This field is only intended -to be used by application, primarily in the callback function since it is -accessable since the BIO is passed. - --------------------------- -The PEM library. - -The pem library only really uses one type of callback, -static int def_callback(char *buf, int num, int verify); -which is used to return a password string if required. -'buf' is the buffer to put the string in. 'num' is the size of 'buf' -and 'verify' is used to indicate that the password should be checked. -This last flag is mostly used when reading a password for encryption. - -For all of these functions, a NULL callback will call the above mentioned -default callback. This default function does not work under Windows 3.1. -For other machines, it will use an application defined prompt string -(EVP_set_pw_prompt(), which defines a library wide prompt string) -if defined, otherwise it will use it's own PEM password prompt. -It will then call EVP_read_pw_string() to get a password from the console. -If your application wishes to use nice fancy windows to retrieve passwords, -replace this function. The callback should return the number of bytes read -into 'buf'. If the number of bytes <= 0, it is considered an error. - -Functions that take this callback are listed below. For the 'read' type -functions, the callback will only be required if the PEM data is encrypted. - -For the Write functions, normally a password can be passed in 'kstr', of -'klen' bytes which will be used if the 'enc' cipher is not NULL. If -'kstr' is NULL, the callback will be used to retrieve a password. - -int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, - int (*callback)()); -char *PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x,int (*cb)()); -char *PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x,int (*cb)()); -int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, - EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); -int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, - EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); -STACK *PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); -STACK *PEM_X509_INFO_read_bio(BIO *fp, STACK *sk, int (*cb)()); - -#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) -#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) -#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) -#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) -#define PEM_read_SSL_SESSION(fp,x,cb) -#define PEM_read_X509(fp,x,cb) -#define PEM_read_X509_REQ(fp,x,cb) -#define PEM_read_X509_CRL(fp,x,cb) -#define PEM_read_RSAPrivateKey(fp,x,cb) -#define PEM_read_DSAPrivateKey(fp,x,cb) -#define PEM_read_PrivateKey(fp,x,cb) -#define PEM_read_PKCS7(fp,x,cb) -#define PEM_read_DHparams(fp,x,cb) -#define PEM_read_bio_SSL_SESSION(bp,x,cb) -#define PEM_read_bio_X509(bp,x,cb) -#define PEM_read_bio_X509_REQ(bp,x,cb) -#define PEM_read_bio_X509_CRL(bp,x,cb) -#define PEM_read_bio_RSAPrivateKey(bp,x,cb) -#define PEM_read_bio_DSAPrivateKey(bp,x,cb) -#define PEM_read_bio_PrivateKey(bp,x,cb) -#define PEM_read_bio_PKCS7(bp,x,cb) -#define PEM_read_bio_DHparams(bp,x,cb) -int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); -RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); - -Now you will notice that macros like -#define PEM_write_X509(fp,x) \ - PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ - (char *)x, NULL,NULL,0,NULL) -Don't do encryption normally. If you want to PEM encrypt your X509 structure, -either just call PEM_ASN1_write directly or just define you own -macro variant. As you can see, this macro just sets all encryption related -parameters to NULL. - - --------------------------- -The SSL library. - -#define SSL_set_info_callback(ssl,cb) -#define SSL_CTX_set_info_callback(ctx,cb) -void callback(SSL *ssl,int location,int ret) -This callback is called each time around the SSL_connect()/SSL_accept() -state machine. So it will be called each time the SSL protocol progresses. -It is mostly present for use when debugging. When SSL_connect() or -SSL_accept() return, the location flag is SSL_CB_ACCEPT_EXIT or -SSL_CB_CONNECT_EXIT and 'ret' is the value about to be returned. -Have a look at the SSL_CB_* defines in ssl.h. If an info callback is defined -against the SSL_CTX, it is called unless there is one set against the SSL. -Have a look at -void client_info_callback() in apps/s_client() for an example. - -Certificate verification. -void SSL_set_verify(SSL *s, int mode, int (*callback) ()); -void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,int (*callback)()); -This callback is used to help verify client and server X509 certificates. -It is actually passed to X509_cert_verify(), along with the SSL structure -so you have to read about X509_cert_verify() :-). The SSL_CTX version is used -if the SSL version is not defined. X509_cert_verify() is the function used -by the SSL part of the library to verify certificates. This function is -nearly always defined by the application. - -void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(),char *arg); -int callback(char *arg,SSL *s,X509 *xs,STACK *cert_chain); -This call is used to replace the SSLeay certificate verification code. -The 'arg' is kept in the SSL_CTX and is passed to the callback. -If the callback returns 0, the certificate is rejected, otherwise it -is accepted. The callback is replacing the X509_cert_verify() call. -This feature is not often used, but if you wished to implement -some totally different certificate authentication system, this 'hook' is -vital. - -SSLeay keeps a cache of session-ids against each SSL_CTX. These callbacks can -be used to notify the application when a SSL_SESSION is added to the cache -or to retrieve a SSL_SESSION that is not in the cache from the application. -#define SSL_CTX_sess_set_get_cb(ctx,cb) -SSL_SESSION *callback(SSL *s,char *session_id,int session_id_len,int *copy); -If defined, this callback is called to return the SESSION_ID for the -session-id in 'session_id', of 'session_id_len' bytes. 'copy' is set to 1 -if the server is to 'take a copy' of the SSL_SESSION structure. It is 0 -if the SSL_SESSION is being 'passed in' so the SSLeay library is now -responsible for 'free()ing' the structure. Basically it is used to indicate -if the reference count on the SSL_SESSION structure needs to be incremented. - -#define SSL_CTX_sess_set_new_cb(ctx,cb) -int callback(SSL *s, SSL_SESSION *sess); -When a new connection is established, if the SSL_SESSION is going to be added -to the cache, this callback is called. Return 1 if a 'copy' is required, -otherwise, return 0. This return value just causes the reference count -to be incremented (on return of a 1), this means the application does -not need to worry about incrementing the refernece count (and the -locking that implies in a multi-threaded application). - -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx,int (*cb)()); -This sets the SSL password reading function. -It is mostly used for windowing applications -and used by PEM_read_bio_X509() and PEM_read_bio_RSAPrivateKey() -calls inside the SSL library. The only reason this is present is because the -calls to PEM_* functions is hidden in the SSLeay library so you have to -pass in the callback some how. - -#define SSL_CTX_set_client_cert_cb(ctx,cb) -int callback(SSL *s,X509 **x509, EVP_PKEY **pkey); -Called when a client certificate is requested but there is not one set -against the SSL_CTX or the SSL. If the callback returns 1, x509 and -pkey need to point to valid data. The library will free these when -required so if the application wants to keep these around, increment -their reference counts. If 0 is returned, no client cert is -available. If -1 is returned, it is assumed that the callback needs -to be called again at a later point in time. SSL_connect will return --1 and SSL_want_x509_lookup(ssl) returns true. Remember that -application data can be attached to an SSL structure via the -SSL_set_app_data(SSL *ssl,char *data) call. - --------------------------- -The X509 library. - -int X509_cert_verify(CERTIFICATE_CTX *ctx,X509 *xs, int (*cb)(), - int *error,char *arg,STACK *cert_chain); -int verify_callback(int ok,X509 *xs,X509 *xi,int depth,int error,char *arg, - STACK *cert_chain); - -X509_cert_verify() is used to authenticate X509 certificates. The 'ctx' holds -the details of the various caches and files used to locate certificates. -'xs' is the certificate to verify and 'cb' is the application callback (more -detail later). 'error' will be set to the error code and 'arg' is passed -to the 'cb' callback. Look at the VERIFY_* defines in crypto/x509/x509.h - -When ever X509_cert_verify() makes a 'negative' decision about a -certitificate, the callback is called. If everything checks out, the -callback is called with 'VERIFY_OK' or 'VERIFY_ROOT_OK' (for a self -signed cert that is not the passed certificate). - -The callback is passed the X509_cert_verify opinion of the certificate -in 'ok', the certificate in 'xs', the issuer certificate in 'xi', -the 'depth' of the certificate in the verification 'chain', the -VERIFY_* code in 'error' and the argument passed to X509_cert_verify() -in 'arg'. cert_chain is a list of extra certs to use if they are not -in the cache. - -The callback can be used to look at the error reason, and then return 0 -for an 'error' or '1' for ok. This will override the X509_cert_verify() -opinion of the certificates validity. Processing will continue depending on -the return value. If one just wishes to use the callback for informational -reason, just return the 'ok' parameter. - --------------------------- -The BN and DH library. - -BIGNUM *BN_generate_prime(int bits,int strong,BIGNUM *add, - BIGNUM *rem,void (*callback)(int,int)); -int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int), - -Read doc/bn.doc for the description of these 2. - -DH *DH_generate_parameters(int prime_len,int generator, - void (*callback)(int,int)); -Read doc/bn.doc for the description of the callback, since it is just passed -to BN_generate_prime(), except that it is also called as -callback(3,0) by this function. - --------------------------- -The CRYPTO library. - -void CRYPTO_set_locking_callback(void (*func)(int mode,int type,char *file, - int line)); -void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount, - int type,char *file, int line)); -void CRYPTO_set_id_callback(unsigned long (*func)(void)); - -Read threads.doc for info on these ones. - - -==== cipher.doc ======================================================== - -The Cipher subroutines. - -These routines require "evp.h" to be included. - -These functions are a higher level interface to the various cipher -routines found in this library. As such, they allow the same code to be -used to encrypt and decrypt via different ciphers with only a change -in an initial parameter. These routines also provide buffering for block -ciphers. - -These routines all take a pointer to the following structure to specify -which cipher to use. If you wish to use a new cipher with these routines, -you would probably be best off looking an how an existing cipher is -implemented and copying it. At this point in time, I'm not going to go -into many details. This structure should be considered opaque - -typedef struct pem_cipher_st - { - int type; - int block_size; - int key_len; - int iv_len; - void (*enc_init)(); /* init for encryption */ - void (*dec_init)(); /* init for decryption */ - void (*do_cipher)(); /* encrypt data */ - } EVP_CIPHER; - -The type field is the object NID of the cipher type -(read the section on Objects for an explanation of what a NID is). -The cipher block_size is how many bytes need to be passed -to the cipher at a time. Key_len is the -length of the key the cipher requires and iv_len is the length of the -initialisation vector required. enc_init is the function -called to initialise the ciphers context for encryption and dec_init is the -function to initialise for decryption (they need to be different, especially -for the IDEA cipher). - -One reason for specifying the Cipher via a pointer to a structure -is that if you only use des-cbc, only the des-cbc routines will -be included when you link the program. If you passed an integer -that specified which cipher to use, the routine that mapped that -integer to a set of cipher functions would cause all the ciphers -to be link into the code. This setup also allows new ciphers -to be added by the application (with some restrictions). - -The thirteen ciphers currently defined in this library are - -EVP_CIPHER *EVP_des_ecb(); /* DES in ecb mode, iv=0, block=8, key= 8 */ -EVP_CIPHER *EVP_des_ede(); /* DES in ecb ede mode, iv=0, block=8, key=16 */ -EVP_CIPHER *EVP_des_ede3(); /* DES in ecb ede mode, iv=0, block=8, key=24 */ -EVP_CIPHER *EVP_des_cfb(); /* DES in cfb mode, iv=8, block=1, key= 8 */ -EVP_CIPHER *EVP_des_ede_cfb(); /* DES in ede cfb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_des_ede3_cfb();/* DES in ede cfb mode, iv=8, block=1, key=24 */ -EVP_CIPHER *EVP_des_ofb(); /* DES in ofb mode, iv=8, block=1, key= 8 */ -EVP_CIPHER *EVP_des_ede_ofb(); /* DES in ede ofb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_des_ede3_ofb();/* DES in ede ofb mode, iv=8, block=1, key=24 */ -EVP_CIPHER *EVP_des_cbc(); /* DES in cbc mode, iv=8, block=8, key= 8 */ -EVP_CIPHER *EVP_des_ede_cbc(); /* DES in cbc ede mode, iv=8, block=8, key=16 */ -EVP_CIPHER *EVP_des_ede3_cbc();/* DES in cbc ede mode, iv=8, block=8, key=24 */ -EVP_CIPHER *EVP_desx_cbc(); /* DES in desx cbc mode,iv=8, block=8, key=24 */ -EVP_CIPHER *EVP_rc4(); /* RC4, iv=0, block=1, key=16 */ -EVP_CIPHER *EVP_idea_ecb(); /* IDEA in ecb mode, iv=0, block=8, key=16 */ -EVP_CIPHER *EVP_idea_cfb(); /* IDEA in cfb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_idea_ofb(); /* IDEA in ofb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_idea_cbc(); /* IDEA in cbc mode, iv=8, block=8, key=16 */ -EVP_CIPHER *EVP_rc2_ecb(); /* RC2 in ecb mode, iv=0, block=8, key=16 */ -EVP_CIPHER *EVP_rc2_cfb(); /* RC2 in cfb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_rc2_ofb(); /* RC2 in ofb mode, iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_rc2_cbc(); /* RC2 in cbc mode, iv=8, block=8, key=16 */ -EVP_CIPHER *EVP_bf_ecb(); /* Blowfish in ecb mode,iv=0, block=8, key=16 */ -EVP_CIPHER *EVP_bf_cfb(); /* Blowfish in cfb mode,iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_bf_ofb(); /* Blowfish in ofb mode,iv=8, block=1, key=16 */ -EVP_CIPHER *EVP_bf_cbc(); /* Blowfish in cbc mode,iv=8, block=8, key=16 */ - -The meaning of the compound names is as follows. -des The base cipher is DES. -idea The base cipher is IDEA -rc4 The base cipher is RC4-128 -rc2 The base cipher is RC2-128 -ecb Electronic Code Book form of the cipher. -cbc Cipher Block Chaining form of the cipher. -cfb 64 bit Cipher Feedback form of the cipher. -ofb 64 bit Output Feedback form of the cipher. -ede The cipher is used in Encrypt, Decrypt, Encrypt mode. The first - and last keys are the same. -ede3 The cipher is used in Encrypt, Decrypt, Encrypt mode. - -All the Cipher routines take a EVP_CIPHER_CTX pointer as an argument. -The state of the cipher is kept in this structure. - -typedef struct EVP_CIPHER_Ctx_st - { - EVP_CIPHER *cipher; - int encrypt; /* encrypt or decrypt */ - int buf_len; /* number we have left */ - unsigned char buf[8]; - union { - .... /* cipher specific stuff */ - } c; - } EVP_CIPHER_CTX; - -Cipher is a pointer the the EVP_CIPHER for the current context. The encrypt -flag indicates encryption or decryption. buf_len is the number of bytes -currently being held in buf. -The 'c' union holds the cipher specify context. - -The following functions are to be used. - -int EVP_read_pw_string( -char *buf, -int len, -char *prompt, -int verify, - This function is the same as des_read_pw_string() (des.doc). - -void EVP_set_pw_prompt(char *prompt); - This function sets the 'default' prompt to use to use in - EVP_read_pw_string when the prompt parameter is NULL. If the - prompt parameter is NULL, this 'default prompt' feature is turned - off. Be warned, this is a global variable so weird things - will happen if it is used under Win16 and care must be taken - with a multi-threaded version of the library. - -char *EVP_get_pw_prompt(); - This returns a pointer to the default prompt string. NULL - if it is not set. - -int EVP_BytesToKey( -EVP_CIPHER *type, -EVP_MD *md, -unsigned char *salt, -unsigned char *data, -int datal, -int count, -unsigned char *key, -unsigned char *iv); - This function is used to generate a key and an initialisation vector - for a specified cipher from a key string and a salt. Type - specifies the cipher the 'key' is being generated for. Md is the - message digest algorithm to use to generate the key and iv. The salt - is an optional 8 byte object that is used to help seed the key - generator. - If the salt value is NULL, it is just not used. Datal is the - number of bytes to use from 'data' in the key generation. - This function returns the key size for the specified cipher, if - data is NULL, this value is returns and no other - computation is performed. Count is - the number of times to loop around the key generator. I would - suggest leaving it's value as 1. Key and iv are the structures to - place the returning iv and key in. If they are NULL, no value is - generated for that particular value. - The algorithm used is as follows - - /* M[] is an array of message digests - * MD() is the message digest function */ - M[0]=MD(data . salt); - for (i=1; i<count; i++) M[0]=MD(M[0]); - - i=1 - while (data still needed for key and iv) - { - M[i]=MD(M[i-1] . data . salt); - for (i=1; i<count; i++) M[i]=MD(M[i]); - i++; - } - - If the salt is NULL, it is not used. - The digests are concatenated together. - M = M[0] . M[1] . M[2] ....... - - For key= 8, iv=8 => key=M[0.. 8], iv=M[ 9 .. 16]. - For key=16, iv=0 => key=M[0..16]. - For key=16, iv=8 => key=M[0..16], iv=M[17 .. 24]. - For key=24, iv=8 => key=M[0..24], iv=M[25 .. 32]. - - This routine will produce DES-CBC keys and iv that are compatible - with the PKCS-5 standard when md2 or md5 are used. If md5 is - used, the salt is NULL and count is 1, this routine will produce - the password to key mapping normally used with RC4. - I have attempted to logically extend the PKCS-5 standard to - generate keys and iv for ciphers that require more than 16 bytes, - if anyone knows what the correct standard is, please inform me. - When using sha or sha1, things are a bit different under this scheme, - since sha produces a 20 byte digest. So for ciphers requiring - 24 bits of data, 20 will come from the first MD and 4 will - come from the second. - - I have considered having a separate function so this 'routine' - can be used without the requirement of passing a EVP_CIPHER *, - but I have decided to not bother. If you wish to use the - function without official EVP_CIPHER structures, just declare - a local one and set the key_len and iv_len fields to the - length you desire. - -The following routines perform encryption and decryption 'by parts'. By -this I mean that there are groups of 3 routines. An Init function that is -used to specify a cipher and initialise data structures. An Update routine -that does encryption/decryption, one 'chunk' at a time. And finally a -'Final' function that finishes the encryption/decryption process. -All these functions take a EVP_CIPHER pointer to specify which cipher to -encrypt/decrypt with. They also take a EVP_CIPHER_CTX object as an -argument. This structure is used to hold the state information associated -with the operation in progress. - -void EVP_EncryptInit( -EVP_CIPHER_CTX *ctx, -EVP_CIPHER *type, -unsigned char *key, -unsigned char *iv); - This function initialise a EVP_CIPHER_CTX for encryption using the - cipher passed in the 'type' field. The cipher is initialised to use - 'key' as the key and 'iv' for the initialisation vector (if one is - required). If the type, key or iv is NULL, the value currently in the - EVP_CIPHER_CTX is reused. So to perform several decrypt - using the same cipher, key and iv, initialise with the cipher, - key and iv the first time and then for subsequent calls, - reuse 'ctx' but pass NULL for type, key and iv. You must make sure - to pass a key that is large enough for a particular cipher. I - would suggest using the EVP_BytesToKey() function. - -void EVP_EncryptUpdate( -EVP_CIPHER_CTX *ctx, -unsigned char *out, -int *outl, -unsigned char *in, -int inl); - This function takes 'inl' bytes from 'in' and outputs bytes - encrypted by the cipher 'ctx' was initialised with into 'out'. The - number of bytes written to 'out' is put into outl. If a particular - cipher encrypts in blocks, less or more bytes than input may be - output. Currently the largest block size used by supported ciphers - is 8 bytes, so 'out' should have room for 'inl+7' bytes. Normally - EVP_EncryptInit() is called once, followed by lots and lots of - calls to EVP_EncryptUpdate, followed by a single EVP_EncryptFinal - call. - -void EVP_EncryptFinal( -EVP_CIPHER_CTX *ctx, -unsigned char *out, -int *outl); - Because quite a large number of ciphers are block ciphers, there is - often an incomplete block to write out at the end of the - encryption. EVP_EncryptFinal() performs processing on this last - block. The last block in encoded in such a way that it is possible - to determine how many bytes in the last block are valid. For 8 byte - block size ciphers, if only 5 bytes in the last block are valid, the - last three bytes will be filled with the value 3. If only 2 were - valid, the other 6 would be filled with sixes. If all 8 bytes are - valid, a extra 8 bytes are appended to the cipher stream containing - nothing but 8 eights. These last bytes are output into 'out' and - the number of bytes written is put into 'outl' These last bytes - are output into 'out' and the number of bytes written is put into - 'outl'. This form of block cipher finalisation is compatible with - PKCS-5. Please remember that even if you are using ciphers like - RC4 that has no blocking and so the function will not write - anything into 'out', it would still be a good idea to pass a - variable for 'out' that can hold 8 bytes just in case the cipher is - changed some time in the future. It should also be remembered - that the EVP_CIPHER_CTX contains the password and so when one has - finished encryption with a particular EVP_CIPHER_CTX, it is good - practice to zero the structure - (ie. memset(ctx,0,sizeof(EVP_CIPHER_CTX)). - -void EVP_DecryptInit( -EVP_CIPHER_CTX *ctx, -EVP_CIPHER *type, -unsigned char *key, -unsigned char *iv); - This function is basically the same as EVP_EncryptInit() accept that - is prepares the EVP_CIPHER_CTX for decryption. - -void EVP_DecryptUpdate( -EVP_CIPHER_CTX *ctx, -unsigned char *out, -int *outl, -unsigned char *in, -int inl); - This function is basically the same as EVP_EncryptUpdate() - except that it performs decryption. There is one - fundamental difference though. 'out' can not be the same as - 'in' for any ciphers with a block size greater than 1 if more - than one call to EVP_DecryptUpdate() will be made. This - is because this routine can hold a 'partial' block between - calls. When a partial block is decrypted (due to more bytes - being passed via this function, they will be written to 'out' - overwriting the input bytes in 'in' that have not been read - yet. From this it should also be noted that 'out' should - be at least one 'block size' larger than 'inl'. This problem - only occurs on the second and subsequent call to - EVP_DecryptUpdate() when using a block cipher. - -int EVP_DecryptFinal( -EVP_CIPHER_CTX *ctx, -unsigned char *out, -int *outl); - This function is different to EVP_EncryptFinal in that it 'removes' - any padding bytes appended when the data was encrypted. Due to the - way in which 1 to 8 bytes may have been appended when encryption - using a block cipher, 'out' can end up with 0 to 7 bytes being put - into it. When decoding the padding bytes, it is possible to detect - an incorrect decryption. If the decryption appears to be wrong, 0 - is returned. If everything seems ok, 1 is returned. For ciphers - with a block size of 1 (RC4), this function would normally not - return any bytes and would always return 1. Just because this - function returns 1 does not mean the decryption was correct. It - would normally be wrong due to either the wrong key/iv or - corruption of the cipher data fed to EVP_DecryptUpdate(). - As for EVP_EncryptFinal, it is a good idea to zero the - EVP_CIPHER_CTX after use since the structure contains the key used - to decrypt the data. - -The following Cipher routines are convenience routines that call either -EVP_EncryptXxx or EVP_DecryptXxx depending on weather the EVP_CIPHER_CTX -was setup to encrypt or decrypt. - -void EVP_CipherInit( -EVP_CIPHER_CTX *ctx, -EVP_CIPHER *type, -unsigned char *key, -unsigned char *iv, -int enc); - This function take arguments that are the same as EVP_EncryptInit() - and EVP_DecryptInit() except for the extra 'enc' flag. If 1, the - EVP_CIPHER_CTX is setup for encryption, if 0, decryption. - -void EVP_CipherUpdate( -EVP_CIPHER_CTX *ctx, -unsigned char *out, -int *outl, -unsigned char *in, -int inl); - Again this function calls either EVP_EncryptUpdate() or - EVP_DecryptUpdate() depending on state in the 'ctx' structure. - As noted for EVP_DecryptUpdate(), when this routine is used - for decryption with block ciphers, 'out' should not be the - same as 'in'. - -int EVP_CipherFinal( -EVP_CIPHER_CTX *ctx, -unsigned char *outm, -int *outl); - This routine call EVP_EncryptFinal() or EVP_DecryptFinal() - depending on the state information in 'ctx'. 1 is always returned - if the mode is encryption, otherwise the return value is the return - value of EVP_DecryptFinal(). - -==== cipher.m ======================================================== - -Date: Tue, 15 Oct 1996 08:16:14 +1000 (EST) -From: Eric Young <eay@mincom.com> -X-Sender: eay@orb -To: Roland Haring <rharing@tandem.cl> -Cc: ssl-users@mincom.com -Subject: Re: Symmetric encryption with ssleay -In-Reply-To: <m0vBpyq-00001aC@tandemnet.tandem.cl> -Message-Id: <Pine.SOL.3.91.961015075623.11394A-100000@orb> -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII -Sender: ssl-lists-owner@mincom.com -Precedence: bulk -Status: RO -X-Status: - -On Fri, 11 Oct 1996, Roland Haring wrote: -> THE_POINT: -> Would somebody be so kind to give me the minimum basic -> calls I need to do to libcrypto.a to get some text encrypted -> and decrypted again? ...hopefully with code included to do -> base64 encryption and decryption ... e.g. that sign-it.c code -> posted some while ago was a big help :-) (please, do not point -> me to apps/enc.c where I suspect my Heissenbug to be hidden :-) - -Ok, the base64 encoding stuff in 'enc.c' does the wrong thing sometimes -when the data is less than a line long (this is for decoding). I'll dig -up the exact fix today and post it. I am taking longer on 0.6.5 than I -intended so I'll just post this patch. - -The documentation to read is in -doc/cipher.doc, -doc/encode.doc (very sparse :-). -and perhaps -doc/digest.doc, - -The basic calls to encrypt with say triple DES are - -Given -char key[EVP_MAX_KEY_LENGTH]; -char iv[EVP_MAX_IV_LENGTH]; -EVP_CIPHER_CTX ctx; -unsigned char out[512+8]; -int outl; - -/* optional generation of key/iv data from text password using md5 - * via an upward compatable verson of PKCS#5. */ -EVP_BytesToKey(EVP_des_ede3_cbc,EVP_md5,NULL,passwd,strlen(passwd), - key,iv); - -/* Initalise the EVP_CIPHER_CTX */ -EVP_EncryptInit(ctx,EVP_des_ede3_cbc,key,iv); - -while (....) - { - /* This is processing 512 bytes at a time, the bytes are being - * copied into 'out', outl bytes are output. 'out' should not be the - * same as 'in' for reasons mentioned in the documentation. */ - EVP_EncryptUpdate(ctx,out,&outl,in,512); - } - -/* Output the last 'block'. If the cipher is a block cipher, the last - * block is encoded in such a way so that a wrong decryption will normally be - * detected - again, one of the PKCS standards. */ - -EVP_EncryptFinal(ctx,out,&outl); - -To decrypt, use the EVP_DecryptXXXXX functions except that EVP_DecryptFinal() -will return 0 if the decryption fails (only detectable on block ciphers). - -You can also use -EVP_CipherInit() -EVP_CipherUpdate() -EVP_CipherFinal() -which does either encryption or decryption depending on an extra -parameter to EVP_CipherInit(). - - -To do the base64 encoding, -EVP_EncodeInit() -EVP_EncodeUpdate() -EVP_EncodeFinal() - -EVP_DecodeInit() -EVP_DecodeUpdate() -EVP_DecodeFinal() - -where the encoding is quite simple, but the decoding can be a bit more -fun (due to dud input). - -EVP_DecodeUpdate() returns -1 for an error on an input line, 0 if the -'last line' was just processed, and 1 if more lines should be submitted. - -EVP_DecodeFinal() returns -1 for an error or 1 if things are ok. - -So the loop becomes -EVP_DecodeInit(....) -for (;;) - { - i=EVP_DecodeUpdate(....); - if (i < 0) goto err; - - /* process the data */ - - if (i == 0) break; - } -EVP_DecodeFinal(....); -/* process the data */ - -The problem in 'enc.c' is that I was stuff the processing up after the -EVP_DecodeFinal(...) when the for(..) loop was not being run (one line of -base64 data) and this was because 'enc.c' tries to scan over a file until -it hits the first valid base64 encoded line. - -hope this helps a bit. -eric --- -Eric Young | BOOL is tri-state according to Bill Gates. -AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). - -==== conf.doc ======================================================== - -The CONF library. - -The CONF library is a simple set of routines that can be used to configure -programs. It is a superset of the genenv() function with some extra -structure. - -The library consists of 5 functions. - -LHASH *CONF_load(LHASH *config,char *file); -This function is called to load in a configuration file. Multiple -configuration files can be loaded, with each subsequent 'load' overwriting -any already defined 'variables'. If there is an error, NULL is returned. -If config is NULL, a new LHASH structure is created and returned, otherwise -the new data in the 'file' is loaded into the 'config' structure. - -void CONF_free(LHASH *config); -This function free()s the data in config. - -char *CONF_get_string(LHASH *config,char *section,char *name); -This function returns the string found in 'config' that corresponds to the -'section' and 'name' specified. Classes and the naming system used will be -discussed later in this document. If the variable is not defined, an NULL -is returned. - -long CONF_get_long(LHASH *config,char *section, char *name); -This function is the same as CONF_get_string() except that it converts the -string to an long and returns it. If variable is not a number or the -variable does not exist, 0 is returned. This is a little problematic but I -don't know of a simple way around it. - -STACK *CONF_get_section(LHASH *config, char *section); -This function returns a 'stack' of CONF_VALUE items that are all the -items defined in a particular section. DO NOT free() any of the -variable returned. They will disappear when CONF_free() is called. - -The 'lookup' model. -The configuration file is divided into 'sections'. Each section is started by -a line of the form '[ section ]'. All subsequent variable definitions are -of this section. A variable definition is a simple alpha-numeric name -followed by an '=' and then the data. A section or variable name can be -described by a regular expression of the following form '[A-Za-z0-9_]+'. -The value of the variable is the text after the '=' until the end of the -line, stripped of leading and trailing white space. -At this point I should mention that a '#' is a comment character, \ is the -escape character, and all three types of quote can be used to stop any -special interpretation of the data. -Now when the data is being loaded, variable expansion can occur. This is -done by expanding any $NAME sequences into the value represented by the -variable NAME. If the variable is not in the current section, the different -section can be specified by using the $SECTION::NAME form. The ${NAME} form -also works and is very useful for expanding variables inside strings. - -When a variable is looked up, there are 2 special section. 'default', which -is the initial section, and 'ENV' which is the processes environment -variables (accessed via getenv()). When a variable is looked up, it is -first 'matched' with it's section (if one was specified), if this fails, the -'default' section is matched. -If the 'lhash' variable passed was NULL, the environment is searched. - -Now why do we bother with sections? So we can have multiple programs using -the same configuration file, or multiple instances of the same program -using different variables. It also provides a nice mechanism to override -the processes environment variables (eg ENV::HOME=/tmp). If there is a -program specific variable missing, we can have default values. -Multiple configuration files can be loaded, with each new value clearing -any predefined values. A system config file can provide 'default' values, -and application/usr specific files can provide overriding values. - -Examples - -# This is a simple example -SSLEAY_HOME = /usr/local/ssl -ENV::PATH = $SSLEAY_HOME/bin:$PATH # override my path - -[X509] -cert_dir = $SSLEAY_HOME/certs # /usr/local/ssl/certs - -[SSL] -CIPHER = DES-EDE-MD5:RC4-MD5 -USER_CERT = $HOME/${USER}di'r 5' # /home/eay/eaydir 5 -USER_CERT = $HOME/\${USER}di\'r # /home/eay/${USER}di'r -USER_CERT = "$HOME/${US"ER}di\'r # $HOME/${USER}di'r - -TEST = 1234\ -5678\ -9ab # TEST=123456789ab -TTT = 1234\n\n # TTT=1234<nl><nl> - - - -==== des.doc ======================================================== - -The DES library. - -Please note that this library was originally written to operate with -eBones, a version of Kerberos that had had encryption removed when it left -the USA and then put back in. As such there are some routines that I will -advise not using but they are still in the library for historical reasons. -For all calls that have an 'input' and 'output' variables, they can be the -same. - -This library requires the inclusion of 'des.h'. - -All of the encryption functions take what is called a des_key_schedule as an -argument. A des_key_schedule is an expanded form of the des key. -A des_key is 8 bytes of odd parity, the type used to hold the key is a -des_cblock. A des_cblock is an array of 8 bytes, often in this library -description I will refer to input bytes when the function specifies -des_cblock's as input or output, this just means that the variable should -be a multiple of 8 bytes. - -The define DES_ENCRYPT is passed to specify encryption, DES_DECRYPT to -specify decryption. The functions and global variable are as follows: - -int des_check_key; - DES keys are supposed to be odd parity. If this variable is set to - a non-zero value, des_set_key() will check that the key has odd - parity and is not one of the known weak DES keys. By default this - variable is turned off; - -void des_set_odd_parity( -des_cblock *key ); - This function takes a DES key (8 bytes) and sets the parity to odd. - -int des_is_weak_key( -des_cblock *key ); - This function returns a non-zero value if the DES key passed is a - weak, DES key. If it is a weak key, don't use it, try a different - one. If you are using 'random' keys, the chances of hitting a weak - key are 1/2^52 so it is probably not worth checking for them. - -int des_set_key( -des_cblock *key, -des_key_schedule schedule); - Des_set_key converts an 8 byte DES key into a des_key_schedule. - A des_key_schedule is an expanded form of the key which is used to - perform actual encryption. It can be regenerated from the DES key - so it only needs to be kept when encryption or decryption is about - to occur. Don't save or pass around des_key_schedule's since they - are CPU architecture dependent, DES keys are not. If des_check_key - is non zero, zero is returned if the key has the wrong parity or - the key is a weak key, else 1 is returned. - -int des_key_sched( -des_cblock *key, -des_key_schedule schedule); - An alternative name for des_set_key(). - -int des_rw_mode; /* defaults to DES_PCBC_MODE */ - This flag holds either DES_CBC_MODE or DES_PCBC_MODE (default). - This specifies the function to use in the enc_read() and enc_write() - functions. - -void des_encrypt( -unsigned long *data, -des_key_schedule ks, -int enc); - This is the DES encryption function that gets called by just about - every other DES routine in the library. You should not use this - function except to implement 'modes' of DES. I say this because the - functions that call this routine do the conversion from 'char *' to - long, and this needs to be done to make sure 'non-aligned' memory - access do not occur. The characters are loaded 'little endian', - have a look at my source code for more details on how I use this - function. - Data is a pointer to 2 unsigned long's and ks is the - des_key_schedule to use. enc, is non zero specifies encryption, - zero if decryption. - -void des_encrypt2( -unsigned long *data, -des_key_schedule ks, -int enc); - This functions is the same as des_encrypt() except that the DES - initial permutation (IP) and final permutation (FP) have been left - out. As for des_encrypt(), you should not use this function. - It is used by the routines in my library that implement triple DES. - IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same - as des_encrypt() des_encrypt() des_encrypt() except faster :-). - -void des_ecb_encrypt( -des_cblock *input, -des_cblock *output, -des_key_schedule ks, -int enc); - This is the basic Electronic Code Book form of DES, the most basic - form. Input is encrypted into output using the key represented by - ks. If enc is non zero (DES_ENCRYPT), encryption occurs, otherwise - decryption occurs. Input is 8 bytes long and output is 8 bytes. - (the des_cblock structure is 8 chars). - -void des_ecb3_encrypt( -des_cblock *input, -des_cblock *output, -des_key_schedule ks1, -des_key_schedule ks2, -des_key_schedule ks3, -int enc); - This is the 3 key EDE mode of ECB DES. What this means is that - the 8 bytes of input is encrypted with ks1, decrypted with ks2 and - then encrypted again with ks3, before being put into output; - C=E(ks3,D(ks2,E(ks1,M))). There is a macro, des_ecb2_encrypt() - that only takes 2 des_key_schedules that implements, - C=E(ks1,D(ks2,E(ks1,M))) in that the final encrypt is done with ks1. - -void des_cbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule ks, -des_cblock *ivec, -int enc); - This routine implements DES in Cipher Block Chaining mode. - Input, which should be a multiple of 8 bytes is encrypted - (or decrypted) to output which will also be a multiple of 8 bytes. - The number of bytes is in length (and from what I've said above, - should be a multiple of 8). If length is not a multiple of 8, I'm - not being held responsible :-). ivec is the initialisation vector. - This function does not modify this variable. To correctly implement - cbc mode, you need to do one of 2 things; copy the last 8 bytes of - cipher text for use as the next ivec in your application, - or use des_ncbc_encrypt(). - Only this routine has this problem with updating the ivec, all - other routines that are implementing cbc mode update ivec. - -void des_ncbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule sk, -des_cblock *ivec, -int enc); - For historical reasons, des_cbc_encrypt() did not update the - ivec with the value requires so that subsequent calls to - des_cbc_encrypt() would 'chain'. This was needed so that the same - 'length' values would not need to be used when decrypting. - des_ncbc_encrypt() does the right thing. It is the same as - des_cbc_encrypt accept that ivec is updates with the correct value - to pass in subsequent calls to des_ncbc_encrypt(). I advise using - des_ncbc_encrypt() instead of des_cbc_encrypt(); - -void des_xcbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule sk, -des_cblock *ivec, -des_cblock *inw, -des_cblock *outw, -int enc); - This is RSA's DESX mode of DES. It uses inw and outw to - 'whiten' the encryption. inw and outw are secret (unlike the iv) - and are as such, part of the key. So the key is sort of 24 bytes. - This is much better than cbc des. - -void des_3cbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule sk1, -des_key_schedule sk2, -des_cblock *ivec1, -des_cblock *ivec2, -int enc); - This function is flawed, do not use it. I have left it in the - library because it is used in my des(1) program and will function - correctly when used by des(1). If I removed the function, people - could end up unable to decrypt files. - This routine implements outer triple cbc encryption using 2 ks and - 2 ivec's. Use des_ede2_cbc_encrypt() instead. - -void des_ede3_cbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule ks1, -des_key_schedule ks2, -des_key_schedule ks3, -des_cblock *ivec, -int enc); - This function implements outer triple CBC DES encryption with 3 - keys. What this means is that each 'DES' operation - inside the cbc mode is really an C=E(ks3,D(ks2,E(ks1,M))). - Again, this is cbc mode so an ivec is requires. - This mode is used by SSL. - There is also a des_ede2_cbc_encrypt() that only uses 2 - des_key_schedule's, the first being reused for the final - encryption. C=E(ks1,D(ks2,E(ks1,M))). This form of triple DES - is used by the RSAref library. - -void des_pcbc_encrypt( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule ks, -des_cblock *ivec, -int enc); - This is Propagating Cipher Block Chaining mode of DES. It is used - by Kerberos v4. It's parameters are the same as des_ncbc_encrypt(). - -void des_cfb_encrypt( -unsigned char *in, -unsigned char *out, -int numbits, -long length, -des_key_schedule ks, -des_cblock *ivec, -int enc); - Cipher Feedback Back mode of DES. This implementation 'feeds back' - in numbit blocks. The input (and output) is in multiples of numbits - bits. numbits should to be a multiple of 8 bits. Length is the - number of bytes input. If numbits is not a multiple of 8 bits, - the extra bits in the bytes will be considered padding. So if - numbits is 12, for each 2 input bytes, the 4 high bits of the - second byte will be ignored. So to encode 72 bits when using - a numbits of 12 take 12 bytes. To encode 72 bits when using - numbits of 9 will take 16 bytes. To encode 80 bits when using - numbits of 16 will take 10 bytes. etc, etc. This padding will - apply to both input and output. - - -void des_cfb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks, -des_cblock *ivec, -int *num, -int enc); - This is one of the more useful functions in this DES library, it - implements CFB mode of DES with 64bit feedback. Why is this - useful you ask? Because this routine will allow you to encrypt an - arbitrary number of bytes, no 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. num contains 'how far' we are though ivec. If this does - not make much sense, read more about cfb mode of DES :-). - -void des_ede3_cfb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks1, -des_key_schedule ks2, -des_key_schedule ks3, -des_cblock *ivec, -int *num, -int enc); - Same as des_cfb64_encrypt() accept that the DES operation is - triple DES. As usual, there is a macro for - des_ede2_cfb64_encrypt() which reuses ks1. - -void des_ofb_encrypt( -unsigned char *in, -unsigned char *out, -int numbits, -long length, -des_key_schedule ks, -des_cblock *ivec); - This is a implementation of Output Feed Back mode of DES. It is - the same as des_cfb_encrypt() in that numbits is the size of the - units dealt with during input and output (in bits). - -void des_ofb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks, -des_cblock *ivec, -int *num); - The same as des_cfb64_encrypt() except that it is Output Feed Back - mode. - -void des_ede3_ofb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks1, -des_key_schedule ks2, -des_key_schedule ks3, -des_cblock *ivec, -int *num); - Same as des_ofb64_encrypt() accept that the DES operation is - triple DES. As usual, there is a macro for - des_ede2_ofb64_encrypt() which reuses ks1. - -int des_read_pw_string( -char *buf, -int length, -char *prompt, -int verify); - This routine is used to get a password from the terminal with echo - turned off. Buf is where the string will end up and length is the - size of buf. Prompt is a string presented to the 'user' and if - verify is set, the key is asked for twice and unless the 2 copies - match, an error is returned. A return code of -1 indicates a - system error, 1 failure due to use interaction, and 0 is success. - -unsigned long des_cbc_cksum( -des_cblock *input, -des_cblock *output, -long length, -des_key_schedule ks, -des_cblock *ivec); - This function produces an 8 byte checksum from input that it puts in - output and returns the last 4 bytes as a long. The checksum is - generated via cbc mode of DES in which only the last 8 byes are - kept. I would recommend not using this function but instead using - the EVP_Digest routines, or at least using MD5 or SHA. This - function is used by Kerberos v4 so that is why it stays in the - library. - -char *des_fcrypt( -const char *buf, -const char *salt -char *ret); - This is my fast version of the unix crypt(3) function. This version - takes only a small amount of space relative to other fast - crypt() implementations. This is different to the normal crypt - in that the third parameter is the buffer that the return value - is written into. It needs to be at least 14 bytes long. This - function is thread safe, unlike the normal crypt. - -char *crypt( -const char *buf, -const char *salt); - This function calls des_fcrypt() with a static array passed as the - third parameter. This emulates the normal non-thread safe semantics - of crypt(3). - -void des_string_to_key( -char *str, -des_cblock *key); - This function takes str and converts it into a DES key. I would - recommend using MD5 instead and use the first 8 bytes of output. - When I wrote the first version of these routines back in 1990, MD5 - did not exist but I feel these routines are still sound. This - routines is compatible with the one in MIT's libdes. - -void des_string_to_2keys( -char *str, -des_cblock *key1, -des_cblock *key2); - This function takes str and converts it into 2 DES keys. - I would recommend using MD5 and using the 16 bytes as the 2 keys. - I have nothing against these 2 'string_to_key' routines, it's just - that if you say that your encryption key is generated by using the - 16 bytes of an MD5 hash, every-one knows how you generated your - keys. - -int des_read_password( -des_cblock *key, -char *prompt, -int verify); - This routine combines des_read_pw_string() with des_string_to_key(). - -int des_read_2passwords( -des_cblock *key1, -des_cblock *key2, -char *prompt, -int verify); - This routine combines des_read_pw_string() with des_string_to_2key(). - -void des_random_seed( -des_cblock key); - This routine sets a starting point for des_random_key(). - -void des_random_key( -des_cblock ret); - This function return a random key. Make sure to 'seed' the random - number generator (with des_random_seed()) before using this function. - I personally now use a MD5 based random number system. - -int des_enc_read( -int fd, -char *buf, -int len, -des_key_schedule ks, -des_cblock *iv); - This function will write to a file descriptor the encrypted data - from buf. This data will be preceded by a 4 byte 'byte count' and - will be padded out to 8 bytes. The encryption is either CBC of - PCBC depending on the value of des_rw_mode. If it is DES_PCBC_MODE, - pcbc is used, if DES_CBC_MODE, cbc is used. The default is to use - DES_PCBC_MODE. - -int des_enc_write( -int fd, -char *buf, -int len, -des_key_schedule ks, -des_cblock *iv); - This routines read stuff written by des_enc_read() and decrypts it. - I have used these routines quite a lot but I don't believe they are - suitable for non-blocking io. If you are after a full - authentication/encryption over networks, have a look at SSL instead. - -unsigned long des_quad_cksum( -des_cblock *input, -des_cblock *output, -long length, -int out_count, -des_cblock *seed); - This is a function from Kerberos v4 that is not anything to do with - DES but was needed. It is a cksum that is quicker to generate than - des_cbc_cksum(); I personally would use MD5 routines now. -===== -Modes of DES -Quite a bit of the following information has been taken from - AS 2805.5.2 - Australian Standard - Electronic funds transfer - Requirements for interfaces, - Part 5.2: Modes of operation for an n-bit block cipher algorithm - Appendix A - -There are several different modes in which DES can be used, they are -as follows. - -Electronic Codebook Mode (ECB) (des_ecb_encrypt()) -- 64 bits are enciphered at a time. -- The order of the blocks can be rearranged without detection. -- The same plaintext block always produces the same ciphertext block - (for the same key) making it vulnerable to a 'dictionary attack'. -- An error will only affect one ciphertext block. - -Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) -- a multiple of 64 bits are enciphered at a time. -- The CBC mode produces the same ciphertext whenever the same - plaintext is encrypted using the same key and starting variable. -- The chaining operation makes the ciphertext blocks dependent on the - current and all preceding plaintext blocks and therefore blocks can not - be rearranged. -- The use of different starting variables prevents the same plaintext - enciphering to the same ciphertext. -- An error will affect the current and the following ciphertext blocks. - -Cipher Feedback Mode (CFB) (des_cfb_encrypt()) -- a number of bits (j) <= 64 are enciphered at a time. -- The CFB mode produces the same ciphertext whenever the same - plaintext is encrypted using the same key and starting variable. -- The chaining operation makes the ciphertext variables dependent on the - current and all preceding variables and therefore j-bit variables are - chained together and can not be rearranged. -- The use of different starting variables prevents the same plaintext - enciphering to the same ciphertext. -- The strength of the CFB mode depends on the size of k (maximal if - j == k). In my implementation this is always the case. -- Selection of a small value for j will require more cycles through - the encipherment algorithm per unit of plaintext and thus cause - greater processing overheads. -- Only multiples of j bits can be enciphered. -- An error will affect the current and the following ciphertext variables. - -Output Feedback Mode (OFB) (des_ofb_encrypt()) -- a number of bits (j) <= 64 are enciphered at a time. -- The OFB mode produces the same ciphertext whenever the same - plaintext enciphered using the same key and starting variable. More - over, in the OFB mode the same key stream is produced when the same - key and start variable are used. Consequently, for security reasons - a specific start variable should be used only once for a given key. -- The absence of chaining makes the OFB more vulnerable to specific attacks. -- The use of different start variables values prevents the same - plaintext enciphering to the same ciphertext, by producing different - key streams. -- Selection of a small value for j will require more cycles through - the encipherment algorithm per unit of plaintext and thus cause - greater processing overheads. -- Only multiples of j bits can be enciphered. -- OFB mode of operation does not extend ciphertext errors in the - resultant plaintext output. Every bit error in the ciphertext causes - only one bit to be in error in the deciphered plaintext. -- OFB mode is not self-synchronising. If the two operation of - encipherment and decipherment get out of synchronism, the system needs - to be re-initialised. -- Each re-initialisation should use a value of the start variable - different from the start variable values used before with the same - key. The reason for this is that an identical bit stream would be - produced each time from the same parameters. This would be - susceptible to a ' known plaintext' attack. - -Triple ECB Mode (des_ecb3_encrypt()) -- Encrypt with key1, decrypt with key2 and encrypt with key3 again. -- As for ECB encryption but increases the key length to 168 bits. - There are theoretic attacks that can be used that make the effective - key length 112 bits, but this attack also requires 2^56 blocks of - memory, not very likely, even for the NSA. -- If both keys are the same it is equivalent to encrypting once with - just one key. -- If the first and last key are the same, the key length is 112 bits. - There are attacks that could reduce the key space to 55 bit's but it - requires 2^56 blocks of memory. -- If all 3 keys are the same, this is effectively the same as normal - ecb mode. - -Triple CBC Mode (des_ede3_cbc_encrypt()) -- Encrypt with key1, decrypt with key2 and then encrypt with key3. -- As for CBC encryption but increases the key length to 168 bits with - the same restrictions as for triple ecb mode. - -==== digest.doc ======================================================== - - -The Message Digest subroutines. - -These routines require "evp.h" to be included. - -These functions are a higher level interface to the various message digest -routines found in this library. As such, they allow the same code to be -used to digest via different algorithms with only a change in an initial -parameter. They are basically just a front-end to the MD2, MD5, SHA -and SHA1 -routines. - -These routines all take a pointer to the following structure to specify -which message digest algorithm to use. -typedef struct evp_md_st - { - int type; - int pkey_type; - int md_size; - void (*init)(); - void (*update)(); - void (*final)(); - - int required_pkey_type; /*EVP_PKEY_xxx */ - int (*sign)(); - int (*verify)(); - } EVP_MD; - -If additional message digest algorithms are to be supported, a structure of -this type needs to be declared and populated and then the Digest routines -can be used with that algorithm. The type field is the object NID of the -digest type (read the section on Objects for an explanation). The pkey_type -is the Object type to use when the a message digest is generated by there -routines and then is to be signed with the pkey algorithm. Md_size is -the size of the message digest returned. Init, update -and final are the relevant functions to perform the message digest function -by parts. One reason for specifying the message digest to use via this -mechanism is that if you only use md5, only the md5 routines will -be included in you linked program. If you passed an integer -that specified which message digest to use, the routine that mapped that -integer to a set of message digest functions would cause all the message -digests functions to be link into the code. This setup also allows new -message digest functions to be added by the application. - -The six message digests defined in this library are - -EVP_MD *EVP_md2(void); /* RSA sign/verify */ -EVP_MD *EVP_md5(void); /* RSA sign/verify */ -EVP_MD *EVP_sha(void); /* RSA sign/verify */ -EVP_MD *EVP_sha1(void); /* RSA sign/verify */ -EVP_MD *EVP_dss(void); /* DSA sign/verify */ -EVP_MD *EVP_dss1(void); /* DSA sign/verify */ - -All the message digest routines take a EVP_MD_CTX pointer as an argument. -The state of the message digest is kept in this structure. - -typedef struct pem_md_ctx_st - { - EVP_MD *digest; - union { - unsigned char base[4]; /* this is used in my library as a - * 'pointer' to all union elements - * structures. */ - MD2_CTX md2; - MD5_CTX md5; - SHA_CTX sha; - } md; - } EVP_MD_CTX; - -The Digest functions are as follows. - -void EVP_DigestInit( -EVP_MD_CTX *ctx, -EVP_MD *type); - This function is used to initialise the EVP_MD_CTX. The message - digest that will associated with 'ctx' is specified by 'type'. - -void EVP_DigestUpdate( -EVP_MD_CTX *ctx, -unsigned char *data, -unsigned int cnt); - This function is used to pass more data to the message digest - function. 'cnt' bytes are digested from 'data'. - -void EVP_DigestFinal( -EVP_MD_CTX *ctx, -unsigned char *md, -unsigned int *len); - This function finishes the digestion and puts the message digest - into 'md'. The length of the message digest is put into len; - EVP_MAX_MD_SIZE is the size of the largest message digest that - can be returned from this function. Len can be NULL if the - size of the digest is not required. - - -==== encode.doc ======================================================== - - -void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); -void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, - int *outl,unsigned char *in,int inl); -void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); -int EVP_EncodeBlock(unsigned char *t, unsigned char *f, int n); - -void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); -int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, - unsigned char *in, int inl); -int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned - char *out, int *outl); -int EVP_DecodeBlock(unsigned char *t, unsigned - char *f, int n); - - -==== envelope.doc ======================================================== - -The following routines are use to create 'digital' envelopes. -By this I mean that they perform various 'higher' level cryptographic -functions. Have a read of 'cipher.doc' and 'digest.doc' since those -routines are used by these functions. -cipher.doc contains documentation about the cipher part of the -envelope library and digest.doc contatins the description of the -message digests supported. - -To 'sign' a document involves generating a message digest and then encrypting -the digest with an private key. - -#define EVP_SignInit(a,b) EVP_DigestInit(a,b) -#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -Due to the fact this operation is basically just an extended message -digest, the first 2 functions are macro calls to Digest generating -functions. - -int EVP_SignFinal( -EVP_MD_CTX *ctx, -unsigned char *md, -unsigned int *s, -EVP_PKEY *pkey); - This finalisation function finishes the generation of the message -digest and then encrypts the digest (with the correct message digest -object identifier) with the EVP_PKEY private key. 'ctx' is the message digest -context. 'md' will end up containing the encrypted message digest. This -array needs to be EVP_PKEY_size(pkey) bytes long. 's' will actually -contain the exact length. 'pkey' of course is the private key. It is -one of EVP_PKEY_RSA or EVP_PKEY_DSA type. -If there is an error, 0 is returned, otherwise 1. - -Verify is used to check an signed message digest. - -#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) -#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -Since the first step is to generate a message digest, the first 2 functions -are macros. - -int EVP_VerifyFinal( -EVP_MD_CTX *ctx, -unsigned char *md, -unsigned int s, -EVP_PKEY *pkey); - This function finishes the generation of the message digest and then -compares it with the supplied encrypted message digest. 'md' contains the -'s' bytes of encrypted message digest. 'pkey' is used to public key decrypt -the digest. It is then compared with the message digest just generated. -If they match, 1 is returned else 0. - -int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, - int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk); -Must have at least one public key, error is 0. I should also mention that -the buffers pointed to by 'ek' need to be EVP_PKEY_size(pubk[n]) is size. - -#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); - - -int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, - int ekl,unsigned char *iv,EVP_PKEY *priv); -0 on failure - -#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) - -int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -Decrypt final return code - - -==== error.doc ======================================================== - -The error routines. - -The 'error' system I've implemented is intended to server 2 purpose, to -record the reason why a command failed and to record where in the libraries -the failure occurred. It is more or less setup to record a 'trace' of which -library components were being traversed when the error occurred. - -When an error is recorded, it is done so a as single unsigned long which is -composed of three parts. The top byte is the 'library' number, the middle -12 bytes is the function code, and the bottom 12 bits is the 'reason' code. - -Each 'library', or should a say, 'section' of the SSLeay library has a -different unique 'library' error number. Each function in the library has -a number that is unique for that library. Each 'library' also has a number -for each 'error reason' that is only unique for that 'library'. - -Due to the way these error routines record a 'error trace', there is an -array per thread that is used to store the error codes. -The various functions in this library are used to access -and manipulate this array. - -void ERR_put_error(int lib, int func,int reason); - This routine records an error in library 'lib', function 'func' -and reason 'reason'. As errors get 'put' into the buffer, they wrap -around and overwrite old errors if too many are written. It is assumed -that the last errors are the most important. - -unsigned long ERR_get_error(void ); - This function returns the last error added to the error buffer. -In effect it is popping the value off the buffer so repeated calls will -continue to return values until there are no more errors to return in which -case 0 is returned. - -unsigned long ERR_peek_error(void ); - This function returns the value of the last error added to the -error buffer but does not 'pop' it from the buffer. - -void ERR_clear_error(void ); - This function clears the error buffer, discarding all unread -errors. - -While the above described error system obviously produces lots of different -error number, a method for 'reporting' these errors in a human readable -form is required. To achieve this, each library has the option of -'registering' error strings. - -typedef struct ERR_string_data_st - { - unsigned long error; - char *string; - } ERR_STRING_DATA; - -The 'ERR_STRING_DATA' contains an error code and the corresponding text -string. To add new function error strings for a library, the -ERR_STRING_DATA needs to be 'registered' with the library. - -void ERR_load_strings(unsigned long lib,ERR_STRING_DATA *err); - This function 'registers' the array of ERR_STRING_DATA pointed to by -'err' as error text strings for the error library 'lib'. - -void ERR_free_strings(void); - This function free()s all the loaded error strings. - -char *ERR_error_string(unsigned long error,char *buf); - This function returns a text string that is a human readable -version of the error represented by 'error'. Buff should be at least 120 -bytes long and if it is NULL, the return value is a pointer to a static -variable that will contain the error string, otherwise 'buf' is returned. -If there is not a text string registered for a particular error, a text -string containing the error number is returned instead. - -void ERR_print_errors(BIO *bp); -void ERR_print_errors_fp(FILE *fp); - This function is a convenience routine that prints the error string -for each error until all errors have been accounted for. - -char *ERR_lib_error_string(unsigned long e); -char *ERR_func_error_string(unsigned long e); -char *ERR_reason_error_string(unsigned long e); -The above three functions return the 3 different components strings for the -error 'e'. ERR_error_string() uses these functions. - -void ERR_load_ERR_strings(void ); - This function 'registers' the error strings for the 'ERR' module. - -void ERR_load_crypto_strings(void ); - This function 'register' the error strings for just about every -library in the SSLeay package except for the SSL routines. There is no -need to ever register any error text strings and you will probably save in -program size. If on the other hand you do 'register' all errors, it is -quite easy to determine why a particular routine failed. - -As a final footnote as to why the error system is designed as it is. -1) I did not want a single 'global' error code. -2) I wanted to know which subroutine a failure occurred in. -3) For Windows NT etc, it should be simple to replace the 'key' routines - with code to pass error codes back to the application. -4) I wanted the option of meaningful error text strings. - -Late breaking news - the changes to support threads. - -Each 'thread' has an 'ERR_STATE' state associated with it. -ERR_STATE *ERR_get_state(void ) will return the 'state' for the calling -thread/process. - -ERR_remove_state(unsigned long pid); will 'free()' this state. If pid == 0 -the current 'thread/process' will have it's error state removed. -If you do not remove the error state of a thread, this could be considered a -form of memory leak, so just after 'reaping' a thread that has died, -call ERR_remove_state(pid). - -Have a read of thread.doc for more details for what is required for -multi-threading support. All the other error routines will -work correctly when using threads. - - -==== idea.doc ======================================================== - -The IDEA library. -IDEA is a block cipher that operates on 64bit (8 byte) quantities. It -uses a 128bit (16 byte) key. It can be used in all the modes that DES can -be used. This library implements the ecb, cbc, cfb64 and ofb64 modes. - -For all calls that have an 'input' and 'output' variables, they can be the -same. - -This library requires the inclusion of 'idea.h'. - -All of the encryption functions take what is called an IDEA_KEY_SCHEDULE as an -argument. An IDEA_KEY_SCHEDULE is an expanded form of the idea key. -For all modes of the IDEA algorithm, the IDEA_KEY_SCHEDULE used for -decryption is different to the one used for encryption. - -The define IDEA_ENCRYPT is passed to specify encryption for the functions -that require an encryption/decryption flag. IDEA_DECRYPT is passed to -specify decryption. For some mode there is no encryption/decryption -flag since this is determined by the IDEA_KEY_SCHEDULE. - -So to encrypt you would do the following -idea_set_encrypt_key(key,encrypt_ks); -idea_ecb_encrypt(...,encrypt_ks); -idea_cbc_encrypt(....,encrypt_ks,...,IDEA_ENCRYPT); - -To Decrypt -idea_set_encrypt_key(key,encrypt_ks); -idea_set_decrypt_key(encrypt_ks,decrypt_ks); -idea_ecb_encrypt(...,decrypt_ks); -idea_cbc_encrypt(....,decrypt_ks,...,IDEA_DECRYPT); - -Please note that any of the encryption modes specified in my DES library -could be used with IDEA. I have only implemented ecb, cbc, cfb64 and -ofb64 for the following reasons. -- ecb is the basic IDEA encryption. -- cbc is the normal 'chaining' form for block ciphers. -- cfb64 can be used to encrypt single characters, therefore input and output - do not need to be a multiple of 8. -- ofb64 is similar to cfb64 but is more like a stream cipher, not as - secure (not cipher feedback) but it does not have an encrypt/decrypt mode. -- If you want triple IDEA, thats 384 bits of key and you must be totally - obsessed with security. Still, if you want it, it is simple enough to - copy the function from the DES library and change the des_encrypt to - idea_encrypt; an exercise left for the paranoid reader :-). - -The functions are as follows: - -void idea_set_encrypt_key( -unsigned char *key; -IDEA_KEY_SCHEDULE *ks); - idea_set_encrypt_key converts a 16 byte IDEA key into an - IDEA_KEY_SCHEDULE. The IDEA_KEY_SCHEDULE is an expanded form of - the key which can be used to perform IDEA encryption. - An IDEA_KEY_SCHEDULE is an expanded form of the key which is used to - perform actual encryption. It can be regenerated from the IDEA key - so it only needs to be kept when encryption is about - to occur. Don't save or pass around IDEA_KEY_SCHEDULE's since they - are CPU architecture dependent, IDEA keys are not. - -void idea_set_decrypt_key( -IDEA_KEY_SCHEDULE *encrypt_ks, -IDEA_KEY_SCHEDULE *decrypt_ks); - This functions converts an encryption IDEA_KEY_SCHEDULE into a - decryption IDEA_KEY_SCHEDULE. For all decryption, this conversion - of the key must be done. In some modes of IDEA, an - encryption/decryption flag is also required, this is because these - functions involve block chaining and the way this is done changes - depending on which of encryption of decryption is being done. - Please note that there is no quick way to generate the decryption - key schedule other than generating the encryption key schedule and - then converting it. - -void idea_encrypt( -unsigned long *data, -IDEA_KEY_SCHEDULE *ks); - This is the IDEA encryption function that gets called by just about - every other IDEA routine in the library. You should not use this - function except to implement 'modes' of IDEA. I say this because the - functions that call this routine do the conversion from 'char *' to - long, and this needs to be done to make sure 'non-aligned' memory - access do not occur. - Data is a pointer to 2 unsigned long's and ks is the - IDEA_KEY_SCHEDULE to use. Encryption or decryption depends on the - IDEA_KEY_SCHEDULE. - -void idea_ecb_encrypt( -unsigned char *input, -unsigned char *output, -IDEA_KEY_SCHEDULE *ks); - This is the basic Electronic Code Book form of IDEA (in DES this - mode is called Electronic Code Book so I'm going to use the term - for idea as well :-). - Input is encrypted into output using the key represented by - ks. Depending on the IDEA_KEY_SCHEDULE, encryption or - decryption occurs. Input is 8 bytes long and output is 8 bytes. - -void idea_cbc_encrypt( -unsigned char *input, -unsigned char *output, -long length, -IDEA_KEY_SCHEDULE *ks, -unsigned char *ivec, -int enc); - This routine implements IDEA in Cipher Block Chaining mode. - Input, which should be a multiple of 8 bytes is encrypted - (or decrypted) to output which will also be a multiple of 8 bytes. - The number of bytes is in length (and from what I've said above, - should be a multiple of 8). If length is not a multiple of 8, bad - things will probably happen. ivec is the initialisation vector. - This function updates iv after each call so that it can be passed to - the next call to idea_cbc_encrypt(). - -void idea_cfb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks, -des_cblock *ivec, -int *num, -int enc); - This is one of the more useful functions in this IDEA library, it - implements CFB mode of IDEA with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - Enc is used to indicate encryption or decryption. - One very important thing to remember is that when decrypting, use - the encryption form of the key. - CFB64 mode operates by using the cipher to - generate a stream of bytes which is used to encrypt the plain text. - The cipher text is then encrypted to generate the next 64 bits to - be xored (incrementally) with the next 64 bits of plain - text. As can be seen from this, to encrypt or decrypt, - the same 'cipher stream' needs to be generated but the way the next - block of data is gathered for encryption is different for - encryption and decryption. What this means is that to encrypt - idea_set_encrypt_key(key,ks); - idea_cfb64_encrypt(...,ks,..,IDEA_ENCRYPT) - do decrypt - idea_set_encrypt_key(key,ks) - idea_cfb64_encrypt(...,ks,...,IDEA_DECRYPT) - Note: The same IDEA_KEY_SCHEDULE but different encryption flags. - For idea_cbc or idea_ecb, idea_set_decrypt_key() would need to be - used to generate the IDEA_KEY_SCHEDULE for decryption. - The reason I'm stressing this point is that I just wasted 3 hours - today trying to decrypt using this mode and the decryption form of - the key :-(. - -void idea_ofb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -des_key_schedule ks, -des_cblock *ivec, -int *num); - This functions implements OFB mode of IDEA with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - This is in effect a stream cipher, there is no encryption or - decryption mode. The same key and iv should be used to - encrypt and decrypt. - -For reading passwords, I suggest using des_read_pw_string() from my DES library. -To generate a password from a text string, I suggest using MD5 (or MD2) to -produce a 16 byte message digest that can then be passed directly to -idea_set_encrypt_key(). - -===== -For more information about the specific IDEA modes in this library -(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the -documentation on my DES library. What is said about DES is directly -applicable for IDEA. - - -==== legal.doc ======================================================== - -From eay@mincom.com Thu Jun 27 00:25:45 1996 -Received: by orb.mincom.oz.au id AA15821 - (5.65c/IDA-1.4.4 for eay); Wed, 26 Jun 1996 14:25:45 +1000 -Date: Wed, 26 Jun 1996 14:25:45 +1000 (EST) -From: Eric Young <eay@mincom.oz.au> -X-Sender: eay@orb -To: Ken Toll <ktoll@ren.digitalage.com> -Cc: Eric Young <eay@mincom.oz.au>, ssl-talk@netscape.com -Subject: Re: Unidentified subject! -In-Reply-To: <9606261950.ZM28943@ren.digitalage.com> -Message-Id: <Pine.SOL.3.91.960626131156.28573K-100000@orb> -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII -Status: O -X-Status: - - -This is a little off topic but since SSLeay is a free implementation of -the SSLv2 protocol, I feel it is worth responding on the topic of if it -is actually legal for Americans to use free cryptographic software. - -On Wed, 26 Jun 1996, Ken Toll wrote: -> Is the U.S the only country that SSLeay cannot be used commercially -> (because of RSAref) or is that going to be an issue with every country -> that a client/server application (non-web browser/server) is deployed -> and sold? - ->From what I understand, the software patents that apply to algorithms -like RSA and DH only apply in the USA. The IDEA algorithm I believe is -patened in europe (USA?), but considing how little it is used by other SSL -implementations, it quite easily be left out of the SSLeay build -(this can be done with a compile flag). - -Actually if the RSA patent did apply outside the USA, it could be rather -interesting since RSA is not alowed to let RSA toolkits outside of the USA -[1], and since these are the only forms that they will alow the algorithm -to be used in, it would mean that non-one outside of the USA could produce -public key software which would be a very strong statment for -international patent law to make :-). This logic is a little flawed but -it still points out some of the more interesting permutations of USA -patent law and ITAR restrictions. - -Inside the USA there is also the unresolved issue of RC4/RC2 which were -made public on sci.crypt in Sep 1994 (RC4) and Feb 1996 (RC2). I have -copies of the origional postings if people are interested. RSA I believe -claim that they were 'trade-secrets' and that some-one broke an NDA in -revealing them. Other claim they reverse engineered the algorithms from -compiled binaries. If the algorithms were reverse engineered, I belive -RSA had no legal leg to stand on. If an NDA was broken, I don't know. -Regardless, RSA, I belive, is willing to go to court over the issue so -licencing is probably the best idea, or at least talk to them. -If there are people who actually know more about this, pease let me know, I -don't want to vilify or spread miss-information if I can help it. - -If you are not producing a web browser, it is easy to build SSLeay with -RC2/RC4 removed. Since RC4 is the defacto standard cipher in -all web software (and it is damn fast) it is more or less required for -www use. For non www use of SSL, especially for an application where -interoperability with other vendors is not critical just leave it out. - -Removing IDEA, RC2 and RC4 would only leave DES and Triple DES but -they should be ok. Considing that Triple DES can encrypt at rates of -410k/sec on a pentium 100, and 940k/sec on a P6/200, this is quite -reasonable performance. Single DES clocks in at 1160k/s and 2467k/s -respectivly is actually quite fast for those not so paranoid (56 bit key).[1] - -> Is it possible to get a certificate for commercial use outside of the U.S.? -yes. - -Thawte Consulting issues certificates (they are the people who sell the - Sioux httpd server and are based in South Africa) -Verisign will issue certificates for Sioux (sold from South Africa), so this - proves that they will issue certificate for OS use if they are - happy with the quality of the software. - -(The above mentioned companies just the ones that I know for sure are issuing - certificates outside the USA). - -There is always the point that if you are using SSL for an intra net, -SSLeay provides programs that can be used so you can issue your own -certificates. They need polishing but at least it is a good starting point. - -I am not doing anything outside Australian law by implementing these -algorithms (to the best of my knowedge). It is another example of how -the world legal system does not cope with the internet very well. - -I may start making shared libraries available (I have now got DLL's for -Windows). This will mean that distributions into the usa could be -shipped with a version with a reduced cipher set and the versions outside -could use the DLL/shared library with all the ciphers (and without RSAref). - -This could be completly hidden from the application, so this would not -even require a re-linking. - -This is the reverse of what people were talking about doing to get around -USA export regulations :-) - -eric - -[1]: The RSAref2.0 tookit is available on at least 3 ftp sites in Europe - and one in South Africa. - -[2]: Since I always get questions when I post benchmark numbers :-), - DES performace figures are in 1000's of bytes per second in cbc - mode using an 8192 byte buffer. The pentium 100 was running Windows NT - 3.51 DLLs and the 686/200 was running NextStep. - I quote pentium 100 benchmarks because it is basically the - 'entry level' computer that most people buy for personal use. - Windows 95 is the OS shipping on those boxes, so I'll give - NT numbers (the same Win32 runtime environment). The 686 - numbers are present as an indication of where we will be in a - few years. --- -Eric Young | BOOL is tri-state according to Bill Gates. -AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). - - - -==== lhash.doc ======================================================== - -The LHASH library. - -I wrote this library in 1991 and have since forgotten why I called it lhash. -It implements a hash table from an article I read at the -time from 'Communications of the ACM'. What makes this hash -table different is that as the table fills, the hash table is -increased (or decreased) in size via realloc(). -When a 'resize' is done, instead of all hashes being redistributed over -twice as many 'buckets', one bucket is split. So when an 'expand' is done, -there is only a minimal cost to redistribute some values. Subsequent -inserts will cause more single 'bucket' redistributions but there will -never be a sudden large cost due to redistributing all the 'buckets'. - -The state for a particular hash table is kept in the LHASH structure. -The LHASH structure also records statistics about most aspects of accessing -the hash table. This is mostly a legacy of my writing this library for -the reasons of implementing what looked like a nice algorithm rather than -for a particular software product. - -Internal stuff you probably don't want to know about. -The decision to increase or decrease the hash table size is made depending -on the 'load' of the hash table. The load is the number of items in the -hash table divided by the size of the hash table. The default values are -as follows. If (hash->up_load < load) => expand. -if (hash->down_load > load) => contract. The 'up_load' has a default value of -1 and 'down_load' has a default value of 2. These numbers can be modified -by the application by just playing with the 'up_load' and 'down_load' -variables. The 'load' is kept in a form which is multiplied by 256. So -hash->up_load=8*256; will cause a load of 8 to be set. - -If you are interested in performance the field to watch is -num_comp_calls. The hash library keeps track of the 'hash' value for -each item so when a lookup is done, the 'hashes' are compared, if -there is a match, then a full compare is done, and -hash->num_comp_calls is incremented. If num_comp_calls is not equal -to num_delete plus num_retrieve it means that your hash function is -generating hashes that are the same for different values. It is -probably worth changing your hash function if this is the case because -even if your hash table has 10 items in a 'bucked', it can be searched -with 10 'unsigned long' compares and 10 linked list traverses. This -will be much less expensive that 10 calls to you compare function. - -LHASH *lh_new( -unsigned long (*hash)(), -int (*cmp)()); - This function is used to create a new LHASH structure. It is passed - function pointers that are used to store and retrieve values passed - into the hash table. The 'hash' - function is a hashing function that will return a hashed value of - it's passed structure. 'cmp' is passed 2 parameters, it returns 0 - is they are equal, otherwise, non zero. - If there are any problems (usually malloc failures), NULL is - returned, otherwise a new LHASH structure is returned. The - hash value is normally truncated to a power of 2, so make sure - that your hash function returns well mixed low order bits. - -void lh_free( -LHASH *lh); - This function free()s a LHASH structure. If there is malloced - data in the hash table, it will not be freed. Consider using the - lh_doall function to deallocate any remaining entries in the hash - table. - -char *lh_insert( -LHASH *lh, -char *data); - This function inserts the data pointed to by data into the lh hash - table. If there is already and entry in the hash table entry, the - value being replaced is returned. A NULL is returned if the new - entry does not clash with an entry already in the table (the normal - case) or on a malloc() failure (perhaps I should change this....). - The 'char *data' is exactly what is passed to the hash and - comparison functions specified in lh_new(). - -char *lh_delete( -LHASH *lh, -char *data); - This routine deletes an entry from the hash table. The value being - deleted is returned. NULL is returned if there is no such value in - the hash table. - -char *lh_retrieve( -LHASH *lh, -char *data); - If 'data' is in the hash table it is returned, else NULL is - returned. The way these routines would normally be uses is that a - dummy structure would have key fields populated and then - ret=lh_retrieve(hash,&dummy);. Ret would now be a pointer to a fully - populated structure. - -void lh_doall( -LHASH *lh, -void (*func)(char *a)); - This function will, for every entry in the hash table, call function - 'func' with the data item as parameters. - This function can be quite useful when used as follows. - void cleanup(STUFF *a) - { STUFF_free(a); } - lh_doall(hash,cleanup); - lh_free(hash); - This can be used to free all the entries, lh_free() then - cleans up the 'buckets' that point to nothing. Be careful - when doing this. If you delete entries from the hash table, - in the call back function, the table may decrease in size, - moving item that you are - currently on down lower in the hash table. This could cause - some entries to be skipped. The best solution to this problem - is to set lh->down_load=0 before you start. This will stop - the hash table ever being decreased in size. - -void lh_doall_arg( -LHASH *lh; -void(*func)(char *a,char *arg)); -char *arg; - This function is the same as lh_doall except that the function - called will be passed 'arg' as the second argument. - -unsigned long lh_strhash( -char *c); - This function is a demo string hashing function. Since the LHASH - routines would normally be passed structures, this routine would - not normally be passed to lh_new(), rather it would be used in the - function passed to lh_new(). - -The next three routines print out various statistics about the state of the -passed hash table. These numbers are all kept in the lhash structure. - -void lh_stats( -LHASH *lh, -FILE *out); - This function prints out statistics on the size of the hash table, - how many entries are in it, and the number and result of calls to - the routines in this library. - -void lh_node_stats( -LHASH *lh, -FILE *out); - For each 'bucket' in the hash table, the number of entries is - printed. - -void lh_node_usage_stats( -LHASH *lh, -FILE *out); - This function prints out a short summary of the state of the hash - table. It prints what I call the 'load' and the 'actual load'. - The load is the average number of data items per 'bucket' in the - hash table. The 'actual load' is the average number of items per - 'bucket', but only for buckets which contain entries. So the - 'actual load' is the average number of searches that will need to - find an item in the hash table, while the 'load' is the average number - that will be done to record a miss. - -==== md2.doc ======================================================== - -The MD2 library. -MD2 is a message digest algorithm that can be used to condense an arbitrary -length message down to a 16 byte hash. The functions all need to be passed -a MD2_CTX which is used to hold the MD2 context during multiple MD2_Update() -function calls. The normal method of use for this library is as follows - -MD2_Init(...); -MD2_Update(...); -... -MD2_Update(...); -MD2_Final(...); - -This library requires the inclusion of 'md2.h'. - -The main negative about MD2 is that it is slow, especially when compared -to MD5. - -The functions are as follows: - -void MD2_Init( -MD2_CTX *c); - This function needs to be called to initiate a MD2_CTX structure for - use. - -void MD2_Update( -MD2_CTX *c; -unsigned char *data; -unsigned long len); - This updates the message digest context being generated with 'len' - bytes from the 'data' pointer. The number of bytes can be any - length. - -void MD2_Final( -unsigned char *md; -MD2_CTX *c; - This function is called when a message digest of the data digested - with MD2_Update() is wanted. The message digest is put in the 'md' - array and is MD2_DIGEST_LENGTH (16) bytes long. - -unsigned char *MD2( -unsigned long n; -unsigned char *d; -unsigned char *md; - This function performs a MD2_Init(), followed by a MD2_Update() - followed by a MD2_Final() (using a local MD2_CTX). - The resulting digest is put into 'md' if it is not NULL. - Regardless of the value of 'md', the message - digest is returned from the function. If 'md' was NULL, the message - digest returned is being stored in a static structure. - -==== md5.doc ======================================================== - -The MD5 library. -MD5 is a message digest algorithm that can be used to condense an arbitrary -length message down to a 16 byte hash. The functions all need to be passed -a MD5_CTX which is used to hold the MD5 context during multiple MD5_Update() -function calls. This library also contains random number routines that are -based on MD5 - -The normal method of use for this library is as follows - -MD5_Init(...); -MD5_Update(...); -... -MD5_Update(...); -MD5_Final(...); - -This library requires the inclusion of 'md5.h'. - -The functions are as follows: - -void MD5_Init( -MD5_CTX *c); - This function needs to be called to initiate a MD5_CTX structure for - use. - -void MD5_Update( -MD5_CTX *c; -unsigned char *data; -unsigned long len); - This updates the message digest context being generated with 'len' - bytes from the 'data' pointer. The number of bytes can be any - length. - -void MD5_Final( -unsigned char *md; -MD5_CTX *c; - This function is called when a message digest of the data digested - with MD5_Update() is wanted. The message digest is put in the 'md' - array and is MD5_DIGEST_LENGTH (16) bytes long. - -unsigned char *MD5( -unsigned char *d; -unsigned long n; -unsigned char *md; - This function performs a MD5_Init(), followed by a MD5_Update() - followed by a MD5_Final() (using a local MD5_CTX). - The resulting digest is put into 'md' if it is not NULL. - Regardless of the value of 'md', the message - digest is returned from the function. If 'md' was NULL, the message - digest returned is being stored in a static structure. - - -==== memory.doc ======================================================== - -In the interests of debugging SSLeay, there is an option to compile -using some simple memory leak checking. - -All malloc(), free() and realloc() calls in SSLeay now go via -Malloc(), Free() and Realloc() (except those in crypto/lhash). - -If CRYPTO_MDEBUG is defined, these calls are #defined to -CRYPTO_malloc(), CRYPTO_free() and CRYPTO_realloc(). -If it is not defined, they are #defined to malloc(), free() and realloc(). - -the CRYPTO_malloc() routines by default just call the underlying library -functons. - -If CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) is called, memory leak detection is -turned on. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) turns it off. - -When turned on, each Malloc() or Realloc() call is recored along with the file -and line number from where the call was made. (This is done using the -lhash library which always uses normal system malloc(3) routines). - -void CRYPTO_mem_leaks(BIO *b); -void CRYPTO_mem_leaks_fp(FILE *fp); -These both print out the list of memory that has not been free()ed. -This will probably be rather hard to read, but if you look for the 'top level' -structure allocation, this will often give an idea as to what is not being -free()ed. I don't expect people to use this stuff normally. - -==== ca.1 ======================================================== - -From eay@orb.mincom.oz.au Thu Dec 28 23:56:45 1995 -Received: by orb.mincom.oz.au id AA07374 - (5.65c/IDA-1.4.4 for eay); Thu, 28 Dec 1995 13:56:45 +1000 -Date: Thu, 28 Dec 1995 13:56:45 +1000 (EST) -From: Eric Young <eay@mincom.oz.au> -X-Sender: eay@orb -To: sameer <sameer@c2.org> -Cc: ssleay@mincom.oz.au -Subject: Re: 'ca' -In-Reply-To: <199512230440.UAA23410@infinity.c2.org> -Message-Id: <Pine.SOL.3.91.951228133525.7269A-100000@orb> -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII -Status: RO -X-Status: - -On Fri, 22 Dec 1995, sameer wrote: -> I could use documentation on 'ca'. Thanks. - -Very quickly. -The ca program uses the ssleay.conf file for most of its configuration - -./ca -help - - -verbose - Talk alot while doing things - -config file - A config file. If you don't want to use the - default config file - -name arg - The particular CA definition to use - In the config file, the section to use for parameters. This lets - multiple setups to be contained in the one file. By default, the - default_ca variable is looked up in the [ ca ] section. So in the - shipped ssleay.conf, the CA definition used is CA_default. It could be - any other name. - -gencrl days - Generate a new CRL, days is when the next CRL is due - This will generate a new certificate revocion list. - -days arg - number of days to certify the certificate for - When certifiying certificates, this is the number of days to use. - -md arg - md to use, one of md2, md5, sha or sha1 - -policy arg - The CA 'policy' to support - I'll describe this later, but there are 2 policies definied in the - shipped ssleay.conf - -keyfile arg - PEM RSA private key file - -key arg - key to decode the RSA private key if it is encrypted - since we need to keep the CA's RSA key encrypted - -cert - The CA certificate - -in file - The input PEM encoded certificate request(s) - -out file - Where to put the output file(s) - -outdir dir - Where to put output certificates - The -out options concatinates all the output certificied - certificates to one file, -outdir puts them in a directory, - named by serial number. - -infiles .... - The last argument, requests to process - The certificate requests to process, -in is the same. - -Just about all the above have default values defined in ssleay.conf. - -The key variables in ssleay.conf are (for the pariticular '-name' being -used, in the default, it is CA_default). - -dir is where all the CA database stuff is kept. -certs is where all the previously issued certificates are kept. -The database is a simple text database containing the following tab separated -fields. -status: a value of 'R' - revoked, 'E' -expired or 'V' valid. -issued date: When the certificate was certified. -revoked date: When it was revoked, blank if not revoked. -serial number: The certificate serial number. -certificate: Where the certificate is located. -CN: The name of the certificate. - -The demo file has quite a few made up values it it. The last 2 were -added by the ca program and are acurate. -The CA program does not update the 'certificate' file correctly right now. -The serial field should be unique as should the CN/status combination. -The ca program checks these at startup. What still needs to be -wrtten is a program to 'regenerate' the data base file from the issued -certificate list (and a CRL list). - -Back to the CA_default variables. - -Most of the variables are commented. - -policy is the default policy. - -Ok for policies, they define the order and which fields must be present -in the certificate request and what gets filled in. - -So a value of -countryName = match -means that the country name must match the CA certificate. -organizationalUnitName = optional -The org.Unit,Name does not have to be present and -commonName = supplied -commonName must be supplied in the certificate request. - -For the 'policy_match' polocy, the order of the attributes in the -generated certiticate would be -countryName -stateOrProvinceName -organizationName -organizationalUnitName -commonName -emailAddress - -Have a play, it sort of makes sense. If you think about how the persona -requests operate, it is similar to the 'policy_match' policy and the -'policy_anything' is similar to what versign is doing. - -I hope this helps a bit. Some backend scripts are definitly needed to -update the database and to make certificate revocion easy. All -certificates issued should also be kept forever (or until they expire?) - -hope this helps -eric (who has to run off an buy some cheap knee pads for the caving in 4 -days time :-) - --- -Eric Young | Signature removed since it was generating -AARNet: eay@mincom.oz.au | more followups than the message contents :-) - - -==== ms3-ca.doc ======================================================== - -Date: Mon, 9 Jun 97 08:00:33 +0200 -From: Holger.Reif@PrakInf.TU-Ilmenau.DE (Holger Reif) -Subject: ms3-ca.doc -Organization: TU Ilmenau, Fak. IA, FG Telematik -Content-Length: 14575 -Status: RO -X-Status: - -Loading client certs into MSIE 3.01 -=================================== - -This document contains all the information necessary to successfully set up -some scripts to issue client certs to Microsoft Internet Explorer. It -includes the required knowledge about the model MSIE uses for client -certification and includes complete sample scripts ready to play with. The -scripts were tested against a modified ca program of SSLeay 0.6.6 and should -work with the regular ca program that comes with version 0.8.0. I haven't -tested against MSIE 4.0 - -You can use the information contained in this document in either way you -want. However if you feel it saved you a lot of time I ask you to be as fair -as to mention my name: Holger Reif <reif@prakinf.tu-ilmenau.de>. - -1.) The model used by MSIE --------------------------- - -The Internet Explorer doesn't come with a embedded engine for installing -client certs like Netscape's Navigator. It rather uses the CryptoAPI (CAPI) -defined by Microsoft. CAPI comes with WindowsNT 4.0 or is installed together -with Internet Explorer since 3.01. The advantage of this approach is a higher -flexibility because the certificates in the (per user) system open -certificate store may be used by other applications as well. The drawback -however is that you need to do a bit more work to get a client cert issued. - -CAPI defines functions which will handle basic cryptographic work, eg. -generating keys, encrypting some data, signing text or building a certificate -request. The procedure is as follows: A CAPI function generates you a key -pair and saves it into the certificate store. After that one builds a -Distinguished Name. Together with that key pair another CAPI function forms a -PKCS#10 request which you somehow need to submit to a CA. Finally the issued -cert is given to a yet another CAPI function which saves it into the -certificate store. - -The certificate store with the user's keys and certs is in the registry. You -will find it under HKEY_CURRENT_USER/Software/Microsoft/Cryptography/ (I -leave it to you as a little exercise to figure out what all the entries mean -;-). Note that the keys are protected only with the user's usual Windows -login password. - -2.) The practical usage ------------------------ - -Unfortunatly since CAPI is a system API you can't access its functions from -HTML code directly. For this purpose Microsoft provides a wrapper called -certenr3.dll. This DLL accesses the CAPI functions and provides an interface -usable from Visual Basic Script. One needs to install that library on the -computer which wants to have client cert. The easiest way is to load it as an -ActiveX control (certenr3.dll is properly authenticode signed by MS ;-). If -you have ever enrolled e cert request at a CA you will have installed it. - -At time of writing certenr3.dll is contained in -http://www.microsoft.com/workshop/prog/security/csa/certenr3.exe. It comes -with an README file which explains the available functions. It is labeled -beta but every CA seems to use it anyway. The license.txt allows you the -usage for your own purposes (as far as I understood) and a somehow limited -distribution. - -The two functions of main interest are GenerateKeyPair and AcceptCredentials. -For complete explanation of all possible parameters see the README file. Here -are only minimal required parameters and their values. - -GenerateKeyPair(sessionID, FASLE, szName, 0, "ClientAuth", TRUE, FALSE, 1) -- sessionID is a (locally to that computer) unique string to correlate the -generated key pair with a cert installed later. -- szName is the DN of the form "C=DE; S=Thueringen; L=Ilmenau; CN=Holger -Reif; 1.2.840.113549.1.9.1=reif@prakinf.tu-ilmenau.de". Note that S is the -abreviation for StateOrProvince. The recognized abreviation include CN, O, C, -OU, G, I, L, S, T. If the abreviation is unknown (eg. for PKCS#9 email addr) -you need to use the full object identifier. The starting point for searching -them could be crypto/objects.h since all OIDs know to SSLeay are listed -there. -- note: the possible ninth parameter which should give a default name to the -certificate storage location doesn't seem to work. Changes to the constant -values in the call above doesn't seem to make sense. You can't generate -PKCS#10 extensions with that function. - -The result of GenerateKeyPair is the base64 encoded PKCS#10 request. However -it has a little strange format that SSLeay doesn't accept. (BTW I feel the -decision of rejecting that format as standard conforming.) It looks like -follows: - 1st line with 76 chars - 2nd line with 76 chars - ... - (n-2)th line with 76 chars - (n-1)th line contains a multiple of 4 chars less then 76 (possible -empty) - (n)th line has zero or 4 chars (then with 1 or 2 equal signs - the - original text's lenght wasn'T a multiple of 3) - The line separator has two chars: 0x0d 0x0a - -AcceptCredentials(sessionID, credentials, 0, FALSE) -- sessionID needs to be the same as while generating the key pair -- credentials is the base64 encoded PKCS#7 object containing the cert. - -CRL's and CA certs are not required simply just the client cert. (It seems to -me that both are not even checked somehow.) The only format of the base64 -encoded object I succesfully used was all characters in a very long string -without line feeds or carriage returns. (Hey, it doesn't matter, only a -computer reads it!) - -The result should be S_OK. For error handling see the example that comes with -certenr3.dll. - -A note about ASN.1 character encodings. certenr3.dll seems to know only about -2 of them: UniversalString and PrintableString. First it is definitely wrong -for an email address which is IA5STRING (checked by ssleay's ca). Second -unfortunately MSIE (at least until version 3.02) can't handle UniversalString -correctly - they just blow up you cert store! Therefore ssleay's ca (starting -from version 0.8.0) tries to convert the encodings automatically to IA5STRING -or TeletexString. The beef is it will work only for the latin-1 (western) -charset. Microsoft still has to do abit of homework... - -3.) An example --------------- - -At least you need two steps: generating the key & request and then installing -the certificate. A real world CA would have some more steps involved, eg. -accepting some license. Note that both scripts shown below are just -experimental state without any warrenty! - -First how to generate a request. Note that we can't use a static page because -of the sessionID. I generate it from system time plus pid and hope it is -unique enough. Your are free to feed it through md5 to get more impressive -ID's ;-) Then the intended text is read in with sed which inserts the -sessionID. - ------BEGIN ms-enroll.cgi----- -#!/bin/sh -SESSION_ID=`date '+%y%m%d%H%M%S'`$$ -echo Content-type: text/html -echo -sed s/template_for_sessId/$SESSION_ID/ <<EOF -<HTML><HEAD> -<TITLE>Certificate Enrollment Test Page</TITLE> -</HEAD><BODY> - -<OBJECT - classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43" - codebase=certenr3.dll - id=certHelper - > -</OBJECT> - -<CENTER> -<H2>enrollment for a personal cert</H2> -<BR><HR WIDTH=50%><BR><P> -<FORM NAME="MSIE_Enrollment" ACTION="ms-gencert.cgi" ENCTYPE=x-www-form- -encoded METHOD=POST> -<TABLE> - <TR><TD>Country</TD><TD><INPUT NAME="Country" VALUE=""></TD></TR> - <TR><TD>State</TD><TD><INPUT NAME="StateOrProvince" VALUE=""></TD></TR> - <TR><TD>Location</TD><TD><INPUT NAME="Location" VALUE=""></TD></TR> - <TR><TD>Organization</TD><TD><INPUT NAME="Organization" -VALUE=""></TD></TR> - <TR><TD>Organizational Unit</TD> - <TD><INPUT NAME="OrganizationalUnit" VALUE=""></TD></TR> - <TR><TD>Name</TD><TD><INPUT NAME="CommonName" VALUE=""></TD></TR> - <TR><TD>eMail Address</TD> - <TD><INPUT NAME="EmailAddress" VALUE=""></TD></TR> - <TR><TD></TD> - <TD><INPUT TYPE="BUTTON" NAME="submit" VALUE="Beantragen"></TD></TR> -</TABLE> - <INPUT TYPE="hidden" NAME="SessionId" VALUE="template_for_sessId"> - <INPUT TYPE="hidden" NAME="Request" VALUE=""> -</FORM> -<BR><HR WIDTH=50%><BR><P> -</CENTER> - -<SCRIPT LANGUAGE=VBS> - Dim DN - - Sub Submit_OnClick - Dim TheForm - Set TheForm = Document.MSIE_Enrollment - sessionId = TheForm.SessionId.value - reqHardware = FALSE - C = TheForm.Country.value - SP = TheForm.StateOrProvince.value - L = TheForm.Location.value - O = TheForm.Organization.value - OU = TheForm.OrganizationalUnit.value - CN = TheForm.CommonName.value - Email = TheForm.EmailAddress.value - szPurpose = "ClientAuth" - doAcceptanceUINow = FALSE - doOnline = TRUE - - DN = "" - - Call Add_RDN("C", C) - Call Add_RDN("S", SP) - Call Add_RDN("L", L) - Call Add_RDN("O", O) - Call Add_RDN("OU", OU) - Call Add_RDN("CN", CN) - Call Add_RDN("1.2.840.113549.1.9.1", Email) - ' rsadsi - ' pkcs - ' pkcs9 - ' eMailAddress - On Error Resume Next - sz10 = certHelper.GenerateKeyPair(sessionId, _ - FALSE, DN, 0, ClientAuth, FASLE, TRUE, 1)_ - theError = Err.Number - On Error Goto 0 - if (sz10 = Empty OR theError <> 0) Then - sz = "The error '" & Hex(theError) & "' occurred." & chr(13) & _ - chr(10) & "Your credentials could not be generated." - result = MsgBox(sz, 0, "Credentials Enrollment") - Exit Sub - else - TheForm.Request.value = sz10 - TheForm.Submit - end if - End Sub - - Sub Add_RDN(sn, value) - if (value <> "") then - if (DN <> "") then - DN = DN & "; " - end if - DN = DN & sn & "=" & value - end if - End Sub -</SCRIPT> -</BODY> -</HTML> -EOF ------END ms-enroll.cgi----- - -Second, how to extract the request and feed the certificate back? We need to -"normalize" the base64 encoding of the PKCS#10 format which means -regenerating the lines and wrapping with BEGIN and END line. This is done by -gawk. The request is taken by ca the normal way. Then the cert needs to be -packed into a PKCS#7 structure (note: the use of a CRL is necessary for -crl2pkcs7 as of version 0.6.6. Starting with 0.8.0 it it might probably be -ommited). Finally we need to format the PKCS#7 object and generate the HTML -text. I use two templates to have a clearer script. - -1st note: postit2 is slightly modified from a program I found at ncsa's ftp -site. Grab it from http://www.easterngraphics.com/certs/IX9704/postit2.c. You -need utils.c from there too. - -2nd note: I'm note quite sure wether the gawk script really handles all -possible inputs for the request right! Today I don't use this construction -anymore myself. - -3d note: the cert must be of version 3! This could be done with the nsComment -line in ssleay.cnf... - -------BEGIN ms-gencert.cgi----- -#!/bin/sh -FILE="/tmp/"`date '+%y%m%d%H%M%S'-`$$ -rm -f "$FILE".* - -HOME=`pwd`; export HOME # as ssleay.cnf insists on having such an env var -cd /usr/local/ssl #where demoCA (as named in ssleay.conf) is located - -postit2 -s " " -i 0x0d > "$FILE".inp # process the FORM vars - -SESSION_ID=`gawk '$1 == "SessionId" { print $2; exit }' "$FILE".inp` - -gawk \ - 'BEGIN { \ - OFS = ""; \ - print "-----BEGIN CERTIFICATE REQUEST-----"; \ - req_seen=0 \ - } \ - $1 == "Request" { \ - req_seen=1; \ - if (length($2) == 72) print($2); \ - lastline=$2; \ - next; \ - } \ - { \ - if (req_seen == 1) { \ - if (length($1) >= 72) print($1); \ - else if (length(lastline) < 72) { \ - req_seen=0; \ - print (lastline,$1); \ - } \ - lastline=$1; \ - } \ - } \ - END { \ - print "-----END CERTIFICATE REQUEST-----"; \ - }' > "$FILE".pem < "$FILE".inp - -ssleay ca -batch -in "$FILE".pem -key passwd -out "$FILE".out -ssleay crl2pkcs7 -certfile "$FILE".out -out "$FILE".pkcs7 -in demoCA/crl.pem - -sed s/template_for_sessId/$SESSION_ID/ <ms-enroll2a.html >"$FILE".cert -/usr/local/bin/gawk \ - 'BEGIN { \ - OFS = ""; \ - dq = sprintf("%c",34); \ - } \ - $0 ~ "PKCS7" { next; } \ - { \ - print dq$0dq" & _"; \ - }' <"$FILE".pkcs7 >> "$FILE".cert -cat ms-enroll2b.html >>"$FILE".cert - -echo Content-type: text/html -echo Content-length: `wc -c "$FILE".cert` -echo -cat "$FILE".cert -rm -f "$FILE".* ------END ms-gencert.cgi----- - -----BEGIN ms-enroll2a.html---- -<HTML><HEAD><TITLE>Certificate Acceptance Test Page</TITLE></HEAD><BODY> - -<OBJECT - classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43" - codebase=certenr3.dll - id=certHelper - > -</OBJECT> - -<CENTER> -<H2>Your personal certificate</H2> -<BR><HR WIDTH=50%><BR><P> -Press the button! -<P><INPUT TYPE=BUTTON VALUE="Nimm mich!" NAME="InstallCert"> -</CENTER> -<BR><HR WIDTH=50%><BR> - -<SCRIPT LANGUAGE=VBS> - Sub InstallCert_OnClick - - sessionId = "template_for_sessId" -credentials = "" & _ -----END ms-enroll2a.html---- - -----BEGIN ms-enroll2b.html---- -"" - On Error Resume Next - result = certHelper.AcceptCredentials(sessionId, credentials, 0, -FALSE) - if (IsEmpty(result)) Then - sz = "The error '" & Err.Number & "' occurred." & chr(13) & -chr(10) & "This Digital ID could not be registered." - msgOut = MsgBox(sz, 0, "Credentials Registration Error") - navigate "error.html" - else - sz = "Digital ID successfully registered." - msgOut = MsgBox(sz, 0, "Credentials Registration") - navigate "success.html" - end if - Exit Sub - End Sub -</SCRIPT> -</BODY> -</HTML> -----END ms-enroll2b.html---- - -4.) What do do with the cert? ------------------------------ - -The cert is visible (without restarting MSIE) under the following menu: -View->Options->Security->Personal certs. You can examine it's contents at -least partially. - -To use it for client authentication you need to use SSL3.0 (fortunately -SSLeay supports it with 0.8.0). Furthermore MSIE is told to only supports a -kind of automatic selection of certs (I personally wasn't able to test it -myself). But there is a requirement that the issuer of the server cert and -the issuer of the client cert needs to be the same (according to a developer -from MS). Which means: you need may more then one cert to talk to all -servers... - -I'm sure we will get a bit more experience after ApacheSSL is available for -SSLeay 0.8.8. - - -I hope you enjoyed reading and that in future questions on this topic will -rarely appear on ssl-users@moncom.com ;-) - -Ilmenau, 9th of June 1997 -Holger Reif <reif@prakinf.tu-ilmenau.de> --- -read you later - Holger Reif ----------------------------------------- Signaturprojekt Deutsche Einheit -TU Ilmenau - Informatik - Telematik (Verdamp lang her) -Holger.Reif@PrakInf.TU-Ilmenau.DE Alt wie ein Baum werden, um ueber -http://Remus.PrakInf.TU-Ilmenau.DE/Reif/ alle 7 Bruecken gehen zu koennen - - -==== ns-ca.doc ======================================================== - -The following documentation was supplied by Jeff Barber, who provided the -patch to the CA program to add this functionality. - -eric --- -Jeff Barber Email: jeffb@issl.atl.hp.com - -Hewlett Packard Phone: (404) 648-9503 -Internet and System Security Lab Fax: (404) 648-9516 - - oo ----------------------cut /\ here for ns-ca.doc ------------------------------ - -This document briefly describes how to use SSLeay to implement a -certificate authority capable of dynamically serving up client -certificates for version 3.0 beta 5 (and presumably later) versions of -the Netscape Navigator. Before describing how this is done, it's -important to understand a little about how the browser implements its -client certificate support. This is documented in some detail in the -URLs based at <URL:http://home.netscape.com/eng/security/certs.html>. -Here's a brief overview: - -- The Navigator supports a new HTML tag "KEYGEN" which will cause - the browser to generate an RSA key pair when you submit a form - containing the tag. The public key, along with an optional - challenge (supposedly provided for use in certificate revocation - but I don't use it) is signed, DER-encoded, base-64 encoded - and sent to the web server as the value of the variable - whose NAME is provided in the KEYGEN tag. The private key is - stored by the browser in a local key database. - - This "Signed Public Key And Challenge" (SPKAC) arrives formatted - into 64 character lines (which are of course URL-encoded when - sent via HTTP -- i.e. spaces, newlines and most punctuatation are - encoded as "%HH" where HH is the hex equivalent of the ASCII code). - Note that the SPKAC does not contain the other usual attributes - of a certificate request, especially the subject name fields. - These must be otherwise encoded in the form for submission along - with the SPKAC. - -- Either immediately (in response to this form submission), or at - some later date (a real CA will probably verify your identity in - some way before issuing the certificate), a web server can send a - certificate based on the public key and other attributes back to - the browser by encoding it in DER (the binary form) and sending it - to the browser as MIME type: - "Content-type: application/x-x509-user-cert" - - The browser uses the public key encoded in the certificate to - associate the certificate with the appropriate private key in - its local key database. Now, the certificate is "installed". - -- When a server wants to require authentication based on client - certificates, it uses the right signals via the SSL protocol to - trigger the Navigator to ask you which certificate you want to - send. Whether the certificate is accepted is dependent on CA - certificates and so forth installed in the server and is beyond - the scope of this document. - - -Now, here's how the SSLeay package can be used to provide client -certficates: - -- You prepare a file for input to the SSLeay ca application. - The file contains a number of "name = value" pairs that identify - the subject. The names here are the same subject name component - identifiers used in the CA section of the lib/ssleay.conf file, - such as "emailAddress", "commonName" "organizationName" and so - forth. Both the long version and the short version (e.g. "Email", - "CN", "O") can be used. - - One more name is supported: this one is "SPKAC". Its value - is simply the value of the base-64 encoded SPKAC sent by the - browser (with all the newlines and other space charaters - removed -- and newline escapes are NOT supported). - - [ As of SSLeay 0.6.4, multiple lines are supported. - Put a \ at the end of each line and it will be joined with the - previous line with the '\n' removed - eay ] - - Here's a sample input file: - -C = US -SP = Georgia -O = Some Organization, Inc. -OU = Netscape Compatibility Group -CN = John X. Doe -Email = jxdoe@someorg.com -SPKAC = MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAwmk6FMJ4uAVIYbcvIOx5+bDGTfvL8X5gE+R67ccMk6rCSGbVQz2cetyQtnI+VIs0NwdD6wjuSuVtVFbLoHonowIDAQABFgAwDQYJKoZIhvcNAQEEBQADQQBFZDUWFl6BJdomtN1Bi53mwijy1rRgJ4YirF15yBEDM3DjAQkKXHYOIX+qpz4KXKnl6EYxTnGSFL5wWt8X2iyx - -- You execute the ca command (either from a CGI program run out of - the web server, or as a later manual task) giving it the above - file as input. For example, if the file were named /tmp/cert.req, - you'd run: - $SSLDIR/bin/ca -spkac /tmp/cert.req -out /tmp/cert - - The output is in DER format (binary) if a -out argument is - provided, as above; otherwise, it's in the PEM format (base-64 - encoded DER). Also, the "-batch" switch is implied by the - "-spkac" so you don't get asked whether to complete the signing - (probably it shouldn't work this way but I was only interested - in hacking together an online CA that could be used for issuing - test certificates). - - The "-spkac" capability doesn't support multiple files (I think). - - Any CHALLENGE provided in the SPKAC is simply ignored. - - The interactions between the identification fields you provide - and those identified in your lib/ssleay.conf are the same as if - you did an ordinary "ca -in infile -out outfile" -- that is, if - something is marked as required in the ssleay.conf file and it - isn't found in the -spkac file, the certificate won't be issued. - -- Now, you pick up the output from /tmp/cert and pass it back to - the Navigator prepending the Content-type string described earlier. - -- In order to run the ca command out of a CGI program, you must - provide a password to decrypt the CA's private key. You can - do this by using "echo MyKeyPassword | $SSLDIR/bin/ca ..." - I think there's a way to not encrypt the key file in the first - place, but I didn't see how to do that, so I made a small change - to the library that allows the password to be accepted from a pipe. - Either way is UTTERLY INSECURE and a real CA would never do that. - - [ You can use the 'ssleay rsa' command to remove the password - from the private key, or you can use the '-key' option to the - ca command to specify the decryption key on the command line - or use the -nodes option when generating the key. - ca will try to clear the command line version of the password - but for quite a few operating systems, this is not possible. - - eric ] - -So, what do you have to do to make use of this stuff to create an online -demo CA capability with SSLeay? - -1 Create an HTML form for your users. The form should contain - fields for all of the required or optional fields in ssleay.conf. - The form must contain a KEYGEN tag somewhere with at least a NAME - attribute. - -2 Create a CGI program to process the form input submitted by the - browser. The CGI program must URL-decode the variables and create - the file described above, containing subject identification info - as well as the SPKAC block. It should then run the the ca program - with the -spkac option. If it works (check the exit status), - return the new certificate with the appropriate MIME type. If not, - return the output of the ca command with MIME type "text/plain". - -3 Set up your web server to accept connections signed by your demo - CA. This probably involves obtaining the PEM-encoded CA certificate - (ordinarily in $SSLDIR/CA/cacert.pem) and installing it into a - server database. See your server manual for instructions. - - -==== obj.doc ======================================================== - -The Object library. - -As part of my Crypto library, I found I required a method of identifying various -objects. These objects normally had 3 different values associated with -them, a short text name, a long (or lower case) text name, and an -ASN.1 Object Identifier (which is a sequence of numbers). -This library contains a static list of objects and functions to lookup -according to one type and to return the other types. - -To use these routines, 'Object.h' needs to be included. - -For each supported object, #define entries are defined as follows -#define SN_Algorithm "Algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 38 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -SN_ stands for short name. -LN_ stands for either long name or lowercase name. -NID_ stands for Numeric ID. I each object has a unique NID and this - should be used internally to identify objects. -OBJ_ stands for ASN.1 Object Identifier or ASN1_OBJECT as defined in the - ASN1 routines. These values are used in ASN1 encoding. - -The following functions are to be used to return pointers into a static -definition of these types. What this means is "don't try to free() any -pointers returned from these functions. - -ASN1_OBJECT *OBJ_nid2obj( -int n); - Return the ASN1_OBJECT that corresponds to a NID of n. - -char *OBJ_nid2ln( -int n); - Return the long/lower case name of the object represented by the - NID of n. - -char *OBJ_nid2sn( -int n); - Return the short name for the object represented by the NID of n. - -ASN1_OBJECT *OBJ_dup( -ASN1_OBJECT *o); - Duplicate and return a new ASN1_OBJECT that is the same as the - passed parameter. - -int OBJ_obj2nid( -ASN1_OBJECT *o); - Given ASN1_OBJECT o, return the NID that corresponds. - -int OBJ_ln2nid( -char *s); - Given the long/lower case name 's', return the NID of the object. - -int OBJ_sn2nid( -char *s); - Given the short name 's', return the NID of the object. - -char *OBJ_bsearch( -char *key, -char *base, -int num, -int size, -int (*cmp)()); - Since I have come across a few platforms that do not have the - bsearch() function, OBJ_bsearch is my version of that function. - Feel free to use this function, but you may as well just use the - normal system bsearch(3) if it is present. This version also - has tolerance of being passed NULL pointers. - -==== keys =========================================================== - -EVP_PKEY_DSA -EVP_PKEY_DSA2 -EVP_PKEY_DSA3 -EVP_PKEY_DSA4 - -EVP_PKEY_RSA -EVP_PKEY_RSA2 - -valid DSA pkey types - NID_dsa - NID_dsaWithSHA - NID_dsaWithSHA1 - NID_dsaWithSHA1_2 - -valid RSA pkey types - NID_rsaEncryption - NID_rsa - -NID_dsaWithSHA NID_dsaWithSHA DSA SHA -NID_dsa NID_dsaWithSHA1 DSA SHA1 -NID_md2 NID_md2WithRSAEncryption RSA-pkcs1 MD2 -NID_md5 NID_md5WithRSAEncryption RSA-pkcs1 MD5 -NID_mdc2 NID_mdc2WithRSA RSA-none MDC2 -NID_ripemd160 NID_ripemd160WithRSA RSA-pkcs1 RIPEMD160 -NID_sha NID_shaWithRSAEncryption RSA-pkcs1 SHA -NID_sha1 NID_sha1WithRSAEncryption RSA-pkcs1 SHA1 - -==== rand.doc ======================================================== - -My Random number library. - -These routines can be used to generate pseudo random numbers and can be -used to 'seed' the pseudo random number generator (RNG). The RNG make no -effort to reproduce the same random number stream with each execution. -Various other routines in the SSLeay library 'seed' the RNG when suitable -'random' input data is available. Read the section at the end for details -on the design of the RNG. - -void RAND_bytes( -unsigned char *buf, -int num); - This routine puts 'num' random bytes into 'buf'. One should make - sure RAND_seed() has been called before using this routine. - -void RAND_seed( -unsigned char *buf, -int num); - This routine adds more 'seed' data the RNG state. 'num' bytes - are added to the RNG state, they are taken from 'buf'. This - routine can be called with sensitive data such as user entered - passwords. This sensitive data is in no way recoverable from - the RAND library routines or state. Try to pass as much data - from 'random' sources as possible into the RNG via this function. - Also strongly consider using the RAND_load_file() and - RAND_write_file() routines. - -void RAND_cleanup(); - When a program has finished with the RAND library, if it so - desires, it can 'zero' all RNG state. - -The following 3 routines are convenience routines that can be used to -'save' and 'restore' data from/to the RNG and it's state. -Since the more 'random' data that is feed as seed data the better, why not -keep it around between executions of the program? Of course the -application should pass more 'random' data in via RAND_seed() and -make sure no-one can read the 'random' data file. - -char *RAND_file_name( -char *buf, -int size); - This routine returns a 'default' name for the location of a 'rand' - file. The 'rand' file should keep a sequence of random bytes used - to initialise the RNG. The filename is put in 'buf'. Buf is 'size' - bytes long. Buf is returned if things go well, if they do not, - NULL is returned. The 'rand' file name is generated in the - following way. First, if there is a 'RANDFILE' environment - variable, it is returned. Second, if there is a 'HOME' environment - variable, $HOME/.rand is returned. Third, NULL is returned. NULL - is also returned if a buf would overflow. - -int RAND_load_file( -char *file, -long number); - This function 'adds' the 'file' into the RNG state. It does this by - doing a RAND_seed() on the value returned from a stat() system call - on the file and if 'number' is non-zero, upto 'number' bytes read - from the file. The number of bytes passed to RAND_seed() is returned. - -int RAND_write_file( -char *file), - RAND_write_file() writes N random bytes to the file 'file', where - N is the size of the internal RND state (currently 1k). - This is a suitable method of saving RNG state for reloading via - RAND_load_file(). - -What follows is a description of this RNG and a description of the rational -behind it's design. - -It should be noted that this RNG is intended to be used to generate -'random' keys for various ciphers including generation of DH and RSA keys. - -It should also be noted that I have just created a system that I am happy with. -It may be overkill but that does not worry me. I have not spent that much -time on this algorithm so if there are glaring errors, please let me know. -Speed has not been a consideration in the design of these routines. - -First up I will state the things I believe I need for a good RNG. -1) A good hashing algorithm to mix things up and to convert the RNG 'state' - to random numbers. -2) An initial source of random 'state'. -3) The state should be very large. If the RNG is being used to generate - 4096 bit RSA keys, 2 2048 bit random strings are required (at a minimum). - If your RNG state only has 128 bits, you are obviously limiting the - search space to 128 bits, not 2048. I'm probably getting a little - carried away on this last point but it does indicate that it may not be - a bad idea to keep quite a lot of RNG state. It should be easier to - break a cipher than guess the RNG seed data. -4) Any RNG seed data should influence all subsequent random numbers - generated. This implies that any random seed data entered will have - an influence on all subsequent random numbers generated. -5) When using data to seed the RNG state, the data used should not be - extractable from the RNG state. I believe this should be a - requirement because one possible source of 'secret' semi random - data would be a private key or a password. This data must - not be disclosed by either subsequent random numbers or a - 'core' dump left by a program crash. -6) Given the same initial 'state', 2 systems should deviate in their RNG state - (and hence the random numbers generated) over time if at all possible. -7) Given the random number output stream, it should not be possible to determine - the RNG state or the next random number. - - -The algorithm is as follows. - -There is global state made up of a 1023 byte buffer (the 'state'), a -working message digest ('md') and a counter ('count'). - -Whenever seed data is added, it is inserted into the 'state' as -follows. - The input is chopped up into units of 16 bytes (or less for - the last block). Each of these blocks is run through the MD5 - message digest. The data passed to the MD5 digest is the - current 'md', the same number of bytes from the 'state' - (the location determined by in incremented looping index) as - the current 'block' and the new key data 'block'. The result - of this is kept in 'md' and also xored into the 'state' at the - same locations that were used as input into the MD5. - I believe this system addresses points 1 (MD5), 3 (the 'state'), - 4 (via the 'md'), 5 (by the use of MD5 and xor). - -When bytes are extracted from the RNG, the following process is used. -For each group of 8 bytes (or less), we do the following, - Input into MD5, the top 8 bytes from 'md', the byte that are - to be overwritten by the random bytes and bytes from the - 'state' (incrementing looping index). From this digest output - (which is kept in 'md'), the top (upto) 8 bytes are - returned to the caller and the bottom (upto) 8 bytes are xored - into the 'state'. - Finally, after we have finished 'generation' random bytes for the - called, 'count' (which is incremented) and 'md' are fed into MD5 and - the results are kept in 'md'. - I believe the above addressed points 1 (use of MD5), 6 (by - hashing into the 'state' the 'old' data from the caller that - is about to be overwritten) and 7 (by not using the 8 bytes - given to the caller to update the 'state', but they are used - to update 'md'). - -So of the points raised, only 2 is not addressed, but sources of -random data will always be a problem. - - -==== rc2.doc ======================================================== - -The RC2 library. - -RC2 is a block cipher that operates on 64bit (8 byte) quantities. It -uses variable size key, but 128bit (16 byte) key would normally be considered -good. It can be used in all the modes that DES can be used. This -library implements the ecb, cbc, cfb64, ofb64 modes. - -I have implemented this library from an article posted to sci.crypt on -11-Feb-1996. I personally don't know how far to trust the RC2 cipher. -While it is capable of having a key of any size, not much reseach has -publically been done on it at this point in time (Apr-1996) -since the cipher has only been public for a few months :-) -It is of a similar speed to DES and IDEA, so unless it is required for -meeting some standard (SSLv2, perhaps S/MIME), it would probably be advisable -to stick to IDEA, or for the paranoid, Tripple DES. - -Mind you, having said all that, I should mention that I just read alot and -implement ciphers, I'm a 'babe in the woods' when it comes to evaluating -ciphers :-). - -For all calls that have an 'input' and 'output' variables, they can be the -same. - -This library requires the inclusion of 'rc2.h'. - -All of the encryption functions take what is called an RC2_KEY as an -argument. An RC2_KEY is an expanded form of the RC2 key. -For all modes of the RC2 algorithm, the RC2_KEY used for -decryption is the same one that was used for encryption. - -The define RC2_ENCRYPT is passed to specify encryption for the functions -that require an encryption/decryption flag. RC2_DECRYPT is passed to -specify decryption. - -Please note that any of the encryption modes specified in my DES library -could be used with RC2. I have only implemented ecb, cbc, cfb64 and -ofb64 for the following reasons. -- ecb is the basic RC2 encryption. -- cbc is the normal 'chaining' form for block ciphers. -- cfb64 can be used to encrypt single characters, therefore input and output - do not need to be a multiple of 8. -- ofb64 is similar to cfb64 but is more like a stream cipher, not as - secure (not cipher feedback) but it does not have an encrypt/decrypt mode. -- If you want triple RC2, thats 384 bits of key and you must be totally - obsessed with security. Still, if you want it, it is simple enough to - copy the function from the DES library and change the des_encrypt to - RC2_encrypt; an exercise left for the paranoid reader :-). - -The functions are as follows: - -void RC2_set_key( -RC2_KEY *ks; -int len; -unsigned char *key; -int bits; - RC2_set_key converts an 'len' byte key into a RC2_KEY. - A 'ks' is an expanded form of the 'key' which is used to - perform actual encryption. It can be regenerated from the RC2 key - so it only needs to be kept when encryption or decryption is about - to occur. Don't save or pass around RC2_KEY's since they - are CPU architecture dependent, 'key's are not. RC2 is an - interesting cipher in that it can be used with a variable length - key. 'len' is the length of 'key' to be used as the key. - A 'len' of 16 is recomended. The 'bits' argument is an - interesting addition which I only found out about in Aug 96. - BSAFE uses this parameter to 'limit' the number of bits used - for the key. To use the 'key' unmodified, set bits to 1024. - This is what old versions of my RC2 library did (SSLeay 0.6.3). - RSAs BSAFE library sets this parameter to be 128 if 128 bit - keys are being used. So to be compatable with BSAFE, set it - to 128, if you don't want to reduce RC2's key length, leave it - at 1024. - -void RC2_encrypt( -unsigned long *data, -RC2_KEY *key, -int encrypt); - This is the RC2 encryption function that gets called by just about - every other RC2 routine in the library. You should not use this - function except to implement 'modes' of RC2. I say this because the - functions that call this routine do the conversion from 'char *' to - long, and this needs to be done to make sure 'non-aligned' memory - access do not occur. - Data is a pointer to 2 unsigned long's and key is the - RC2_KEY to use. Encryption or decryption is indicated by 'encrypt'. - which can have the values RC2_ENCRYPT or RC2_DECRYPT. - -void RC2_ecb_encrypt( -unsigned char *in, -unsigned char *out, -RC2_KEY *key, -int encrypt); - This is the basic Electronic Code Book form of RC2 (in DES this - mode is called Electronic Code Book so I'm going to use the term - for rc2 as well. - Input is encrypted into output using the key represented by - key. Depending on the encrypt, encryption or - decryption occurs. Input is 8 bytes long and output is 8 bytes. - -void RC2_cbc_encrypt( -unsigned char *in, -unsigned char *out, -long length, -RC2_KEY *ks, -unsigned char *ivec, -int encrypt); - This routine implements RC2 in Cipher Block Chaining mode. - Input, which should be a multiple of 8 bytes is encrypted - (or decrypted) to output which will also be a multiple of 8 bytes. - The number of bytes is in length (and from what I've said above, - should be a multiple of 8). If length is not a multiple of 8, bad - things will probably happen. ivec is the initialisation vector. - This function updates iv after each call so that it can be passed to - the next call to RC2_cbc_encrypt(). - -void RC2_cfb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -RC2_KEY *schedule, -unsigned char *ivec, -int *num, -int encrypt); - This is one of the more useful functions in this RC2 library, it - implements CFB mode of RC2 with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - 'Encrypt' is used to indicate encryption or decryption. - CFB64 mode operates by using the cipher to generate a stream - of bytes which is used to encrypt the plain text. - The cipher text is then encrypted to generate the next 64 bits to - be xored (incrementally) with the next 64 bits of plain - text. As can be seen from this, to encrypt or decrypt, - the same 'cipher stream' needs to be generated but the way the next - block of data is gathered for encryption is different for - encryption and decryption. - -void RC2_ofb64_encrypt( -unsigned char *in, -unsigned char *out, -long length, -RC2_KEY *schedule, -unsigned char *ivec, -int *num); - This functions implements OFB mode of RC2 with 64bit feedback. - This allows you to encrypt an arbitrary number of bytes, - you do not require 8 byte padding. Each call to this - routine will encrypt the input bytes to output and then update ivec - and num. Num contains 'how far' we are though ivec. - This is in effect a stream cipher, there is no encryption or - decryption mode. - -For reading passwords, I suggest using des_read_pw_string() from my DES library. -To generate a password from a text string, I suggest using MD5 (or MD2) to -produce a 16 byte message digest that can then be passed directly to -RC2_set_key(). - -===== -For more information about the specific RC2 modes in this library -(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the -documentation on my DES library. What is said about DES is directly -applicable for RC2. - - -==== rc4.doc ======================================================== - -The RC4 library. -RC4 is a stream cipher that operates on a byte stream. It can be used with -any length key but I would recommend normally using 16 bytes. - -This library requires the inclusion of 'rc4.h'. - -The RC4 encryption function takes what is called an RC4_KEY as an argument. -The RC4_KEY is generated by the RC4_set_key function from the key bytes. - -RC4, being a stream cipher, does not have an encryption or decryption mode. -It produces a stream of bytes that the input stream is xor'ed against and -so decryption is just a case of 'encrypting' again with the same key. - -I have only put in one 'mode' for RC4 which is the normal one. This means -there is no initialisation vector and there is no feedback of the cipher -text into the cipher. This implies that you should not ever use the -same key twice if you can help it. If you do, you leave yourself open to -known plain text attacks; if you know the plain text and -corresponding cipher text in one message, all messages that used the same -key can have the cipher text decoded for the corresponding positions in the -cipher stream. - -The main positive feature of RC4 is that it is a very fast cipher; about 4 -times faster that DES. This makes it ideally suited to protocols where the -key is randomly chosen, like SSL. - -The functions are as follows: - -void RC4_set_key( -RC4_KEY *key; -int len; -unsigned char *data); - This function initialises the RC4_KEY structure with the key passed - in 'data', which is 'len' bytes long. The key data can be any - length but 16 bytes seems to be a good number. - -void RC4( -RC4_KEY *key; -unsigned long len; -unsigned char *in; -unsigned char *out); - Do the actual RC4 encryption/decryption. Using the 'key', 'len' - bytes are transformed from 'in' to 'out'. As mentioned above, - decryption is the operation as encryption. - -==== ref.doc ======================================================== - -I have lots more references etc, and will update this list in the future, -30 Aug 1996 - eay - - -SSL The SSL Protocol - from Netscapes. - -RC4 Newsgroups: sci.crypt - From: sterndark@netcom.com (David Sterndark) - Subject: RC4 Algorithm revealed. - Message-ID: <sternCvKL4B.Hyy@netcom.com> - -RC2 Newsgroups: sci.crypt - From: pgut01@cs.auckland.ac.nz (Peter Gutmann) - Subject: Specification for Ron Rivests Cipher No.2 - Message-ID: <4fk39f$f70@net.auckland.ac.nz> - -MD2 RFC1319 The MD2 Message-Digest Algorithm -MD5 RFC1321 The MD5 Message-Digest Algorithm - -X509 Certificates - RFC1421 Privacy Enhancement for Internet Electronic Mail: Part I - RFC1422 Privacy Enhancement for Internet Electronic Mail: Part II - RFC1423 Privacy Enhancement for Internet Electronic Mail: Part III - RFC1424 Privacy Enhancement for Internet Electronic Mail: Part IV - -RSA and various standard encoding - PKCS#1 RSA Encryption Standard - PKCS#5 Password-Based Encryption Standard - PKCS#7 Cryptographic Message Syntax Standard - A Layman's Guide to a Subset of ASN.1, BER, and DER - An Overview of the PKCS Standards - Some Examples of the PKCS Standards - -IDEA Chapter 3 The Block Cipher IDEA - -RSA, prime number generation and bignum algorithms - Introduction To Algorithms, - Thomas Cormen, Charles Leiserson, Ronald Rivest, - Section 29 Arithmetic Circuits - Section 33 Number-Theoretic Algorithms - -Fast Private Key algorithm - Fast Decipherment Algorithm for RSA Public-Key Cryptosystem - J.-J. Quisquater and C. Couvreur, Electronics Letters, - 14th October 1982, Vol. 18 No. 21 - -Prime number generation and bignum algorithms. - PGP-2.3a - -==== rsa.doc ======================================================== - -The RSA encryption and utility routines. - -The RSA routines are built on top of a big number library (the BN library). -There are support routines in the X509 library for loading and manipulating -the various objects in the RSA library. When errors are returned, read -about the ERR library for how to access the error codes. - -All RSA encryption is done according to the PKCS-1 standard which is -compatible with PEM and RSAref. This means that any values being encrypted -must be less than the size of the modulus in bytes, minus 10, bytes long. - -This library uses RAND_bytes()() for it's random data, make sure to feed -RAND_seed() with lots of interesting and varied data before using these -routines. - -The RSA library has one specific data type, the RSA structure. -It is composed of 8 BIGNUM variables (see the BN library for details) and -can hold either a private RSA key or a public RSA key. -Some RSA libraries have different structures for public and private keys, I -don't. For my libraries, a public key is determined by the fact that the -RSA->d value is NULL. These routines will operate on any size RSA keys. -While I'm sure 4096 bit keys are very very secure, they take a lot longer -to process that 1024 bit keys :-). - -The function in the RSA library are as follows. - -RSA *RSA_new(); - This function creates a new RSA object. The sub-fields of the RSA - type are also malloced so you should always use this routine to - create RSA variables. - -void RSA_free( -RSA *rsa); - This function 'frees' an RSA structure. This routine should always - be used to free the RSA structure since it will also 'free' any - sub-fields of the RSA type that need freeing. - -int RSA_size( -RSA *rsa); - This function returns the size of the RSA modulus in bytes. Why do - I need this you may ask, well the reason is that when you encrypt - with RSA, the output string will be the size of the RSA modulus. - So the output for the RSA_encrypt and the input for the RSA_decrypt - routines need to be RSA_size() bytes long, because this is how many - bytes are expected. - -For the following 4 RSA encryption routines, it should be noted that -RSA_private_decrypt() should be used on the output from -RSA_public_encrypt() and RSA_public_decrypt() should be used on -the output from RSA_private_encrypt(). - -int RSA_public_encrypt( -int from_len; -unsigned char *from -unsigned char *to -RSA *rsa); - This function implements RSA public encryption, the rsa variable - should be a public key (but can be a private key). 'from_len' - bytes taken from 'from' and encrypted and put into 'to'. 'to' needs - to be at least RSA_size(rsa) bytes long. The number of bytes - written into 'to' is returned. -1 is returned on an error. The - operation performed is - to = from^rsa->e mod rsa->n. - -int RSA_private_encrypt( -int from_len; -unsigned char *from -unsigned char *to -RSA *rsa); - This function implements RSA private encryption, the rsa variable - should be a private key. 'from_len' bytes taken from - 'from' and encrypted and put into 'to'. 'to' needs - to be at least RSA_size(rsa) bytes long. The number of bytes - written into 'to' is returned. -1 is returned on an error. The - operation performed is - to = from^rsa->d mod rsa->n. - -int RSA_public_decrypt( -int from_len; -unsigned char *from -unsigned char *to -RSA *rsa); - This function implements RSA public decryption, the rsa variable - should be a public key (but can be a private key). 'from_len' - bytes are taken from 'from' and decrypted. The decrypted data is - put into 'to'. The number of bytes encrypted is returned. -1 is - returned to indicate an error. The operation performed is - to = from^rsa->e mod rsa->n. - -int RSA_private_decrypt( -int from_len; -unsigned char *from -unsigned char *to -RSA *rsa); - This function implements RSA private decryption, the rsa variable - should be a private key. 'from_len' bytes are taken - from 'from' and decrypted. The decrypted data is - put into 'to'. The number of bytes encrypted is returned. -1 is - returned to indicate an error. The operation performed is - to = from^rsa->d mod rsa->n. - -int RSA_mod_exp( -BIGNUM *n; -BIGNUM *p; -RSA *rsa); - Normally you will never use this routine. - This is really an internal function which is called by - RSA_private_encrypt() and RSA_private_decrypt(). It performs - n=n^p mod rsa->n except that it uses the 5 extra variables in the - RSA structure to make this more efficient. - -RSA *RSA_generate_key( -int bits; -unsigned long e; -void (*callback)(); -char *cb_arg; - This routine is used to generate RSA private keys. It takes - quite a period of time to run and should only be used to - generate initial private keys that should then be stored - for later use. The passed callback function - will be called periodically so that feedback can be given - as to how this function is progressing. - 'bits' is the length desired for the modulus, so it would be 1024 - to generate a 1024 bit private key. - 'e' is the value to use for the public exponent 'e'. Traditionally - it is set to either 3 or 0x10001. - The callback function (if not NULL) is called in the following - situations. - when we have generated a suspected prime number to test, - callback(0,num1++,cb_arg). When it passes a prime number test, - callback(1,num2++,cb_arg). When it is rejected as one of - the 2 primes required due to gcd(prime,e value) != 0, - callback(2,num3++,cb_arg). When finally accepted as one - of the 2 primes, callback(3,num4++,cb_arg). - - -==== rsaref.doc ======================================================== - -This package can be compiled to use the RSAref library. -This library is not allowed outside of the USA but inside the USA it is -claimed by RSA to be the only RSA public key library that can be used -besides BSAFE.. - -There are 2 files, rsaref/rsaref.c and rsaref/rsaref.h that contain the glue -code to use RSAref. These files were written by looking at the PGP -source code and seeing which routines it used to access RSAref. -I have also been sent by some-one a copy of the RSAref header file that -contains the library error codes. - -[ Jun 1996 update - I have recently gotten hold of RSAref 2.0 from - South Africa and have been doing some performace tests. ] - -They have now been tested against the recently announced RSAEURO -library. - -There are 2 ways to use SSLeay and RSAref. First, to build so that -the programs must be linked with RSAref, add '-DRSAref' to CFLAG in the top -level makefile and -lrsaref (or where ever you are keeping RSAref) to -EX_LIBS. - -To build a makefile via util/mk1mf.pl to do this, use the 'rsaref' option. - -The second method is to build as per normal and link applications with -the RSAglue library. The correct library order would be -cc -o cmd cmd.o -lssl -lRSAglue -lcrypto -lrsaref -ldes -The RSAglue library is built in the rsa directory and is NOT -automatically installed. - -Be warned that the RSAEURO library, that is claimed to be compatible -with RSAref contains a different value for the maximum number of bits -supported. This changes structure sizes and so if you are using -RSAEURO, change the value of RSAref_MAX_BITS in rsa/rsaref.h - - -==== s_mult.doc ======================================================== - -s_mult is a test program I hacked up on a Sunday for testing non-blocking -IO. It has a select loop at it's centre that handles multiple readers -and writers. - -Try the following command -ssleay s_mult -echo -nbio -ssl -v -echo - sends any sent text back to the sender -nbio - turns on non-blocking IO -ssl - accept SSL connections, default is normal text -v - print lots - type Q<cr> to quit - -In another window, run the following -ssleay s_client -pause </etc/termcap - -The pause option puts in a 1 second pause in each read(2)/write(2) call -so the other end will have read()s fail. - -==== session.doc ======================================================== - -I have just checked over and re-worked the session stuff. -The following brief example will ignore all setup information to do with -authentication. - -Things operate as follows. - -The SSL environment has a 'context', a SSL_CTX structure. This holds the -cached SSL_SESSIONS (which can be reused) and the certificate lookup -information. Each SSL structure needs to be associated with a SSL_CTX. -Normally only one SSL_CTX structure is needed per program. - -SSL_CTX *SSL_CTX_new(void ); -void SSL_CTX_free(SSL_CTX *); -These 2 functions create and destroy SSL_CTX structures - -The SSL_CTX has a session_cache_mode which is by default, -in SSL_SESS_CACHE_SERVER mode. What this means is that the library -will automatically add new session-id's to the cache apon sucsessful -SSL_accept() calls. -If SSL_SESS_CACHE_CLIENT is set, then client certificates are also added -to the cache. -SSL_set_session_cache_mode(ctx,mode) will set the 'mode' and -SSL_get_session_cache_mode(ctx) will get the cache 'mode'. -The modes can be -SSL_SESS_CACHE_OFF - no caching -SSL_SESS_CACHE_CLIENT - only SSL_connect() -SSL_SESS_CACHE_SERVER - only SSL_accept() -SSL_SESS_NO_CACHE_BOTH - Either SSL_accept() or SSL_connect(). -If SSL_SESS_CACHE_NO_AUTO_CLEAR is set, old timed out sessions are -not automatically removed each 255, SSL_connect()s or SSL_accept()s. - -By default, apon every 255 successful SSL_connect() or SSL_accept()s, -the cache is flush. Please note that this could be expensive on -a heavily loaded SSL server, in which case, turn this off and -clear the cache of old entries 'manually' (with one of the functions -listed below) every few hours. Perhaps I should up this number, it is hard -to say. Remember, the '255' new calls is just a mechanims to get called -every now and then, in theory at most 255 new session-id's will have been -added but if 100 are added every minute, you would still have -500 in the cache before any would start being flushed (assuming a 3 minute -timeout).. - -int SSL_CTX_sess_hits(SSL_CTX *ctx); -int SSL_CTX_sess_misses(SSL_CTX *ctx); -int SSL_CTX_sess_timeouts(SSL_CTX *ctx); -These 3 functions return statistics about the SSL_CTX. These 3 are the -number of session id reuses. hits is the number of reuses, misses are the -number of lookups that failed, and timeouts is the number of cached -entries ignored because they had timeouted. - -ctx->new_session_cb is a function pointer to a function of type -int new_session_callback(SSL *ssl,SSL_SESSION *new); -This function, if set in the SSL_CTX structure is called whenever a new -SSL_SESSION is added to the cache. If the callback returns non-zero, it -means that the application will have to do a SSL_SESSION_free() -on the structure (this is -to do with the cache keeping the reference counts correct, without the -application needing to know about it. -The 'active' parameter is the current SSL session for which this connection -was created. - -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,int (*cb)()); -to set the callback, -int (*cb)() SSL_CTX_sess_get_new_cb(SSL_CTX *ctx) -to get the callback. - -If the 'get session' callback is set, when a session id is looked up and -it is not in the session-id cache, this callback is called. The callback is -of the form -SSL_SESSION *get_session_callback(unsigned char *sess_id,int sess_id_len, - int *copy); - -The get_session_callback is intended to return null if no session id is found. -The reference count on the SSL_SESSION in incremented by the SSL library, -if copy is 1. Otherwise, the reference count is not modified. - -void SSL_CTX_sess_set_get_cb(ctx,cb) sets the callback and -int (*cb)()SSL_CTX_sess_get_get_cb(ctx) returns the callback. - -These callbacks are basically indended to be used by processes to -send their session-id's to other processes. I currently have not implemented -non-blocking semantics for these callbacks, it is upto the appication -to make the callbacks effiecent if they require blocking (perhaps -by 'saving' them and then 'posting them' when control returns from -the SSL_accept(). - -LHASH *SSL_CTX_sessions(SSL_CTX *ctx) -This returns the session cache. The lhash strucutre can be accessed for -statistics about the cache. - -void lh_stats(LHASH *lh, FILE *out); -void lh_node_stats(LHASH *lh, FILE *out); -void lh_node_usage_stats(LHASH *lh, FILE *out); - -can be used to print details about it's activity and current state. -You can also delve directly into the lhash structure for 14 different -counters that are kept against the structure. When I wrote the lhash library, -I was interested in gathering statistics :-). -Have a read of doc/lhash.doc in the SSLeay distribution area for more details -on the lhash library. - -Now as mentioned ealier, when a SSL is created, it needs a SSL_CTX. -SSL * SSL_new(SSL_CTX *); - -This stores a session. A session is secret information shared between 2 -SSL contexts. It will only be created if both ends of the connection have -authenticated their peer to their satisfaction. It basically contains -the information required to use a particular secret key cipher. - -To retrieve the SSL_CTX being used by a SSL, -SSL_CTX *SSL_get_SSL_CTX(SSL *s); - -Now when a SSL session is established between to programs, the 'session' -information that is cached in the SSL_CTX can me manipulated by the -following functions. -int SSL_set_session(SSL *s, SSL_SESSION *session); -This will set the SSL_SESSION to use for the next SSL_connect(). If you use -this function on an already 'open' established SSL connection, 'bad things -will happen'. This function is meaning-less when used on a ssl strucutre -that is just about to be used in a SSL_accept() call since the -SSL_accept() will either create a new session or retrieve one from the -cache. - -SSL_SESSION *SSL_get_session(SSL *s); -This will return the SSL_SESSION for the current SSL, NULL if there is -no session associated with the SSL structure. - -The SSL sessions are kept in the SSL_CTX in a hash table, to remove a -session -void SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); -and to add one -int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); -SSL_CTX_add_session() returns 1 if the session was already in the cache (so it -was not added). -Whenever a new session is created via SSL_connect()/SSL_accept(), -they are automatically added to the cache, depending on the session_cache_mode -settings. SSL_set_session() -does not add it to the cache. Just call SSL_CTX_add_session() if you do want the -session added. For a 'client' this would not normally be the case. -SSL_CTX_add_session() is not normally ever used, except for doing 'evil' things -which the next 2 funtions help you do. - -int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length); -These 2 functions are in the standard ASN1 library form and can be used to -load and save to a byte format, the SSL_SESSION structure. -With these functions, you can save and read these structures to a files or -arbitary byte string. -The PEM_write_SSL_SESSION(fp,x) and PEM_read_SSL_SESSION(fp,x,cb) will -write to a file pointer in base64 encoding. - -What you can do with this, is pass session information between separate -processes. Please note, that you will probably also need to modify the -timeout information on the SSL_SESSIONs. - -long SSL_get_time(SSL_SESSION *s) -will return the 'time' that the session -was loaded. The timeout is relative to this time. This information is -saved when the SSL_SESSION is converted to binarary but it is stored -in as a unix long, which is rather OS dependant, but easy to convert back. - -long SSL_set_time(SSL_SESSION *s,long t) will set the above mentioned time. -The time value is just the value returned from time(3), and should really -be defined by be to be time_t. - -long SSL_get_timeout(SSL_SESSION *s); -long SSL_set_timeout(SSL_SESSION *s,long t); -These 2 retrieve and set the timeout which is just a number of secconds -from the 'SSL_get_time()' value. When this time period has elapesed, -the session will no longer be in the cache (well it will actually be removed -the next time it is attempted to be retrieved, so you could 'bump' -the timeout so it remains valid). -The 'time' and 'timeout' are set on a session when it is created, not reset -each time it is reused. If you did wish to 'bump it', just after establishing -a connection, do a -SSL_set_time(ssl,time(NULL)); - -You can also use -SSL_CTX_set_timeout(SSL_CTX *ctx,unsigned long t) and -SSL_CTX_get_timeout(SSL_CTX *ctx) to manipulate the default timeouts for -all SSL connections created against a SSL_CTX. If you set a timeout in -an SSL_CTX, all new SSL's created will inherit the timeout. It can be over -written by the SSL_set_timeout(SSL *s,unsigned long t) function call. -If you 'set' the timeout back to 0, the system default will be used. - -SSL_SESSION *SSL_SESSION_new(); -void SSL_SESSION_free(SSL_SESSION *ses); -These 2 functions are used to create and dispose of SSL_SESSION functions. -You should not ever normally need to use them unless you are using -i2d_SSL_SESSION() and/or d2i_SSL_SESSION(). If you 'load' a SSL_SESSION -via d2i_SSL_SESSION(), you will need to SSL_SESSION_free() it. -Both SSL_set_session() and SSL_CTX_add_session() will 'take copies' of the -structure (via reference counts) when it is passed to them. - -SSL_CTX_flush_sessions(ctx,time); -The first function will clear all sessions from the cache, which have expired -relative to 'time' (which could just be time(NULL)). - -SSL_CTX_flush_sessions(ctx,0); -This is a special case that clears everything. - -As a final comment, a 'session' is not enough to establish a new -connection. If a session has timed out, a certificate and private key -need to have been associated with the SSL structure. -SSL_copy_session_id(SSL *to,SSL *from); will copy not only the session -strucutre but also the private key and certificate associated with -'from'. - -EXAMPLES. - -So lets play at being a weird SSL server. - -/* setup a context */ -ctx=SSL_CTX_new(); - -/* Lets load some session from binary into the cache, why one would do - * this is not toally clear, but passing between programs does make sense - * Perhaps you are using 4096 bit keys and are happy to keep them - * valid for a week, to avoid the RSA overhead of 15 seconds, I'm not toally - * sure, perhaps this is a process called from an SSL inetd and this is being - * passed to the application. */ -session=d2i_SSL_SESSION(....) -SSL_CTX_add_session(ctx,session); - -/* Lets even add a session from a file */ -session=PEM_read_SSL_SESSION(....) -SSL_CTX_add_session(ctx,session); - -/* create a new SSL structure */ -ssl=SSL_new(ctx); - -/* At this point we want to be able to 'create' new session if - * required, so we need a certificate and RSAkey. */ -SSL_use_RSAPrivateKey_file(ssl,...) -SSL_use_certificate_file(ssl,...) - -/* Now since we are a server, it make little sence to load a session against - * the ssl strucutre since a SSL_accept() will either create a new session or - * grab an existing one from the cache. */ - -/* grab a socket descriptor */ -fd=accept(...); - -/* associated it with the ssl strucutre */ -SSL_set_fd(ssl,fd); - -SSL_accept(ssl); /* 'do' SSL using out cert and RSA key */ - -/* Lets print out the session details or lets save it to a file, - * perhaps with a secret key cipher, so that we can pass it to the FBI - * when they want to decode the session :-). While we have RSA - * this does not matter much but when I do SSLv3, this will allow a mechanism - * for the server/client to record the information needed to decode - * the traffic that went over the wire, even when using Diffie-Hellman */ -PEM_write_SSL_SESSION(SSL_get_session(ssl),stdout,....) - -Lets 'connect' back to the caller using the same session id. - -ssl2=SSL_new(ctx); -fd2=connect(them); -SSL_set_fd(ssl2,fd2); -SSL_set_session(ssl2,SSL_get_session(ssl)); -SSL_connect(ssl2); - -/* what the hell, lets accept no more connections using this session */ -SSL_CTX_remove_session(SSL_get_SSL_CTX(ssl),SSL_get_session(ssl)); - -/* we could have just as easily used ssl2 since they both are using the - * same session. - * You will note that both ssl and ssl2 are still using the session, and - * the SSL_SESSION structure will be free()ed when both ssl and ssl2 - * finish using the session. Also note that you could continue to initiate - * connections using this session by doing SSL_get_session(ssl) to get the - * existing session, but SSL_accept() will not be able to find it to - * use for incoming connections. - * Of corse, the session will timeout at the far end and it will no - * longer be accepted after a while. The time and timeout are ignored except - * by SSL_accept(). */ - -/* Since we have had our server running for 10 weeks, and memory is getting - * short, perhaps we should clear the session cache to remove those - * 100000 session entries that have expired. Some may consider this - * a memory leak :-) */ - -SSL_CTX_flush_sessions(ctx,time(NULL)); - -/* Ok, after a bit more time we wish to flush all sessions from the cache - * so that all new connections will be authenticated and incure the - * public key operation overhead */ - -SSL_CTX_flush_sessions(ctx,0); - -/* As a final note, to copy everything to do with a SSL, use */ -SSL_copy_session_id(SSL *to,SSL *from); -/* as this also copies the certificate and RSA key so new session can - * be established using the same details */ - - -==== sha.doc ======================================================== - -The SHA (Secure Hash Algorithm) library. -SHA is a message digest algorithm that can be used to condense an arbitrary -length message down to a 20 byte hash. The functions all need to be passed -a SHA_CTX which is used to hold the SHA context during multiple SHA_Update() -function calls. The normal method of use for this library is as follows -This library contains both SHA and SHA-1 digest algorithms. SHA-1 is -an update to SHA (which should really be called SHA-0 now) which -tweaks the algorithm slightly. The SHA-1 algorithm is used by simply -using SHA1_Init(), SHA1_Update(), SHA1_Final() and SHA1() instead of the -SHA*() calls - -SHA_Init(...); -SHA_Update(...); -... -SHA_Update(...); -SHA_Final(...); - -This library requires the inclusion of 'sha.h'. - -The functions are as follows: - -void SHA_Init( -SHA_CTX *c); - This function needs to be called to initiate a SHA_CTX structure for - use. - -void SHA_Update( -SHA_CTX *c; -unsigned char *data; -unsigned long len); - This updates the message digest context being generated with 'len' - bytes from the 'data' pointer. The number of bytes can be any - length. - -void SHA_Final( -unsigned char *md; -SHA_CTX *c; - This function is called when a message digest of the data digested - with SHA_Update() is wanted. The message digest is put in the 'md' - array and is SHA_DIGEST_LENGTH (20) bytes long. - -unsigned char *SHA( -unsigned char *d; -unsigned long n; -unsigned char *md; - This function performs a SHA_Init(), followed by a SHA_Update() - followed by a SHA_Final() (using a local SHA_CTX). - The resulting digest is put into 'md' if it is not NULL. - Regardless of the value of 'md', the message - digest is returned from the function. If 'md' was NULL, the message - digest returned is being stored in a static structure. - - -==== speed.doc ======================================================== - -To get an idea of the performance of this library, use -ssleay speed - -perl util/sp-diff.pl file1 file2 - -will print out the relative differences between the 2 files which are -expected to be the output from the speed program. - -The performace of the library is very dependant on the Compiler -quality and various flags used to build. - ---- - -These are some numbers I did comparing RSAref and SSLeay on a Pentium 100. -[ These numbers are all out of date, as of SSL - 0.6.1 the RSA -operations are about 2 times faster, so check the version number ] - -RSA performance. - -SSLeay 0.6.0 -Pentium 100, 32meg, Windows NT Workstation 3.51 -linux - gcc v 2.7.0 -O3 -fomit-frame-pointer -m486 -and -Windows NT - Windows NT 3.51 - Visual C++ 4.1 - 586 code + 32bit assember -Windows 3.1 - Windows NT 3.51 - Visual C++ 1.52c - 286 code + 32bit assember -NT Dos Shell- Windows NT 3.51 - Visual C++ 1.52c - 286 code + 16bit assember - -Times are how long it takes to do an RSA private key operation. - - 512bits 1024bits -------------------------------- -SSLeay NT dll 0.042s 0.202s see above -SSLeay linux 0.046s 0.218s Assember inner loops (normal build) -SSLeay linux 0.067s 0.380s Pure C code with BN_LLONG defined -SSLeay W3.1 dll 0.108s 0.478s see above -SSLeay linux 0.109s 0.713s C without BN_LLONG. -RSAref2.0 linux 0.149s 0.936s -SSLeay MS-DOS 0.197s 1.049s see above - -486DX66, 32meg, Windows NT Server 3.51 - 512bits 1024bits -------------------------------- -SSLeay NT dll 0.084s 0.495s <- SSLeay 0.6.3 -SSLeay NT dll 0.154s 0.882s -SSLeay W3.1 dll 0.335s 1.538s -SSLeay MS-DOS 0.490s 2.790s - -What I find cute is that I'm still faster than RSAref when using standard C, -without using the 'long long' data type :-), %35 faster for 512bit and we -scale up to 3.2 times faster for the 'default linux' build. I should mention -that people should 'try' to use either x86-lnx.s (elf), x86-lnxa.s or -x86-sol.s for any x86 based unix they are building on. The only problems -with be with syntax but the performance gain is quite large, especially for -servers. The code is very simple, you just need to modify the 'header'. - -The message is, if you are stuck using RSAref, the RSA performance will be -bad. Considering the code was compiled for a pentium, the 486DX66 number -would indicate 'Use RSAref and turn you Pentium 100 into a 486DX66' :-). -[ As of verson 0.6.1, it would be correct to say 'turn you pentium 100 - into a 486DX33' :-) ] - -I won't tell people if the DLL's are using RSAref or my stuff if no-one -asks :-). - -eric - -PS while I know I could speed things up further, I will probably not do - so due to the effort involved. I did do some timings on the - SSLeay bignum format -> RSAref number format conversion that occurs - each time RSAref is used by SSLeay, and the numbers are trivial. - 0.00012s a call for 512bit vs 0.149s for the time spent in the function. - 0.00018s for 1024bit vs 0.938s. Insignificant. - So the 'way to go', to support faster RSA libraries, if people are keen, - is to write 'glue' code in a similar way that I do for RSAref and send it - to me :-). - My base library still has the advantage of being able to operate on - any size numbers, and is not that far from the performance from the - leaders in the field. (-%30?) - [ Well as of 0.6.1 I am now the leader in the filed on x86 (we at - least very close :-) ] - - I suppose I should also mention some other numbers RSAref numbers, again - on my Pentium. - DES CBC EDE-DES MD5 - RSAref linux 830k/s 302k/s 4390k/s - SSLeay linux 855k/s 319k/s 10025k/s - SSLeay NT 1158k/s 410k/s 10470k/s - SSLeay w31 378k/s 143k/s 2383k/s (fully 16bit) - - Got to admit that Visual C++ 4.[01] is a damn fine compiler :-) --- -Eric Young | BOOL is tri-state according to Bill Gates. -AARNet: eay@cryptsoft.com | RTFM Win32 GetMessage(). - - - - -==== ssl-ciph.doc ======================================================== - -This is a quick high level summery of how things work now. - -Each SSLv2 and SSLv3 cipher is composed of 4 major attributes plus a few extra -minor ones. - -They are 'The key exchange algorithm', which is RSA for SSLv2 but can also -be Diffle-Hellman for SSLv3. - -An 'Authenticion algorithm', which can be RSA, Diffle-Helman, DSS or -none. - -The cipher - -The MAC digest. - -A cipher can also be an export cipher and is either an SSLv2 or a -SSLv3 ciphers. - -To specify which ciphers to use, one can either specify all the ciphers, -one at a time, or use 'aliases' to specify the preference and order for -the ciphers. - -There are a large number of aliases, but the most importaint are -kRSA, kDHr, kDHd and kEDH for key exchange types. - -aRSA, aDSS, aNULL and aDH for authentication -DES, 3DES, RC4, RC2, IDEA and eNULL for ciphers -MD5, SHA0 and SHA1 digests - -Now where this becomes interesting is that these can be put together to -specify the order and ciphers you wish to use. - -To speed this up there are also aliases for certian groups of ciphers. -The main ones are -SSLv2 - all SSLv2 ciphers -SSLv3 - all SSLv3 ciphers -EXP - all export ciphers -LOW - all low strngth ciphers (no export ciphers, normally single DES) -MEDIUM - 128 bit encryption -HIGH - Triple DES - -These aliases can be joined in a : separated list which specifies to -add ciphers, move them to the current location and delete them. - -A simpler way to look at all of this is to use the 'ssleay ciphers -v' command. -The default library cipher spec is -!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP -which means, first, remove from consideration any ciphers that do not -authenticate. Next up, use ciphers using RC4 and RSA. Next include the HIGH, -MEDIUM and the LOW security ciphers. Finish up by adding all the export -ciphers on the end, then 'pull' all the SSLv2 and export ciphers to -the end of the list. - -The results are -$ ssleay ciphers -v '!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP' - -RC4-SHA SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=SHA1 -RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 -EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 -EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1 -DES-CBC3-SHA SSLv3 Kx=RSA Au=RSA Enc=3DES(168) Mac=SHA1 -IDEA-CBC-MD5 SSLv3 Kx=RSA Au=RSA Enc=IDEA(128) Mac=SHA1 -EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH Au=RSA Enc=DES(56) Mac=SHA1 -EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH Au=DSS Enc=DES(56) Mac=SHA1 -DES-CBC-SHA SSLv3 Kx=RSA Au=RSA Enc=DES(56) Mac=SHA1 -DES-CBC3-MD5 SSLv2 Kx=RSA Au=RSA Enc=3DES(168) Mac=MD5 -DES-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=DES(56) Mac=MD5 -IDEA-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=IDEA(128) Mac=MD5 -RC2-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=RC2(128) Mac=MD5 -RC4-MD5 SSLv2 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 -EXP-EDH-RSA-DES-CBC SSLv3 Kx=DH(512) Au=RSA Enc=DES(40) Mac=SHA1 export -EXP-EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH(512) Au=DSS Enc=DES(40) Mac=SHA1 export -EXP-DES-CBC-SHA SSLv3 Kx=RSA(512) Au=RSA Enc=DES(40) Mac=SHA1 export -EXP-RC2-CBC-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export -EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export -EXP-RC2-CBC-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export -EXP-RC4-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export - -I would recoment people use the 'ssleay ciphers -v "text"' -command to check what they are going to use. - -Anyway, I'm falling asleep here so I'll do some more tomorrow. - -eric - -==== ssl.doc ======================================================== - -SSL_CTX_sessions(SSL_CTX *ctx) - the session-id hash table. - -/* Session-id cache stats */ -SSL_CTX_sess_number -SSL_CTX_sess_connect -SSL_CTX_sess_connect_good -SSL_CTX_sess_accept -SSL_CTX_sess_accept_good -SSL_CTX_sess_hits -SSL_CTX_sess_cb_hits -SSL_CTX_sess_misses -SSL_CTX_sess_timeouts - -/* Session-id application notification callbacks */ -SSL_CTX_sess_set_new_cb -SSL_CTX_sess_get_new_cb -SSL_CTX_sess_set_get_cb -SSL_CTX_sess_get_get_cb - -/* Session-id cache operation mode */ -SSL_CTX_set_session_cache_mode -SSL_CTX_get_session_cache_mode - -/* Set default timeout values to use. */ -SSL_CTX_set_timeout -SSL_CTX_get_timeout - -/* Global SSL initalisation informational callback */ -SSL_CTX_set_info_callback -SSL_CTX_get_info_callback -SSL_set_info_callback -SSL_get_info_callback - -/* If the SSL_accept/SSL_connect returned with -1, these indicate when - * we should re-call *. -SSL_want -SSL_want_nothing -SSL_want_read -SSL_want_write -SSL_want_x509_lookup - -/* Where we are in SSL initalisation, used in non-blocking, perhaps - * have a look at ssl/bio_ssl.c */ -SSL_state -SSL_is_init_finished -SSL_in_init -SSL_in_connect_init -SSL_in_accept_init - -/* Used to set the 'inital' state so SSL_in_connect_init and SSL_in_accept_init - * can be used to work out which function to call. */ -SSL_set_connect_state -SSL_set_accept_state - -/* Where to look for certificates for authentication */ -SSL_set_default_verify_paths /* calles SSL_load_verify_locations */ -SSL_load_verify_locations - -/* get info from an established connection */ -SSL_get_session -SSL_get_certificate -SSL_get_SSL_CTX - -SSL_CTX_new -SSL_CTX_free -SSL_new -SSL_clear -SSL_free - -SSL_CTX_set_cipher_list -SSL_get_cipher -SSL_set_cipher_list -SSL_get_cipher_list -SSL_get_shared_ciphers - -SSL_accept -SSL_connect -SSL_read -SSL_write - -SSL_debug - -SSL_get_read_ahead -SSL_set_read_ahead -SSL_set_verify - -SSL_pending - -SSL_set_fd -SSL_set_rfd -SSL_set_wfd -SSL_set_bio -SSL_get_fd -SSL_get_rbio -SSL_get_wbio - -SSL_use_RSAPrivateKey -SSL_use_RSAPrivateKey_ASN1 -SSL_use_RSAPrivateKey_file -SSL_use_PrivateKey -SSL_use_PrivateKey_ASN1 -SSL_use_PrivateKey_file -SSL_use_certificate -SSL_use_certificate_ASN1 -SSL_use_certificate_file - -ERR_load_SSL_strings -SSL_load_error_strings - -/* human readable version of the 'state' of the SSL connection. */ -SSL_state_string -SSL_state_string_long -/* These 2 report what kind of IO operation the library was trying to - * perform last. Probably not very usefull. */ -SSL_rstate_string -SSL_rstate_string_long - -SSL_get_peer_certificate - -SSL_SESSION_new -SSL_SESSION_print_fp -SSL_SESSION_print -SSL_SESSION_free -i2d_SSL_SESSION -d2i_SSL_SESSION - -SSL_get_time -SSL_set_time -SSL_get_timeout -SSL_set_timeout -SSL_copy_session_id -SSL_set_session -SSL_CTX_add_session -SSL_CTX_remove_session -SSL_CTX_flush_sessions - -BIO_f_ssl - -/* used to hold information as to why a certificate verification failed */ -SSL_set_verify_result -SSL_get_verify_result - -/* can be used by the application to associate data with an SSL structure. - * It needs to be 'free()ed' by the application */ -SSL_set_app_data -SSL_get_app_data - -/* The following all set values that are kept in the SSL_CTX but - * are used as the default values when an SSL session is created. - * They are over writen by the relevent SSL_xxxx functions */ - -/* SSL_set_verify */ -void SSL_CTX_set_default_verify - -/* This callback, if set, totaly overrides the normal SSLeay verification - * functions and should return 1 on success and 0 on failure */ -void SSL_CTX_set_cert_verify_callback - -/* The following are the same as the equivilent SSL_xxx functions. - * Only one copy of this information is kept and if a particular - * SSL structure has a local override, it is totally separate structure. - */ -int SSL_CTX_use_RSAPrivateKey -int SSL_CTX_use_RSAPrivateKey_ASN1 -int SSL_CTX_use_RSAPrivateKey_file -int SSL_CTX_use_PrivateKey -int SSL_CTX_use_PrivateKey_ASN1 -int SSL_CTX_use_PrivateKey_file -int SSL_CTX_use_certificate -int SSL_CTX_use_certificate_ASN1 -int SSL_CTX_use_certificate_file - - -==== ssl_ctx.doc ======================================================== - -This is now a bit dated, quite a few of the SSL_ functions could be -SSL_CTX_ functions. I will update this in the future. 30 Aug 1996 - -From eay@orb.mincom.oz.au Mon Dec 11 21:37:08 1995 -Received: by orb.mincom.oz.au id AA00696 - (5.65c/IDA-1.4.4 for eay); Mon, 11 Dec 1995 11:37:08 +1000 -Date: Mon, 11 Dec 1995 11:37:08 +1000 (EST) -From: Eric Young <eay@mincom.oz.au> -X-Sender: eay@orb -To: sameer <sameer@c2.org> -Cc: Eric Young <eay@mincom.oz.au> -Subject: Re: PEM_readX509 oesn't seem to be working -In-Reply-To: <199512110102.RAA12521@infinity.c2.org> -Message-Id: <Pine.SOL.3.91.951211112115.28608D-100000@orb> -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII -Status: RO -X-Status: - -On Sun, 10 Dec 1995, sameer wrote: -> OK, that's solved. I've found out that it is saying "no -> certificate set" in SSL_accept because s->conn == NULL -> so there is some place I need to initialize s->conn that I am -> not initializing it. - -The full order of things for a server should be. - -ctx=SSL_CTX_new(); - -/* The next line should not really be using ctx->cert but I'll leave it - * this way right now... I don't want a X509_ routine to know about an SSL - * structure, there should be an SSL_load_verify_locations... hmm, I may - * add it tonight. - */ -X509_load_verify_locations(ctx->cert,CAfile,CApath); - -/* Ok now for each new connection we do the following */ -con=SSL_new(ctx); -SSL_set_fd(con,s); -SSL_set_verify(con,verify,verify_callback); - -/* set the certificate and private key to use. */ -SSL_use_certificate_ASN1(con,X509_certificate); -SSL_use_RSAPrivateKey_ASN1(con,RSA_private_key); - -SSL_accept(con); - -SSL_read(con)/SSL_write(con); - -There is a bit more than that but that is basically the structure. - -Create a context and specify where to lookup certificates. - -foreach connection - { - create a SSL structure - set the certificate and private key - do a SSL_accept - - we should now be ok - } - -eric --- -Eric Young | Signature removed since it was generating -AARNet: eay@mincom.oz.au | more followups than the message contents :-) - - - -==== ssleay.doc ======================================================== - -SSLeay: a cryptographic kitchen sink. - -1st December 1995 -Way back at the start of April 1995, I was looking for a mindless -programming project. A friend of mine (Tim Hudson) said "why don't you do SSL, -it has DES encryption in it and I would not mind using it in a SSL telnet". -While it was true I had written a DES library in previous years, litle -did I know what an expansive task SSL would turn into. - -First of all, the SSL protocol contains DES encryption. Well and good. My -DES library was fast and portable. It also contained the RSA's RC4 stream -cipher. Again, not a problem, some-one had just posted to sci.crypt -something that was claimed to be RC4. It also contained IDEA, I had the -specifications, not a problem to implement. MD5, an RFC, trivial, at most -I could spend a week or so trying to see if I could speed up the -implementation. All in all a nice set of ciphers. -Then the first 'expantion of the scope', RSA public key -encryption. Since I did not knowing a thing about public key encryption -or number theory, this appeared quite a daunting task. Just writing a -big number library would be problomatic in itself, let alone making it fast. -At this point the scope of 'implementing SSL' expands eponentialy. -First of all, the RSA private keys were being kept in ASN.1 format. -Thankfully the RSA PKCS series of documents explains this format. So I now -needed to be able to encode and decode arbitary ASN.1 objects. The Public -keys were embeded in X509 certificates. Hmm... these are not only -ASN.1 objects but they make up a heirachy of authentication. To -authenticate a X509 certificate one needs to retrieve it's issuers -certificate etc etc. Hmm..., so I also need to implement some kind -of certificate management software. I would also have to implement -software to authenticate certificates. At this point the support code made -the SSL part of my library look quite small. -Around this time, the first version of SSLeay was released. - -Ah, but here was the problem, I was not happy with the code so far. As may -have become obvious, I had been treating all of this as a learning -exersize, so I have completely written the library myself. As such, due -to the way it had grown like a fungus, much of the library was not -'elagent' or neat. There were global and static variables all over the -place, the SSL part did not even handle non-blocking IO. -The Great rewrite began. - -As of this point in time, the 'Great rewrite' has almost finished. So what -follows is an approximate list of what is actually SSLeay 0.5.0 - -/********* This needs to be updated for 0.6.0+ *************/ - ---- -The library contains the following routines. Please note that most of these -functions are not specfic for SSL or any other particular cipher -implementation. I have tried to make all the routines as general purpose -as possible. So you should not think of this library as an SSL -implemtation, but rather as a library of cryptographic functions -that also contains SSL. I refer to each of these function groupings as -libraries since they are often capable of functioning as independant -libraries - -First up, the general ciphers and message digests supported by the library. - -MD2 rfc???, a standard 'by parts' interface to this algorithm. -MD5 rfc???, the same type of interface as for the MD2 library except a - different algorithm. -SHA THe Secure Hash Algorithm. Again the same type of interface as - MD2/MD5 except the digest is 20 bytes. -SHA1 The 'revised' version of SHA. Just about identical to SHA except - for one tweak of an inner loop. -DES This is my libdes library that has been floating around for the last - few years. It has been enhanced for no other reason than completeness. - It now supports ecb, cbc, cfb, ofb, cfb64, ofb64 in normal mode and - triple DES modes of ecb, cbc, cfb64 and ofb64. cfb64 and ofb64 are - functional interfaces to the 64 bit modes of cfb and ofb used in - such a way thay they function as single character interfaces. -RC4 The RSA Inc. stream cipher. -RC2 The RSA Inc. block cipher. -IDEA An implmentation of the IDEA cipher, the library supports ecb, cbc, - cfb64 and ofb64 modes of operation. - -Now all the above mentioned ciphers and digests libraries support high -speed, minimal 'crap in the way' type interfaces. For fastest and -lowest level access, these routines should be used directly. - -Now there was also the matter of public key crypto systems. These are -based on large integer arithmatic. - -BN This is my large integer library. It supports all the normal - arithmentic operations. It uses malloc extensivly and as such has - no limits of the size of the numbers being manipulated. If you - wish to use 4000 bit RSA moduli, these routines will handle it. - This library also contains routines to 'generate' prime numbers and - to test for primality. The RSA and DH libraries sit on top of this - library. As of this point in time, I don't support SHA, but - when I do add it, it will just sit on top of the routines contained - in this library. -RSA This implements the RSA public key algorithm. It also contains - routines that will generate a new private/public key pair. - All the RSA functions conform to the PKCS#1 standard. -DH This is an implementation of the - Diffie-Hellman protocol. There are all the require routines for - the protocol, plus extra routines that can be used to generate a - strong prime for use with a specified generator. While this last - routine is not generally required by applications implementing DH, - It is present for completeness and because I thing it is much - better to be able to 'generate' your own 'magic' numbers as oposed - to using numbers suplied by others. I conform to the PKCS#3 - standard where required. - -You may have noticed the preceeding section mentions the 'generation' of -prime numbers. Now this requries the use of 'random numbers'. - -RAND This psuedo-random number library is based on MD5 at it's core - and a large internal state (2k bytes). Once you have entered enough - seed data into this random number algorithm I don't feel - you will ever need to worry about it generating predictable output. - Due to the way I am writing a portable library, I have left the - issue of how to get good initial random seed data upto the - application but I do have support routines for saving and loading a - persistant random number state for use between program runs. - -Now to make all these ciphers easier to use, a higher level -interface was required. In this form, the same function would be used to -encrypt 'by parts', via any one of the above mentioned ciphers. - -EVP The Digital EnVeloPe library is quite large. At it's core are - function to perform encryption and decryption by parts while using - an initial parameter to specify which of the 17 different ciphers - or 4 different message digests to use. On top of these are implmented - the digital signature functions, sign, verify, seal and open. - Base64 encoding of binary data is also done in this library. - -PEM rfc???? describe the format for Privacy Enhanced eMail. - As part of this standard, methods of encoding digital enveloped - data is an ascii format are defined. As such, I use a form of these - to encode enveloped data. While at this point in time full support - for PEM has not been built into the library, a minimal subset of - the secret key and Base64 encoding is present. These reoutines are - mostly used to Ascii encode binary data with a 'type' associated - with it and perhaps details of private key encryption used to - encrypt the data. - -PKCS7 This is another Digital Envelope encoding standard which uses ASN.1 - to encode the data. At this point in time, while there are some - routines to encode and decode this binary format, full support is - not present. - -As Mentioned, above, there are several different ways to encode -data structures. - -ASN1 This library is more a set of primatives used to encode the packing - and unpacking of data structures. It is used by the X509 - certificate standard and by the PKCS standards which are used by - this library. It also contains routines for duplicating and signing - the structures asocisated with X509. - -X509 The X509 library contains routines for packing and unpacking, - verifying and just about every thing else you would want to do with - X509 certificates. - -PKCS7 PKCS-7 is a standard for encoding digital envelope data - structures. At this point in time the routines will load and save - DER forms of these structees. They need to be re-worked to support - the BER form which is the normal way PKCS-7 is encoded. If the - previous 2 sentances don't make much sense, don't worry, this - library is not used by this version of SSLeay anyway. - -OBJ ASN.1 uses 'object identifiers' to identify objects. A set of - functions were requred to translate from ASN.1 to an intenger, to a - character string. This library provieds these translations - -Now I mentioned an X509 library. X509 specified a hieachy of certificates -which needs to be traversed to authenticate particular certificates. - -METH This library is used to push 'methods' of retrieving certificates - into the library. There are some supplied 'methods' with SSLeay - but applications can add new methods if they so desire. - This library has not been finished and is not being used in this - version. - -Now all the above are required for use in the initial point of this project. - -SSL The SSL protocol. This is a full implmentation of SSL v 2. It - support both server and client authentication. SSL v 3 support - will be added when the SSL v 3 specification is released in it's - final form. - -Now quite a few of the above mentioned libraries rely on a few 'complex' -data structures. For each of these I have a library. - -Lhash This is a hash table library which is used extensivly. - -STACK An implemetation of a Stack data structure. - -BUF A simple character array structure that also support a function to - check that the array is greater that a certain size, if it is not, - it is realloced so that is it. - -TXT_DB A simple memory based text file data base. The application can specify - unique indexes that will be enforced at update time. - -CONF Most of the programs written for this library require a configuration - file. Instead of letting programs constantly re-implment this - subsystem, the CONF library provides a consistant and flexable - interface to not only configuration files but also environment - variables. - -But what about when something goes wrong? -The one advantage (and perhaps disadvantage) of all of these -functions being in one library was the ability to implement a -single error reporting system. - -ERR This library is used to report errors. The error system records - library number, function number (in the library) and reason - number. Multiple errors can be reported so that an 'error' trace - is created. The errors can be printed in numeric or textual form. - - -==== ssluse.doc ======================================================== - -We have an SSL_CTX which contains global information for lots of -SSL connections. The session-id cache and the certificate verificate cache. -It also contains default values for use when certificates are used. - -SSL_CTX - default cipher list - session-id cache - certificate cache - default session-id timeout period - New session-id callback - Required session-id callback - session-id stats - Informational callback - Callback that is set, overrides the SSLeay X509 certificate - verification - The default Certificate/Private Key pair - Default read ahead mode. - Default verify mode and verify callback. These are not used - if the over ride callback mentioned above is used. - -Each SSL can have the following defined for it before a connection is made. - -Certificate -Private key -Ciphers to use -Certificate verify mode and callback -IO object to use in the comunication. -Some 'read-ahead' mode information. -A previous session-id to re-use. - -A connection is made by using SSL_connect or SSL_accept. -When non-blocking IO is being used, there are functions that can be used -to determin where and why the SSL_connect or SSL_accept did not complete. -This information can be used to recall the functions when the 'error' -condition has dissapeared. - -After the connection has been made, information can be retrived about the -SSL session and the session-id values that have been decided apon. -The 'peer' certificate can be retrieved. - -The session-id values include -'start time' -'timeout length' - - - -==== stack.doc ======================================================== - -The stack data structure is used to store an ordered list of objects. -It is basically misnamed to call it a stack but it can function that way -and that is what I originally used it for. Due to the way element -pointers are kept in a malloc()ed array, the most efficient way to use this -structure is to add and delete elements from the end via sk_pop() and -sk_push(). If you wish to do 'lookups' sk_find() is quite efficient since -it will sort the stack (if required) and then do a binary search to lookup -the requested item. This sorting occurs automatically so just sk_push() -elements on the stack and don't worry about the order. Do remember that if -you do a sk_find(), the order of the elements will change. - -You should never need to 'touch' this structure directly. -typedef struct stack_st - { - unsigned int num; - char **data; - int sorted; - - unsigned int num_alloc; - int (*comp)(); - } STACK; - -'num' holds the number of elements in the stack, 'data' is the array of -elements. 'sorted' is 1 is the list has been sorted, 0 if not. - -num_alloc is the number of 'nodes' allocated in 'data'. When num becomes -larger than num_alloc, data is realloced to a larger size. -If 'comp' is set, it is a function that is used to compare 2 of the items -in the stack. The function should return -1, 0 or 1, depending on the -ordering. - -#define sk_num(sk) ((sk)->num) -#define sk_value(sk,n) ((sk)->data[n]) - -These 2 macros should be used to access the number of elements in the -'stack' and to access a pointer to one of the values. - -STACK *sk_new(int (*c)()); - This creates a new stack. If 'c', the comparison function, is not -specified, the various functions that operate on a sorted 'stack' will not -work (sk_find()). NULL is returned on failure. - -void sk_free(STACK *); - This function free()'s a stack structure. The elements in the -stack will not be freed so one should 'pop' and free all elements from the -stack before calling this function or call sk_pop_free() instead. - -void sk_pop_free(STACK *st; void (*func)()); - This function calls 'func' for each element on the stack, passing -the element as the argument. sk_free() is then called to free the 'stack' -structure. - -int sk_insert(STACK *sk,char *data,int where); - This function inserts 'data' into stack 'sk' at location 'where'. -If 'where' is larger that the number of elements in the stack, the element -is put at the end. This function tends to be used by other 'stack' -functions. Returns 0 on failure, otherwise the number of elements in the -new stack. - -char *sk_delete(STACK *st,int loc); - Remove the item a location 'loc' from the stack and returns it. -Returns NULL if the 'loc' is out of range. - -char *sk_delete_ptr(STACK *st, char *p); - If the data item pointed to by 'p' is in the stack, it is deleted -from the stack and returned. NULL is returned if the element is not in the -stack. - -int sk_find(STACK *st,char *data); - Returns the location that contains a value that is equal to -the 'data' item. If the comparison function was not set, this function -does a linear search. This function actually qsort()s the stack if it is not -in order and then uses bsearch() to do the initial search. If the -search fails,, -1 is returned. For mutliple items with the same -value, the index of the first in the array is returned. - -int sk_push(STACK *st,char *data); - Append 'data' to the stack. 0 is returned if there is a failure -(due to a malloc failure), else 1. This is -sk_insert(st,data,sk_num(st)); - -int sk_unshift(STACK *st,char *data); - Prepend 'data' to the front (location 0) of the stack. This is -sk_insert(st,data,0); - -char *sk_shift(STACK *st); - Return and delete from the stack the first element in the stack. -This is sk_delete(st,0); - -char *sk_pop(STACK *st); - Return and delete the last element on the stack. This is -sk_delete(st,sk_num(sk)-1); - -void sk_zero(STACK *st); - Removes all items from the stack. It does not 'free' -pointers but is a quick way to clear a 'stack of references'. - -==== threads.doc ======================================================== - -How to compile SSLeay for multi-threading. - -Well basically it is quite simple, set the compiler flags and build. -I have only really done much testing under Solaris and Windows NT. -If you library supports localtime_r() and gmtime_r() add, --DTHREADS to the makefile parameters. You can probably survive with out -this define unless you are going to have multiple threads generating -certificates at once. It will not affect the SSL side of things. - -The approach I have taken to doing locking is to make the application provide -callbacks to perform locking and so that the SSLeay library can distinguish -between threads (for the error state). - -To have a look at an example program, 'cd mt; vi mttest.c'. -To build under solaris, sh solaris.sh, for Windows NT or Windows 95, -win32.bat - -This will build mttest which will fire up 10 threads that talk SSL -to each other 10 times. -To enable everything to work, the application needs to call - -CRYPTO_set_id_callback(id_function); -CRYPTO_set_locking_callback(locking_function); - -before any multithreading is started. -id_function does not need to be defined under Windows NT or 95, the -correct function will be called if it is not. Under unix, getpid() -is call if the id_callback is not defined, for Solaris this is wrong -(since threads id's are not pid's) but under Linux it is correct -(threads are just processes sharing the data segement). - -The locking_callback is used to perform locking by the SSLeay library. -eg. - -void solaris_locking_callback(mode,type,file,line) -int mode; -int type; -char *file; -int line; - { - if (mode & CRYPTO_LOCK) - mutex_lock(&(lock_cs[type])); - else - mutex_unlock(&(lock_cs[type])); - } - -Now in this case I have used mutexes instead of read/write locks, since they -are faster and there are not many read locks in SSLeay, you may as well -always use write locks. file and line are __FILE__ and __LINE__ from -the compile and can be usefull when debugging. - -Now as you can see, 'type' can be one of a range of values, these values are -defined in crypto/crypto.h -CRYPTO_get_lock_name(type) will return a text version of what the lock is. -There are CRYPTO_NUM_LOCKS locks required, so under solaris, the setup -for multi-threading can be - -static mutex_t lock_cs[CRYPTO_NUM_LOCKS]; - -void thread_setup() - { - int i; - - for (i=0; i<CRYPTO_NUM_LOCKS; i++) - mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL); - CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id); - CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); - } - -As a final note, under Windows NT or Windows 95, you have to be careful -not to mix the various threaded, unthreaded and debug libraries. -Normally if they are mixed incorrectly, mttest will crash just after printing -out some usage statistics at the end. This is because the -different system libraries use different malloc routines and if -data is malloc()ed inside crypt32.dll or ssl32.dll and then free()ed by a -different library malloc, things get very confused. - -The default SSLeay DLL builds use /MD, so if you use this on your -application, things will work as expected. If you use /MDd, -you will probably have to rebuild SSLeay using this flag. -I should modify util/mk1mf.pl so it does all this correctly, but -this has not been done yet. - -One last warning. Because locking overheads are actually quite large, the -statistics collected against the SSL_CTX for successfull connections etc -are not locked when updated. This does make it possible for these -values to be slightly lower than they should be, if you are -running multithreaded on a multi-processor box, but this does not really -matter much. - - -==== txt_db.doc ======================================================== - -TXT_DB, a simple text based in memory database. - -It holds rows of ascii data, for which the only special character is '\0'. -The rows can be of an unlimited length. - -==== why.doc ======================================================== - -This file is more of a note for other people who wish to understand why -the build environment is the way it is :-). - -The include files 'depend' as follows. -Each of -crypto/*/*.c includes crypto/cryptlib.h -ssl/*.c include ssl/ssl_locl.h -apps/*.c include apps/apps.h -crypto/cryptlib.h, ssl/ssl_locl.h and apps/apps.h -all include e_os.h which contains OS/environment specific information. -If you need to add something todo with a particular environment, -add it to this file. It is worth remembering that quite a few libraries, -like lhash, des, md, sha etc etc do not include crypto/cryptlib.h. This -is because these libraries should be 'independantly compilable' and so I -try to keep them this way. -e_os.h is not so much a part of SSLeay, as the placing in one spot all the -evil OS dependant muck. - -I wanted to automate as many things as possible. This includes -error number generation. A -make errors -will scan the source files for error codes, append them to the correct -header files, and generate the functions to print the text version -of the error numbers. So don't even think about adding error numbers by -hand, put them in the form -XXXerr(XXXX_F_XXXX,YYYY_R_YYYY); -on line and it will be automatically picked up my a make errors. - -In a similar vein, programs to be added into ssleay in the apps directory -just need to have an entry added to E_EXE in makefile.ssl and -everthing will work as expected. Don't edit progs.h by hand. - -make links re-generates the symbolic links that are used. The reason why -I keep everything in its own directory, and don't put all the -test programs and header files in 'test' and 'include' is because I want -to keep the 'sub-libraries' independant. I still 'pull' out -indervidual libraries for use in specific projects where the code is -required. I have used the 'lhash' library in just about every software -project I have worked on :-). - -make depend generates dependancies and -make dclean removes them. - -You will notice that I use perl quite a bit when I could be using 'sed'. -The reason I decided to do this was to just stick to one 'extra' program. -For Windows NT, I have perl and no sed. - -The util/mk1mf.pl program can be used to generate a single makefile. -I use this because makefiles under Microsoft are horrific. -Each C compiler seems to have different linker formats, which have -to be used because the retarted C compilers explode when you do -cl -o file *.o. - -Now some would argue that I should just use the single makefile. I don't -like it during develoment for 2 reasons. First, the actuall make -command takes a long time. For my current setup, if I'm in -crypto/bn and I type make, only the crypto/bn directory gets rebuilt, -which is nice when you are modifying prototypes in bn.h which -half the SSLeay depends on. The second is that to add a new souce file -I just plonk it in at the required spot in the local makefile. This -then alows me to keep things local, I don't need to modify a 'global' -tables (the make for unix, the make for NT, the make for w31...). -When I am ripping apart a library structure, it is nice to only -have to worry about one directory :-). - -Having said all this, for the hell of it I put together 2 files that -#include all the souce code (generated by doing a ls */*.o after a build). -crypto.c takes only 30 seconds to build under NT and 2 minutes under linux -for my pentium100. Much faster that the normal build :-). -Again, the problem is that when using libraries, every program linked -to libcrypto.a would suddenly get 330k of library when it may only need -1k. This technique does look like a nice way to do shared libraries though. - -Oh yes, as a final note, to 'build' a distribution, I just type -make dist. -This cleans and packages everything. The directory needs to be called -SSLeay since the make does a 'cd ..' and renames and tars things up. - -==== req.1 ======================================================== - -The 'req' command is used to manipulate and deal with pkcs#10 -certificate requests. - -It's default mode of operation is to load a certificate and then -write it out again. - -By default the 'req' is read from stdin in 'PEM' format. -The -inform option can be used to specify 'pem' format or 'der' -format. PEM format is the base64 encoding of the DER format. - -By default 'req' then writes the request back out. -outform can be used -to indicate the desired output format, be it 'pem' or 'der'. - -To specify an input file, use the '-in' option and the '-out' option -can be used to specify the output file. - -If you wish to perform a command and not output the certificate -request afterwards, use the '-noout' option. - -When a certificate is loaded, it can be printed in a human readable -ascii format via the '-text' option. - -To check that the signature on a certificate request is correct, use -the '-verify' option to make sure that the private key contained in the -certificate request corresponds to the signature. - -Besides the default mode, there is also the 'generate a certificate -request' mode. There are several flags that trigger this mode. - --new will generate a new RSA key (if required) and then prompts -the user for details for the certificate request. --newkey has an argument that is the number of bits to make the new -key. This function also triggers '-new'. - -The '-new' option can have a key to use specified instead of having to -load one, '-key' is used to specify the file containg the key. --keyform can be used to specify the format of the key. Only -'pem' and 'der' formats are supported, later, 'netscape' format may be added. - -Finally there is the '-x509' options which makes req output a self -signed x509 certificate instead of a certificate request. - -Now as you may have noticed, there are lots of default options that -cannot be specified via the command line. They are held in a 'template' -or 'configuration file'. The -config option specifies which configuration -file to use. See conf.doc for details on the syntax of this file. - -The req command uses the 'req' section of the config file. - ---- -# The following variables are defined. For this example I will populate -# the various values -[ req ] -default_bits = 512 # default number of bits to use. -default_keyfile = testkey.pem # Where to write the generated keyfile - # if not specified. -distinguished_name= req_dn # The section that contains the - # information about which 'object' we - # want to put in the DN. -attributes = req_attr # The objects we want for the - # attributes field. -encrypt_rsa_key = no # Should we encrypt newly generated - # keys. I strongly recommend 'yes'. - -# The distinguished name section. For the following entries, the -# object names must exist in the SSLeay header file objects.h. If they -# do not, they will be silently ignored. The entries have the following -# format. -# <object_name> => string to prompt with -# <object_name>_default => default value for people -# <object_name>_value => Automatically use this value for this field. -# <object_name>_min => minimum number of characters for data (def. 0) -# <object_name>_max => maximum number of characters for data (def. inf.) -# All of these entries are optional except for the first one. -[ req_dn ] -countryName = Country Name (2 letter code) -countryName_default = AU - -stateOrProvinceName = State or Province Name (full name) -stateOrProvinceName_default = Queensland - -localityName = Locality Name (eg, city) - -organizationName = Organization Name (eg, company) -organizationName_default = Mincom Pty Ltd - -organizationalUnitName = Organizational Unit Name (eg, section) -organizationalUnitName_default = MTR - -commonName = Common Name (eg, YOUR name) -commonName_max = 64 - -emailAddress = Email Address -emailAddress_max = 40 - -# The next section is the attributes section. This is exactly the -# same as for the previous section except that the resulting objects are -# put in the attributes field. -[ req_attr ] -challengePassword = A challenge password -challengePassword_min = 4 -challengePassword_max = 20 - -unstructuredName = An optional company name - ----- -Also note that the order that attributes appear in this file is the -order they will be put into the distinguished name. - -Once this request has been generated, it can be sent to a CA for -certifying. - ----- -A few quick examples.... - -To generate a new request and a new key -req -new - -To generate a new request and a 1058 bit key -req -newkey 1058 - -To generate a new request using a pre-existing key -req -new -key key.pem - -To generate a self signed x509 certificate from a certificate -request using a supplied key, and we want to see the text form of the -output certificate (which we will put in the file selfSign.pem -req -x509 -in req.pem -key key.pem -text -out selfSign.pem - -Verify that the signature is correct on a certificate request. -req -verify -in req.pem - -Verify that the signature was made using a specified public key. -req -verify -in req.pem -key key.pem - -Print the contents of a certificate request -req -text -in req.pem - -==== danger ======================================================== - -If you specify a SSLv2 cipher, and the mode is SSLv23 and the server -can talk SSLv3, it will claim there is no cipher since you should be -using SSLv3. - -When tracing debug stuff, remember BIO_s_socket() is different to -BIO_s_connect(). - -BSD/OS assember is not working - diff --git a/sys/src/ape/lib/openssl/doc/standards.txt b/sys/src/ape/lib/openssl/doc/standards.txt deleted file mode 100644 index a5ce778f8..000000000 --- a/sys/src/ape/lib/openssl/doc/standards.txt +++ /dev/null @@ -1,281 +0,0 @@ -Standards related to OpenSSL -============================ - -[Please, this is currently a draft. I made a first try at finding - documents that describe parts of what OpenSSL implements. There are - big gaps, and I've most certainly done something wrong. Please - correct whatever is... Also, this note should be removed when this - file is reaching a somewhat correct state. -- Richard Levitte] - - -All pointers in here will be either URL's or blobs of text borrowed -from miscellaneous indexes, like rfc-index.txt (index of RFCs), -1id-index.txt (index of Internet drafts) and the like. - -To find the latest possible RFCs, it's recommended to either browse -ftp://ftp.isi.edu/in-notes/ or go to http://www.rfc-editor.org/ and -use the search mechanism found there. -To find the latest possible Internet drafts, it's recommended to -browse ftp://ftp.isi.edu/internet-drafts/. -To find the latest possible PKCS, it's recommended to browse -http://www.rsasecurity.com/rsalabs/pkcs/. - - -Implemented: ------------- - -These are documents that describe things that are implemented (in -whole or at least great parts) in OpenSSL. - -1319 The MD2 Message-Digest Algorithm. B. Kaliski. April 1992. - (Format: TXT=25661 bytes) (Status: INFORMATIONAL) - -1320 The MD4 Message-Digest Algorithm. R. Rivest. April 1992. (Format: - TXT=32407 bytes) (Status: INFORMATIONAL) - -1321 The MD5 Message-Digest Algorithm. R. Rivest. April 1992. (Format: - TXT=35222 bytes) (Status: INFORMATIONAL) - -2246 The TLS Protocol Version 1.0. T. Dierks, C. Allen. January 1999. - (Format: TXT=170401 bytes) (Status: PROPOSED STANDARD) - -2268 A Description of the RC2(r) Encryption Algorithm. R. Rivest. - January 1998. (Format: TXT=19048 bytes) (Status: INFORMATIONAL) - -2315 PKCS 7: Cryptographic Message Syntax Version 1.5. B. Kaliski. - March 1998. (Format: TXT=69679 bytes) (Status: INFORMATIONAL) - -PKCS#8: Private-Key Information Syntax Standard - -PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. - -2560 X.509 Internet Public Key Infrastructure Online Certificate - Status Protocol - OCSP. M. Myers, R. Ankney, A. Malpani, S. Galperin, - C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED - STANDARD) - -2712 Addition of Kerberos Cipher Suites to Transport Layer Security - (TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes) - (Status: PROPOSED STANDARD) - -2898 PKCS #5: Password-Based Cryptography Specification Version 2.0. - B. Kaliski. September 2000. (Format: TXT=68692 bytes) (Status: - INFORMATIONAL) - -2986 PKCS #10: Certification Request Syntax Specification Version 1.7. - M. Nystrom, B. Kaliski. November 2000. (Format: TXT=27794 bytes) - (Obsoletes RFC2314) (Status: INFORMATIONAL) - -3174 US Secure Hash Algorithm 1 (SHA1). D. Eastlake 3rd, P. Jones. - September 2001. (Format: TXT=35525 bytes) (Status: INFORMATIONAL) - -3268 Advanced Encryption Standard (AES) Ciphersuites for Transport - Layer Security (TLS). P. Chown. June 2002. (Format: TXT=13530 bytes) - (Status: PROPOSED STANDARD) - -3279 Algorithms and Identifiers for the Internet X.509 Public Key - Infrastructure Certificate and Certificate Revocation List (CRL) - Profile. L. Bassham, W. Polk, R. Housley. April 2002. (Format: - TXT=53833 bytes) (Status: PROPOSED STANDARD) - -3280 Internet X.509 Public Key Infrastructure Certificate and - Certificate Revocation List (CRL) Profile. R. Housley, W. Polk, W. - Ford, D. Solo. April 2002. (Format: TXT=295556 bytes) (Obsoletes - RFC2459) (Status: PROPOSED STANDARD) - -3447 Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography - Specifications Version 2.1. J. Jonsson, B. Kaliski. February 2003. - (Format: TXT=143173 bytes) (Obsoletes RFC2437) (Status: - INFORMATIONAL) - -3713 A Description of the Camellia Encryption Algorithm. M. Matsui, - J. Nakajima, S. Moriai. April 2004. (Format: TXT=25031 bytes) - (Status: INFORMATIONAL) - -3820 Internet X.509 Public Key Infrastructure (PKI) Proxy Certificate - Profile. S. Tuecke, V. Welch, D. Engert, L. Pearlman, M. Thompson. - June 2004. (Format: TXT=86374 bytes) (Status: PROPOSED STANDARD) - -4132 Addition of Camellia Cipher Suites to Transport Layer Security - (TLS). S. Moriai, A. Kato, M. Kanda. July 2005. (Format: TXT=13590 - bytes) (Status: PROPOSED STANDARD) - -4162 Addition of SEED Cipher Suites to Transport Layer Security (TLS). - H.J. Lee, J.H. Yoon, J.I. Lee. August 2005. (Format: TXT=10578 bytes) - (Status: PROPOSED STANDARD) - -4269 The SEED Encryption Algorithm. H.J. Lee, S.J. Lee, J.H. Yoon, - D.H. Cheon, J.I. Lee. December 2005. (Format: TXT=34390 bytes) - (Obsoletes RFC4009) (Status: INFORMATIONAL) - - -Related: --------- - -These are documents that are close to OpenSSL, for example the -STARTTLS documents. - -1421 Privacy Enhancement for Internet Electronic Mail: Part I: Message - Encryption and Authentication Procedures. J. Linn. February 1993. - (Format: TXT=103894 bytes) (Obsoletes RFC1113) (Status: PROPOSED - STANDARD) - -1422 Privacy Enhancement for Internet Electronic Mail: Part II: - Certificate-Based Key Management. S. Kent. February 1993. (Format: - TXT=86085 bytes) (Obsoletes RFC1114) (Status: PROPOSED STANDARD) - -1423 Privacy Enhancement for Internet Electronic Mail: Part III: - Algorithms, Modes, and Identifiers. D. Balenson. February 1993. - (Format: TXT=33277 bytes) (Obsoletes RFC1115) (Status: PROPOSED - STANDARD) - -1424 Privacy Enhancement for Internet Electronic Mail: Part IV: Key - Certification and Related Services. B. Kaliski. February 1993. - (Format: TXT=17537 bytes) (Status: PROPOSED STANDARD) - -2025 The Simple Public-Key GSS-API Mechanism (SPKM). C. Adams. October - 1996. (Format: TXT=101692 bytes) (Status: PROPOSED STANDARD) - -2510 Internet X.509 Public Key Infrastructure Certificate Management - Protocols. C. Adams, S. Farrell. March 1999. (Format: TXT=158178 - bytes) (Status: PROPOSED STANDARD) - -2511 Internet X.509 Certificate Request Message Format. M. Myers, C. - Adams, D. Solo, D. Kemp. March 1999. (Format: TXT=48278 bytes) - (Status: PROPOSED STANDARD) - -2527 Internet X.509 Public Key Infrastructure Certificate Policy and - Certification Practices Framework. S. Chokhani, W. Ford. March 1999. - (Format: TXT=91860 bytes) (Status: INFORMATIONAL) - -2538 Storing Certificates in the Domain Name System (DNS). D. Eastlake - 3rd, O. Gudmundsson. March 1999. (Format: TXT=19857 bytes) (Status: - PROPOSED STANDARD) - -2539 Storage of Diffie-Hellman Keys in the Domain Name System (DNS). - D. Eastlake 3rd. March 1999. (Format: TXT=21049 bytes) (Status: - PROPOSED STANDARD) - -2559 Internet X.509 Public Key Infrastructure Operational Protocols - - LDAPv2. S. Boeyen, T. Howes, P. Richard. April 1999. (Format: - TXT=22889 bytes) (Updates RFC1778) (Status: PROPOSED STANDARD) - -2585 Internet X.509 Public Key Infrastructure Operational Protocols: - FTP and HTTP. R. Housley, P. Hoffman. May 1999. (Format: TXT=14813 - bytes) (Status: PROPOSED STANDARD) - -2587 Internet X.509 Public Key Infrastructure LDAPv2 Schema. S. - Boeyen, T. Howes, P. Richard. June 1999. (Format: TXT=15102 bytes) - (Status: PROPOSED STANDARD) - -2595 Using TLS with IMAP, POP3 and ACAP. C. Newman. June 1999. - (Format: TXT=32440 bytes) (Status: PROPOSED STANDARD) - -2631 Diffie-Hellman Key Agreement Method. E. Rescorla. June 1999. - (Format: TXT=25932 bytes) (Status: PROPOSED STANDARD) - -2632 S/MIME Version 3 Certificate Handling. B. Ramsdell, Ed.. June - 1999. (Format: TXT=27925 bytes) (Status: PROPOSED STANDARD) - -2716 PPP EAP TLS Authentication Protocol. B. Aboba, D. Simon. October - 1999. (Format: TXT=50108 bytes) (Status: EXPERIMENTAL) - -2773 Encryption using KEA and SKIPJACK. R. Housley, P. Yee, W. Nace. - February 2000. (Format: TXT=20008 bytes) (Updates RFC0959) (Status: - EXPERIMENTAL) - -2797 Certificate Management Messages over CMS. M. Myers, X. Liu, J. - Schaad, J. Weinstein. April 2000. (Format: TXT=103357 bytes) (Status: - PROPOSED STANDARD) - -2817 Upgrading to TLS Within HTTP/1.1. R. Khare, S. Lawrence. May - 2000. (Format: TXT=27598 bytes) (Updates RFC2616) (Status: PROPOSED - STANDARD) - -2818 HTTP Over TLS. E. Rescorla. May 2000. (Format: TXT=15170 bytes) - (Status: INFORMATIONAL) - -2876 Use of the KEA and SKIPJACK Algorithms in CMS. J. Pawling. July - 2000. (Format: TXT=29265 bytes) (Status: INFORMATIONAL) - -2984 Use of the CAST-128 Encryption Algorithm in CMS. C. Adams. - October 2000. (Format: TXT=11591 bytes) (Status: PROPOSED STANDARD) - -2985 PKCS #9: Selected Object Classes and Attribute Types Version 2.0. - M. Nystrom, B. Kaliski. November 2000. (Format: TXT=70703 bytes) - (Status: INFORMATIONAL) - -3029 Internet X.509 Public Key Infrastructure Data Validation and - Certification Server Protocols. C. Adams, P. Sylvester, M. Zolotarev, - R. Zuccherato. February 2001. (Format: TXT=107347 bytes) (Status: - EXPERIMENTAL) - -3039 Internet X.509 Public Key Infrastructure Qualified Certificates - Profile. S. Santesson, W. Polk, P. Barzin, M. Nystrom. January 2001. - (Format: TXT=67619 bytes) (Status: PROPOSED STANDARD) - -3058 Use of the IDEA Encryption Algorithm in CMS. S. Teiwes, P. - Hartmann, D. Kuenzi. February 2001. (Format: TXT=17257 bytes) - (Status: INFORMATIONAL) - -3161 Internet X.509 Public Key Infrastructure Time-Stamp Protocol - (TSP). C. Adams, P. Cain, D. Pinkas, R. Zuccherato. August 2001. - (Format: TXT=54585 bytes) (Status: PROPOSED STANDARD) - -3185 Reuse of CMS Content Encryption Keys. S. Farrell, S. Turner. - October 2001. (Format: TXT=20404 bytes) (Status: PROPOSED STANDARD) - -3207 SMTP Service Extension for Secure SMTP over Transport Layer - Security. P. Hoffman. February 2002. (Format: TXT=18679 bytes) - (Obsoletes RFC2487) (Status: PROPOSED STANDARD) - -3217 Triple-DES and RC2 Key Wrapping. R. Housley. December 2001. - (Format: TXT=19855 bytes) (Status: INFORMATIONAL) - -3274 Compressed Data Content Type for Cryptographic Message Syntax - (CMS). P. Gutmann. June 2002. (Format: TXT=11276 bytes) (Status: - PROPOSED STANDARD) - -3278 Use of Elliptic Curve Cryptography (ECC) Algorithms in - Cryptographic Message Syntax (CMS). S. Blake-Wilson, D. Brown, P. - Lambert. April 2002. (Format: TXT=33779 bytes) (Status: - INFORMATIONAL) - -3281 An Internet Attribute Certificate Profile for Authorization. S. - Farrell, R. Housley. April 2002. (Format: TXT=90580 bytes) (Status: - PROPOSED STANDARD) - -3369 Cryptographic Message Syntax (CMS). R. Housley. August 2002. - (Format: TXT=113975 bytes) (Obsoletes RFC2630, RFC3211) (Status: - PROPOSED STANDARD) - -3370 Cryptographic Message Syntax (CMS) Algorithms. R. Housley. August - 2002. (Format: TXT=51001 bytes) (Obsoletes RFC2630, RFC3211) (Status: - PROPOSED STANDARD) - -3377 Lightweight Directory Access Protocol (v3): Technical - Specification. J. Hodges, R. Morgan. September 2002. (Format: - TXT=9981 bytes) (Updates RFC2251, RFC2252, RFC2253, RFC2254, RFC2255, - RFC2256, RFC2829, RFC2830) (Status: PROPOSED STANDARD) - -3394 Advanced Encryption Standard (AES) Key Wrap Algorithm. J. Schaad, - R. Housley. September 2002. (Format: TXT=73072 bytes) (Status: - INFORMATIONAL) - -3436 Transport Layer Security over Stream Control Transmission - Protocol. A. Jungmaier, E. Rescorla, M. Tuexen. December 2002. - (Format: TXT=16333 bytes) (Status: PROPOSED STANDARD) - -3657 Use of the Camellia Encryption Algorithm in Cryptographic - Message Syntax (CMS). S. Moriai, A. Kato. January 2004. - (Format: TXT=26282 bytes) (Status: PROPOSED STANDARD) - -"Securing FTP with TLS", 01/27/2000, <draft-murray-auth-ftp-ssl-05.txt> - - -To be implemented: ------------------- - -These are documents that describe things that are planed to be -implemented in the hopefully short future. - diff --git a/sys/src/cmd/python/Demo/tkinter/README b/sys/src/cmd/python/Demo/tkinter/README deleted file mode 100644 index f245d163c..000000000 --- a/sys/src/cmd/python/Demo/tkinter/README +++ /dev/null @@ -1,10 +0,0 @@ -Several collections of example code for Tkinter. - -See the toplevel README for an explanation of the difference between -Tkinter and _tkinter, how to enable the Python Tk interface, and where -to get Matt Conway's lifesaver document. - -Subdirectories: - -guido my original example set (fairly random collection) -matt Matt Conway's examples, to go with his lifesaver document diff --git a/sys/src/cmd/python/Demo/tkinter/guido/AttrDialog.py b/sys/src/cmd/python/Demo/tkinter/guido/AttrDialog.py deleted file mode 100755 index 86333adc7..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/AttrDialog.py +++ /dev/null @@ -1,452 +0,0 @@ - -# The options of a widget are described by the following attributes -# of the Pack and Widget dialogs: -# -# Dialog.current: {name: value} -# -- changes during Widget's lifetime -# -# Dialog.options: {name: (default, klass)} -# -- depends on widget class only -# -# Dialog.classes: {klass: (v0, v1, v2, ...) | 'boolean' | 'other'} -# -- totally static, though different between PackDialog and WidgetDialog -# (but even that could be unified) - -from Tkinter import * - -class Option: - - varclass = StringVar # May be overridden - - def __init__(self, dialog, option): - self.dialog = dialog - self.option = option - self.master = dialog.top - self.default, self.klass = dialog.options[option] - self.var = self.varclass(self.master) - self.frame = Frame(self.master) - self.frame.pack(fill=X) - self.label = Label(self.frame, text=(option + ":")) - self.label.pack(side=LEFT) - self.update() - self.addoption() - - def refresh(self): - self.dialog.refresh() - self.update() - - def update(self): - try: - self.current = self.dialog.current[self.option] - except KeyError: - self.current = self.default - self.var.set(self.current) - - def set(self, e=None): # Should be overridden - pass - -class BooleanOption(Option): - - varclass = BooleanVar - - def addoption(self): - self.button = Checkbutton(self.frame, - text='on/off', - onvalue=1, - offvalue=0, - variable=self.var, - relief=RAISED, - borderwidth=2, - command=self.set) - self.button.pack(side=RIGHT) - -class EnumOption(Option): - - def addoption(self): - self.button = Menubutton(self.frame, - textvariable=self.var, - relief=RAISED, borderwidth=2) - self.button.pack(side=RIGHT) - self.menu = Menu(self.button) - self.button['menu'] = self.menu - for v in self.dialog.classes[self.klass]: - self.menu.add_radiobutton( - label=v, - variable=self.var, - value=v, - command=self.set) - -class StringOption(Option): - - def addoption(self): - self.entry = Entry(self.frame, - textvariable=self.var, - width=10, - relief=SUNKEN, - borderwidth=2) - self.entry.pack(side=RIGHT, fill=X, expand=1) - self.entry.bind('<Return>', self.set) - -class ReadonlyOption(Option): - - def addoption(self): - self.label = Label(self.frame, textvariable=self.var, - anchor=E) - self.label.pack(side=RIGHT) - -class Dialog: - - def __init__(self, master): - self.master = master - self.fixclasses() - self.refresh() - self.top = Toplevel(self.master) - self.top.title(self.__class__.__name__) - self.top.minsize(1, 1) - self.addchoices() - - def refresh(self): pass # Must override - - def fixclasses(self): pass # May override - - def addchoices(self): - self.choices = {} - list = [] - for k, dc in self.options.items(): - list.append((k, dc)) - list.sort() - for k, (d, c) in list: - try: - cl = self.classes[c] - except KeyError: - cl = 'unknown' - if type(cl) == TupleType: - cl = self.enumoption - elif cl == 'boolean': - cl = self.booleanoption - elif cl == 'readonly': - cl = self.readonlyoption - else: - cl = self.stringoption - self.choices[k] = cl(self, k) - - # Must override: - options = {} - classes = {} - - # May override: - booleanoption = BooleanOption - stringoption = StringOption - enumoption = EnumOption - readonlyoption = ReadonlyOption - -class PackDialog(Dialog): - - def __init__(self, widget): - self.widget = widget - Dialog.__init__(self, widget) - - def refresh(self): - self.current = self.widget.info() - self.current['.class'] = self.widget.winfo_class() - self.current['.name'] = self.widget._w - - class packoption: # Mix-in class - def set(self, e=None): - self.current = self.var.get() - try: - apply(self.dialog.widget.pack, (), - {self.option: self.current}) - except TclError, msg: - print msg - self.refresh() - - class booleanoption(packoption, BooleanOption): pass - class enumoption(packoption, EnumOption): pass - class stringoption(packoption, StringOption): pass - class readonlyoption(packoption, ReadonlyOption): pass - - options = { - '.class': (None, 'Class'), - '.name': (None, 'Name'), - 'after': (None, 'Widget'), - 'anchor': ('center', 'Anchor'), - 'before': (None, 'Widget'), - 'expand': ('no', 'Boolean'), - 'fill': ('none', 'Fill'), - 'in': (None, 'Widget'), - 'ipadx': (0, 'Pad'), - 'ipady': (0, 'Pad'), - 'padx': (0, 'Pad'), - 'pady': (0, 'Pad'), - 'side': ('top', 'Side'), - } - - classes = { - 'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER), - 'Boolean': 'boolean', - 'Class': 'readonly', - 'Expand': 'boolean', - 'Fill': (NONE, X, Y, BOTH), - 'Name': 'readonly', - 'Pad': 'pixel', - 'Side': (TOP, RIGHT, BOTTOM, LEFT), - 'Widget': 'readonly', - } - -class RemotePackDialog(PackDialog): - - def __init__(self, master, app, widget): - self.master = master - self.app = app - self.widget = widget - self.refresh() - self.top = Toplevel(self.master) - self.top.title(self.app + ' PackDialog') - self.top.minsize(1, 1) - self.addchoices() - - def refresh(self): - try: - words = self.master.tk.splitlist( - self.master.send(self.app, - 'pack', - 'info', - self.widget)) - except TclError, msg: - print msg - return - dict = {} - for i in range(0, len(words), 2): - key = words[i][1:] - value = words[i+1] - dict[key] = value - dict['.class'] = self.master.send(self.app, - 'winfo', - 'class', - self.widget) - dict['.name'] = self.widget - self.current = dict - - class remotepackoption: # Mix-in class - def set(self, e=None): - self.current = self.var.get() - try: - self.dialog.master.send( - self.dialog.app, - 'pack', - 'config', - self.dialog.widget, - '-'+self.option, - self.dialog.master.tk.merge( - self.current)) - except TclError, msg: - print msg - self.refresh() - - class booleanoption(remotepackoption, BooleanOption): pass - class enumoption(remotepackoption, EnumOption): pass - class stringoption(remotepackoption, StringOption): pass - class readonlyoption(remotepackoption, ReadonlyOption): pass - -class WidgetDialog(Dialog): - - def __init__(self, widget): - self.widget = widget - self.klass = widget.winfo_class() - Dialog.__init__(self, widget) - - def fixclasses(self): - if self.addclasses.has_key(self.klass): - classes = {} - for c in (self.classes, - self.addclasses[self.klass]): - for k in c.keys(): - classes[k] = c[k] - self.classes = classes - - def refresh(self): - self.configuration = self.widget.config() - self.update() - self.current['.class'] = self.widget.winfo_class() - self.current['.name'] = self.widget._w - - def update(self): - self.current = {} - self.options = {} - for k, v in self.configuration.items(): - if len(v) > 4: - self.current[k] = v[4] - self.options[k] = v[3], v[2] # default, klass - self.options['.class'] = (None, 'Class') - self.options['.name'] = (None, 'Name') - - class widgetoption: # Mix-in class - def set(self, e=None): - self.current = self.var.get() - try: - self.dialog.widget[self.option] = self.current - except TclError, msg: - print msg - self.refresh() - - class booleanoption(widgetoption, BooleanOption): pass - class enumoption(widgetoption, EnumOption): pass - class stringoption(widgetoption, StringOption): pass - class readonlyoption(widgetoption, ReadonlyOption): pass - - # Universal classes - classes = { - 'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER), - 'Aspect': 'integer', - 'Background': 'color', - 'Bitmap': 'bitmap', - 'BorderWidth': 'pixel', - 'Class': 'readonly', - 'CloseEnough': 'double', - 'Command': 'command', - 'Confine': 'boolean', - 'Cursor': 'cursor', - 'CursorWidth': 'pixel', - 'DisabledForeground': 'color', - 'ExportSelection': 'boolean', - 'Font': 'font', - 'Foreground': 'color', - 'From': 'integer', - 'Geometry': 'geometry', - 'Height': 'pixel', - 'InsertWidth': 'time', - 'Justify': (LEFT, CENTER, RIGHT), - 'Label': 'string', - 'Length': 'pixel', - 'MenuName': 'widget', - 'Name': 'readonly', - 'OffTime': 'time', - 'OnTime': 'time', - 'Orient': (HORIZONTAL, VERTICAL), - 'Pad': 'pixel', - 'Relief': (RAISED, SUNKEN, FLAT, RIDGE, GROOVE), - 'RepeatDelay': 'time', - 'RepeatInterval': 'time', - 'ScrollCommand': 'command', - 'ScrollIncrement': 'pixel', - 'ScrollRegion': 'rectangle', - 'ShowValue': 'boolean', - 'SetGrid': 'boolean', - 'Sliderforeground': 'color', - 'SliderLength': 'pixel', - 'Text': 'string', - 'TickInterval': 'integer', - 'To': 'integer', - 'Underline': 'index', - 'Variable': 'variable', - 'Value': 'string', - 'Width': 'pixel', - 'Wrap': (NONE, CHAR, WORD), - } - - # Classes that (may) differ per widget type - _tristate = {'State': (NORMAL, ACTIVE, DISABLED)} - _bistate = {'State': (NORMAL, DISABLED)} - addclasses = { - 'Button': _tristate, - 'Radiobutton': _tristate, - 'Checkbutton': _tristate, - 'Entry': _bistate, - 'Text': _bistate, - 'Menubutton': _tristate, - 'Slider': _bistate, - } - -class RemoteWidgetDialog(WidgetDialog): - - def __init__(self, master, app, widget): - self.app = app - self.widget = widget - self.klass = master.send(self.app, - 'winfo', - 'class', - self.widget) - Dialog.__init__(self, master) - - def refresh(self): - try: - items = self.master.tk.splitlist( - self.master.send(self.app, - self.widget, - 'config')) - except TclError, msg: - print msg - return - dict = {} - for item in items: - words = self.master.tk.splitlist(item) - key = words[0][1:] - value = (key,) + words[1:] - dict[key] = value - self.configuration = dict - self.update() - self.current['.class'] = self.klass - self.current['.name'] = self.widget - - class remotewidgetoption: # Mix-in class - def set(self, e=None): - self.current = self.var.get() - try: - self.dialog.master.send( - self.dialog.app, - self.dialog.widget, - 'config', - '-'+self.option, - self.current) - except TclError, msg: - print msg - self.refresh() - - class booleanoption(remotewidgetoption, BooleanOption): pass - class enumoption(remotewidgetoption, EnumOption): pass - class stringoption(remotewidgetoption, StringOption): pass - class readonlyoption(remotewidgetoption, ReadonlyOption): pass - -def test(): - import sys - root = Tk() - root.minsize(1, 1) - if sys.argv[1:]: - remotetest(root, sys.argv[1]) - else: - frame = Frame(root, name='frame') - frame.pack(expand=1, fill=BOTH) - button = Button(frame, name='button', text='button') - button.pack(expand=1) - canvas = Canvas(frame, name='canvas') - canvas.pack() - fpd = PackDialog(frame) - fwd = WidgetDialog(frame) - bpd = PackDialog(button) - bwd = WidgetDialog(button) - cpd = PackDialog(canvas) - cwd = WidgetDialog(canvas) - root.mainloop() - -def remotetest(root, app): - from listtree import listtree - list = listtree(root, app) - list.bind('<Any-Double-1>', opendialogs) - list.app = app # Pass it on to handler - -def opendialogs(e): - import string - list = e.widget - sel = list.curselection() - for i in sel: - item = list.get(i) - widget = string.split(item)[0] - RemoteWidgetDialog(list, list.app, widget) - if widget == '.': continue - try: - RemotePackDialog(list, list.app, widget) - except TclError, msg: - print msg - -test() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/ManPage.py b/sys/src/cmd/python/Demo/tkinter/guido/ManPage.py deleted file mode 100755 index de3117b35..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/ManPage.py +++ /dev/null @@ -1,220 +0,0 @@ -# Widget to display a man page - -import re -from Tkinter import * -from Tkinter import _tkinter -from ScrolledText import ScrolledText - -# XXX These fonts may have to be changed to match your system -BOLDFONT = '*-Courier-Bold-R-Normal-*-120-*' -ITALICFONT = '*-Courier-Medium-O-Normal-*-120-*' - -# XXX Recognizing footers is system dependent -# (This one works for IRIX 5.2 and Solaris 2.2) -footerprog = re.compile( - '^ Page [1-9][0-9]*[ \t]+\|^.*Last change:.*[1-9][0-9]*\n') -emptyprog = re.compile('^[ \t]*\n') -ulprog = re.compile('^[ \t]*[Xv!_][Xv!_ \t]*\n') - -# Basic Man Page class -- does not disable editing -class EditableManPage(ScrolledText): - - # Initialize instance - def __init__(self, master=None, **cnf): - # Initialize base class - apply(ScrolledText.__init__, (self, master), cnf) - - # Define tags for formatting styles - self.tag_config('X', underline=1) - self.tag_config('!', font=BOLDFONT) - self.tag_config('_', font=ITALICFONT) - - # Set state to idle - self.fp = None - self.lineno = 0 - - # Test whether we are busy parsing a file - def busy(self): - return self.fp != None - - # Ensure we're not busy - def kill(self): - if self.busy(): - self._endparser() - - # Parse a file, in the background - def asyncparsefile(self, fp): - self._startparser(fp) - self.tk.createfilehandler(fp, _tkinter.READABLE, - self._filehandler) - - parsefile = asyncparsefile # Alias - - # I/O handler used by background parsing - def _filehandler(self, fp, mask): - nextline = self.fp.readline() - if not nextline: - self._endparser() - return - self._parseline(nextline) - - # Parse a file, now (cannot be aborted) - def syncparsefile(self, fp): - from select import select - def avail(fp=fp, tout=0.0, select=select): - return select([fp], [], [], tout)[0] - height = self.getint(self['height']) - self._startparser(fp) - while 1: - nextline = fp.readline() - if not nextline: - break - self._parseline(nextline) - self._endparser() - - # Initialize parsing from a particular file -- must not be busy - def _startparser(self, fp): - if self.busy(): - raise RuntimeError, 'startparser: still busy' - fp.fileno() # Test for file-ness - self.fp = fp - self.lineno = 0 - self.ok = 0 - self.empty = 0 - self.buffer = None - savestate = self['state'] - self['state'] = NORMAL - self.delete('1.0', END) - self['state'] = savestate - - # End parsing -- must be busy, need not be at EOF - def _endparser(self): - if not self.busy(): - raise RuntimeError, 'endparser: not busy' - if self.buffer: - self._parseline('') - try: - self.tk.deletefilehandler(self.fp) - except TclError, msg: - pass - self.fp.close() - self.fp = None - del self.ok, self.empty, self.buffer - - # Parse a single line - def _parseline(self, nextline): - if not self.buffer: - # Save this line -- we need one line read-ahead - self.buffer = nextline - return - if emptyprog.match(self.buffer) >= 0: - # Buffered line was empty -- set a flag - self.empty = 1 - self.buffer = nextline - return - textline = self.buffer - if ulprog.match(nextline) >= 0: - # Next line is properties for buffered line - propline = nextline - self.buffer = None - else: - # Next line is read-ahead - propline = None - self.buffer = nextline - if not self.ok: - # First non blank line after footer must be header - # -- skip that too - self.ok = 1 - self.empty = 0 - return - if footerprog.match(textline) >= 0: - # Footer -- start skipping until next non-blank line - self.ok = 0 - self.empty = 0 - return - savestate = self['state'] - self['state'] = NORMAL - if TkVersion >= 4.0: - self.mark_set('insert', 'end-1c') - else: - self.mark_set('insert', END) - if self.empty: - # One or more previous lines were empty - # -- insert one blank line in the text - self._insert_prop('\n') - self.lineno = self.lineno + 1 - self.empty = 0 - if not propline: - # No properties - self._insert_prop(textline) - else: - # Search for properties - p = '' - j = 0 - for i in range(min(len(propline), len(textline))): - if propline[i] != p: - if j < i: - self._insert_prop(textline[j:i], p) - j = i - p = propline[i] - self._insert_prop(textline[j:]) - self.lineno = self.lineno + 1 - self['state'] = savestate - - # Insert a string at the end, with at most one property (tag) - def _insert_prop(self, str, prop = ' '): - here = self.index(AtInsert()) - self.insert(AtInsert(), str) - if TkVersion <= 4.0: - tags = self.tag_names(here) - for tag in tags: - self.tag_remove(tag, here, AtInsert()) - if prop != ' ': - self.tag_add(prop, here, AtInsert()) - -# Readonly Man Page class -- disables editing, otherwise the same -class ReadonlyManPage(EditableManPage): - - # Initialize instance - def __init__(self, master=None, **cnf): - cnf['state'] = DISABLED - apply(EditableManPage.__init__, (self, master), cnf) - -# Alias -ManPage = ReadonlyManPage - -# Test program. -# usage: ManPage [manpage]; or ManPage [-f] file -# -f means that the file is nroff -man output run through ul -i -def test(): - import os - import sys - # XXX This directory may be different on your system - MANDIR = '/usr/local/man/mann' - DEFAULTPAGE = 'Tcl' - formatted = 0 - if sys.argv[1:] and sys.argv[1] == '-f': - formatted = 1 - del sys.argv[1] - if sys.argv[1:]: - name = sys.argv[1] - else: - name = DEFAULTPAGE - if not formatted: - if name[-2:-1] != '.': - name = name + '.n' - name = os.path.join(MANDIR, name) - root = Tk() - root.minsize(1, 1) - manpage = ManPage(root, relief=SUNKEN, borderwidth=2) - manpage.pack(expand=1, fill=BOTH) - if formatted: - fp = open(name, 'r') - else: - fp = os.popen('nroff -man %s | ul -i' % name, 'r') - manpage.parsefile(fp) - root.mainloop() - -# Run the test program when called as a script -if __name__ == '__main__': - test() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/MimeViewer.py b/sys/src/cmd/python/Demo/tkinter/guido/MimeViewer.py deleted file mode 100755 index 749442589..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/MimeViewer.py +++ /dev/null @@ -1,143 +0,0 @@ -#! /usr/bin/env python - -# View a single MIME multipart message. -# Display each part as a box. - -import string -from types import * -from Tkinter import * -from ScrolledText import ScrolledText - -class MimeViewer: - def __init__(self, parent, title, msg): - self.title = title - self.msg = msg - self.frame = Frame(parent, {'relief': 'raised', 'bd': 2}) - self.frame.packing = {'expand': 0, 'fill': 'both'} - self.button = Checkbutton(self.frame, - {'text': title, - 'command': self.toggle}) - self.button.pack({'anchor': 'w'}) - headertext = msg.getheadertext( - lambda x: x != 'received' and x[:5] != 'x400-') - height = countlines(headertext, 4) - if height: - self.htext = ScrolledText(self.frame, - {'height': height, - 'width': 80, - 'wrap': 'none', - 'relief': 'raised', - 'bd': 2}) - self.htext.packing = {'expand': 1, 'fill': 'both', - 'after': self.button} - self.htext.insert('end', headertext) - else: - self.htext = Frame(self.frame, - {'relief': 'raised', 'bd': 2}) - self.htext.packing = {'side': 'top', - 'ipady': 2, - 'fill': 'x', - 'after': self.button} - body = msg.getbody() - if type(body) == StringType: - self.pad = None - height = countlines(body, 10) - if height: - self.btext = ScrolledText(self.frame, - {'height': height, - 'width': 80, - 'wrap': 'none', - 'relief': 'raised', - 'bd': 2}) - self.btext.packing = {'expand': 1, - 'fill': 'both'} - self.btext.insert('end', body) - else: - self.btext = None - self.parts = None - else: - self.pad = Frame(self.frame, - {'relief': 'flat', 'bd': 2}) - self.pad.packing = {'side': 'left', 'ipadx': 10, - 'fill': 'y', 'after': self.htext} - self.parts = [] - for i in range(len(body)): - p = MimeViewer(self.frame, - '%s.%d' % (title, i+1), - body[i]) - self.parts.append(p) - self.btext = None - self.collapsed = 1 - def pack(self): - self.frame.pack(self.frame.packing) - def destroy(self): - self.frame.destroy() - def show(self): - if self.collapsed: - self.button.invoke() - def toggle(self): - if self.collapsed: - self.explode() - else: - self.collapse() - def collapse(self): - self.collapsed = 1 - for comp in self.htext, self.btext, self.pad: - if comp: - comp.forget() - if self.parts: - for part in self.parts: - part.frame.forget() - self.frame.pack({'expand': 0}) - def explode(self): - self.collapsed = 0 - for comp in self.htext, self.btext, self.pad: - if comp: comp.pack(comp.packing) - if self.parts: - for part in self.parts: - part.pack() - self.frame.pack({'expand': 1}) - -def countlines(str, limit): - i = 0 - n = 0 - while n < limit: - i = string.find(str, '\n', i) - if i < 0: break - n = n+1 - i = i+1 - return n - -def main(): - import sys - import getopt - import mhlib - opts, args = getopt.getopt(sys.argv[1:], '') - for o, a in opts: - pass - message = None - folder = 'inbox' - for arg in args: - if arg[:1] == '+': - folder = arg[1:] - else: - message = string.atoi(arg) - - mh = mhlib.MH() - f = mh.openfolder(folder) - if not message: - message = f.getcurrent() - m = f.openmessage(message) - - root = Tk() - tk = root.tk - - top = MimeViewer(root, '+%s/%d' % (folder, message), m) - top.pack() - top.show() - - root.minsize(1, 1) - - tk.mainloop() - -if __name__ == '__main__': main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/ShellWindow.py b/sys/src/cmd/python/Demo/tkinter/guido/ShellWindow.py deleted file mode 100755 index 609101bc8..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/ShellWindow.py +++ /dev/null @@ -1,151 +0,0 @@ -import os -import sys -import string -from Tkinter import * -from ScrolledText import ScrolledText -from Dialog import Dialog -import signal - -BUFSIZE = 512 - -class ShellWindow(ScrolledText): - - def __init__(self, master=None, shell=None, **cnf): - if not shell: - try: - shell = os.environ['SHELL'] - except KeyError: - shell = '/bin/sh' - shell = shell + ' -i' - args = string.split(shell) - shell = args[0] - - apply(ScrolledText.__init__, (self, master), cnf) - self.pos = '1.0' - self.bind('<Return>', self.inputhandler) - self.bind('<Control-c>', self.sigint) - self.bind('<Control-t>', self.sigterm) - self.bind('<Control-k>', self.sigkill) - self.bind('<Control-d>', self.sendeof) - - self.pid, self.fromchild, self.tochild = spawn(shell, args) - self.tk.createfilehandler(self.fromchild, READABLE, - self.outputhandler) - - def outputhandler(self, file, mask): - data = os.read(file, BUFSIZE) - if not data: - self.tk.deletefilehandler(file) - pid, sts = os.waitpid(self.pid, 0) - print 'pid', pid, 'status', sts - self.pid = None - detail = sts>>8 - cause = sts & 0xff - if cause == 0: - msg = "exit status %d" % detail - else: - msg = "killed by signal %d" % (cause & 0x7f) - if cause & 0x80: - msg = msg + " -- core dumped" - Dialog(self.master, - text=msg, - title="Exit status", - bitmap='warning', - default=0, - strings=('OK',)) - return - self.insert(END, data) - self.pos = self.index("end - 1 char") - self.yview_pickplace(END) - - def inputhandler(self, *args): - if not self.pid: - self.no_process() - return "break" - self.insert(END, "\n") - line = self.get(self.pos, "end - 1 char") - self.pos = self.index(END) - os.write(self.tochild, line) - return "break" - - def sendeof(self, *args): - if not self.pid: - self.no_process() - return "break" - os.close(self.tochild) - return "break" - - def sendsig(self, sig): - if not self.pid: - self.no_process() - return "break" - os.kill(self.pid, sig) - return "break" - - def sigint(self, *args): - return self.sendsig(signal.SIGINT) - - def sigquit(self, *args): - return self.sendsig(signal.SIGQUIT) - - def sigterm(self, *args): - return self.sendsig(signal.SIGTERM) - - def sigkill(self, *args): - return self.sendsig(signal.SIGKILL) - - def no_process(self): - Dialog(self.master, - text="No active process", - title="No process", - bitmap='error', - default=0, - strings=('OK',)) - -MAXFD = 100 # Max number of file descriptors (os.getdtablesize()???) - -def spawn(prog, args): - p2cread, p2cwrite = os.pipe() - c2pread, c2pwrite = os.pipe() - pid = os.fork() - if pid == 0: - # Child - for i in 0, 1, 2: - try: - os.close(i) - except os.error: - pass - if os.dup(p2cread) <> 0: - sys.stderr.write('popen2: bad read dup\n') - if os.dup(c2pwrite) <> 1: - sys.stderr.write('popen2: bad write dup\n') - if os.dup(c2pwrite) <> 2: - sys.stderr.write('popen2: bad write dup\n') - for i in range(3, MAXFD): - try: - os.close(i) - except: - pass - try: - os.execvp(prog, args) - finally: - sys.stderr.write('execvp failed\n') - os._exit(1) - os.close(p2cread) - os.close(c2pwrite) - return pid, c2pread, p2cwrite - -def test(): - shell = string.join(sys.argv[1:]) - root = Tk() - root.minsize(1, 1) - if shell: - w = ShellWindow(root, shell=shell) - else: - w = ShellWindow(root) - w.pack(expand=1, fill=BOTH) - w.focus_set() - w.tk.mainloop() - -if __name__ == '__main__': - test() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/brownian.py b/sys/src/cmd/python/Demo/tkinter/guido/brownian.py deleted file mode 100644 index 8007f141c..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/brownian.py +++ /dev/null @@ -1,50 +0,0 @@ -# Brownian motion -- an example of a multi-threaded Tkinter program. - -from Tkinter import * -import random -import threading -import time -import sys - -WIDTH = 400 -HEIGHT = 300 -SIGMA = 10 -BUZZ = 2 -RADIUS = 2 -LAMBDA = 10 -FILL = 'red' - -stop = 0 # Set when main loop exits - -def particle(canvas): - r = RADIUS - x = random.gauss(WIDTH/2.0, SIGMA) - y = random.gauss(HEIGHT/2.0, SIGMA) - p = canvas.create_oval(x-r, y-r, x+r, y+r, fill=FILL) - while not stop: - dx = random.gauss(0, BUZZ) - dy = random.gauss(0, BUZZ) - dt = random.expovariate(LAMBDA) - try: - canvas.move(p, dx, dy) - except TclError: - break - time.sleep(dt) - -def main(): - global stop - root = Tk() - canvas = Canvas(root, width=WIDTH, height=HEIGHT) - canvas.pack(fill='both', expand=1) - np = 30 - if sys.argv[1:]: - np = int(sys.argv[1]) - for i in range(np): - t = threading.Thread(target=particle, args=(canvas,)) - t.start() - try: - root.mainloop() - finally: - stop = 1 - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/canvasevents.py b/sys/src/cmd/python/Demo/tkinter/guido/canvasevents.py deleted file mode 100644 index 74ed76f61..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/canvasevents.py +++ /dev/null @@ -1,244 +0,0 @@ -#! /usr/bin/env python - -from Tkinter import * -from Canvas import Oval, Group, CanvasText - - -# Fix a bug in Canvas.Group as distributed in Python 1.4. The -# distributed bind() method is broken. This is what should be used: - -class Group(Group): - def bind(self, sequence=None, command=None): - return self.canvas.tag_bind(self.id, sequence, command) - -class Object: - - """Base class for composite graphical objects. - - Objects belong to a canvas, and can be moved around on the canvas. - They also belong to at most one ``pile'' of objects, and can be - transferred between piles (or removed from their pile). - - Objects have a canonical ``x, y'' position which is moved when the - object is moved. Where the object is relative to this position - depends on the object; for simple objects, it may be their center. - - Objects have mouse sensitivity. They can be clicked, dragged and - double-clicked. The behavior may actually determined by the pile - they are in. - - All instance attributes are public since the derived class may - need them. - - """ - - def __init__(self, canvas, x=0, y=0, fill='red', text='object'): - self.canvas = canvas - self.x = x - self.y = y - self.pile = None - self.group = Group(self.canvas) - self.createitems(fill, text) - - def __str__(self): - return str(self.group) - - def createitems(self, fill, text): - self.__oval = Oval(self.canvas, - self.x-20, self.y-10, self.x+20, self.y+10, - fill=fill, width=3) - self.group.addtag_withtag(self.__oval) - self.__text = CanvasText(self.canvas, - self.x, self.y, text=text) - self.group.addtag_withtag(self.__text) - - def moveby(self, dx, dy): - if dx == dy == 0: - return - self.group.move(dx, dy) - self.x = self.x + dx - self.y = self.y + dy - - def moveto(self, x, y): - self.moveby(x - self.x, y - self.y) - - def transfer(self, pile): - if self.pile: - self.pile.delete(self) - self.pile = None - self.pile = pile - if self.pile: - self.pile.add(self) - - def tkraise(self): - self.group.tkraise() - - -class Bottom(Object): - - """An object to serve as the bottom of a pile.""" - - def createitems(self, *args): - self.__oval = Oval(self.canvas, - self.x-20, self.y-10, self.x+20, self.y+10, - fill='gray', outline='') - self.group.addtag_withtag(self.__oval) - - -class Pile: - - """A group of graphical objects.""" - - def __init__(self, canvas, x, y, tag=None): - self.canvas = canvas - self.x = x - self.y = y - self.objects = [] - self.bottom = Bottom(self.canvas, self.x, self.y) - self.group = Group(self.canvas, tag=tag) - self.group.addtag_withtag(self.bottom.group) - self.bindhandlers() - - def bindhandlers(self): - self.group.bind('<1>', self.clickhandler) - self.group.bind('<Double-1>', self.doubleclickhandler) - - def add(self, object): - self.objects.append(object) - self.group.addtag_withtag(object.group) - self.position(object) - - def delete(self, object): - object.group.dtag(self.group) - self.objects.remove(object) - - def position(self, object): - object.tkraise() - i = self.objects.index(object) - object.moveto(self.x + i*4, self.y + i*8) - - def clickhandler(self, event): - pass - - def doubleclickhandler(self, event): - pass - - -class MovingPile(Pile): - - def bindhandlers(self): - Pile.bindhandlers(self) - self.group.bind('<B1-Motion>', self.motionhandler) - self.group.bind('<ButtonRelease-1>', self.releasehandler) - - movethis = None - - def clickhandler(self, event): - tags = self.canvas.gettags('current') - for i in range(len(self.objects)): - o = self.objects[i] - if o.group.tag in tags: - break - else: - self.movethis = None - return - self.movethis = self.objects[i:] - for o in self.movethis: - o.tkraise() - self.lastx = event.x - self.lasty = event.y - - doubleclickhandler = clickhandler - - def motionhandler(self, event): - if not self.movethis: - return - dx = event.x - self.lastx - dy = event.y - self.lasty - self.lastx = event.x - self.lasty = event.y - for o in self.movethis: - o.moveby(dx, dy) - - def releasehandler(self, event): - objects = self.movethis - if not objects: - return - self.movethis = None - self.finishmove(objects) - - def finishmove(self, objects): - for o in objects: - self.position(o) - - -class Pile1(MovingPile): - - x = 50 - y = 50 - tag = 'p1' - - def __init__(self, demo): - self.demo = demo - MovingPile.__init__(self, self.demo.canvas, self.x, self.y, self.tag) - - def doubleclickhandler(self, event): - try: - o = self.objects[-1] - except IndexError: - return - o.transfer(self.other()) - MovingPile.doubleclickhandler(self, event) - - def other(self): - return self.demo.p2 - - def finishmove(self, objects): - o = objects[0] - p = self.other() - x, y = o.x, o.y - if (x-p.x)**2 + (y-p.y)**2 < (x-self.x)**2 + (y-self.y)**2: - for o in objects: - o.transfer(p) - else: - MovingPile.finishmove(self, objects) - -class Pile2(Pile1): - - x = 150 - y = 50 - tag = 'p2' - - def other(self): - return self.demo.p1 - - -class Demo: - - def __init__(self, master): - self.master = master - self.canvas = Canvas(master, - width=200, height=200, - background='yellow', - relief=SUNKEN, borderwidth=2) - self.canvas.pack(expand=1, fill=BOTH) - self.p1 = Pile1(self) - self.p2 = Pile2(self) - o1 = Object(self.canvas, fill='red', text='o1') - o2 = Object(self.canvas, fill='green', text='o2') - o3 = Object(self.canvas, fill='light blue', text='o3') - o1.transfer(self.p1) - o2.transfer(self.p1) - o3.transfer(self.p2) - - -# Main function, run when invoked as a stand-alone Python program. - -def main(): - root = Tk() - demo = Demo(root) - root.protocol('WM_DELETE_WINDOW', root.quit) - root.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/dialog.py b/sys/src/cmd/python/Demo/tkinter/guido/dialog.py deleted file mode 100755 index 50d84b9a3..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/dialog.py +++ /dev/null @@ -1,109 +0,0 @@ -#! /usr/bin/env python - -# A Python function that generates dialog boxes with a text message, -# optional bitmap, and any number of buttons. -# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.2-3, pp. 269-270. - -from Tkinter import * -import sys - - -def dialog(master, title, text, bitmap, default, *args): - - # 1. Create the top-level window and divide it into top - # and bottom parts. - - w = Toplevel(master, class_='Dialog') - w.title(title) - w.iconname('Dialog') - - top = Frame(w, relief=RAISED, borderwidth=1) - top.pack(side=TOP, fill=BOTH) - bot = Frame(w, relief=RAISED, borderwidth=1) - bot.pack(side=BOTTOM, fill=BOTH) - - # 2. Fill the top part with the bitmap and message. - - msg = Message(top, width='3i', text=text, - font='-Adobe-Times-Medium-R-Normal-*-180-*') - msg.pack(side=RIGHT, expand=1, fill=BOTH, padx='3m', pady='3m') - if bitmap: - bm = Label(top, bitmap=bitmap) - bm.pack(side=LEFT, padx='3m', pady='3m') - - # 3. Create a row of buttons at the bottom of the dialog. - - var = IntVar() - buttons = [] - i = 0 - for but in args: - b = Button(bot, text=but, command=lambda v=var,i=i: v.set(i)) - buttons.append(b) - if i == default: - bd = Frame(bot, relief=SUNKEN, borderwidth=1) - bd.pack(side=LEFT, expand=1, padx='3m', pady='2m') - b.lift() - b.pack (in_=bd, side=LEFT, - padx='2m', pady='2m', ipadx='2m', ipady='1m') - else: - b.pack (side=LEFT, expand=1, - padx='3m', pady='3m', ipadx='2m', ipady='1m') - i = i+1 - - # 4. Set up a binding for <Return>, if there's a default, - # set a grab, and claim the focus too. - - if default >= 0: - w.bind('<Return>', - lambda e, b=buttons[default], v=var, i=default: - (b.flash(), - v.set(i))) - - oldFocus = w.focus_get() - w.grab_set() - w.focus_set() - - # 5. Wait for the user to respond, then restore the focus - # and return the index of the selected button. - - w.waitvar(var) - w.destroy() - if oldFocus: oldFocus.focus_set() - return var.get() - -# The rest is the test program. - -def go(): - i = dialog(mainWidget, - 'Not Responding', - "The file server isn't responding right now; " - "I'll keep trying.", - '', - -1, - 'OK') - print 'pressed button', i - i = dialog(mainWidget, - 'File Modified', - 'File "tcl.h" has been modified since ' - 'the last time it was saved. ' - 'Do you want to save it before exiting the application?', - 'warning', - 0, - 'Save File', - 'Discard Changes', - 'Return To Editor') - print 'pressed button', i - -def test(): - import sys - global mainWidget - mainWidget = Frame() - Pack.config(mainWidget) - start = Button(mainWidget, text='Press Here To Start', command=go) - start.pack() - endit = Button(mainWidget, text="Exit", command=sys.exit) - endit.pack(fill=BOTH) - mainWidget.mainloop() - -if __name__ == '__main__': - test() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/electrons.py b/sys/src/cmd/python/Demo/tkinter/guido/electrons.py deleted file mode 100755 index fdc558f88..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/electrons.py +++ /dev/null @@ -1,91 +0,0 @@ -#! /usr/bin/env python - -# Simulate "electrons" migrating across the screen. -# An optional bitmap file in can be in the background. -# -# Usage: electrons [n [bitmapfile]] -# -# n is the number of electrons to animate; default is 30. -# -# The bitmap file can be any X11 bitmap file (look in -# /usr/include/X11/bitmaps for samples); it is displayed as the -# background of the animation. Default is no bitmap. - -from Tkinter import * -import random - - -# The graphical interface -class Electrons: - - # Create our objects - def __init__(self, n, bitmap = None): - self.n = n - self.tk = tk = Tk() - self.canvas = c = Canvas(tk) - c.pack() - width, height = tk.getint(c['width']), tk.getint(c['height']) - - # Add background bitmap - if bitmap: - self.bitmap = c.create_bitmap(width/2, height/2, - bitmap=bitmap, - foreground='blue') - - self.pieces = [] - x1, y1, x2, y2 = 10,70,14,74 - for i in range(n): - p = c.create_oval(x1, y1, x2, y2, fill='red') - self.pieces.append(p) - y1, y2 = y1 +2, y2 + 2 - self.tk.update() - - def random_move(self, n): - c = self.canvas - for p in self.pieces: - x = random.choice(range(-2,4)) - y = random.choice(range(-3,4)) - c.move(p, x, y) - self.tk.update() - - # Run -- allow 500 movemens - def run(self): - try: - for i in range(500): - self.random_move(self.n) - except TclError: - try: - self.tk.destroy() - except TclError: - pass - - -# Main program -def main(): - import sys, string - - # First argument is number of electrons, default 30 - if sys.argv[1:]: - n = string.atoi(sys.argv[1]) - else: - n = 30 - - # Second argument is bitmap file, default none - if sys.argv[2:]: - bitmap = sys.argv[2] - # Reverse meaning of leading '@' compared to Tk - if bitmap[0] == '@': bitmap = bitmap[1:] - else: bitmap = '@' + bitmap - else: - bitmap = None - - # Create the graphical objects... - h = Electrons(n, bitmap) - - # ...and run! - h.run() - - -# Call main when run as script -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/hanoi.py b/sys/src/cmd/python/Demo/tkinter/guido/hanoi.py deleted file mode 100755 index 078c24611..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/hanoi.py +++ /dev/null @@ -1,154 +0,0 @@ -# Animated Towers of Hanoi using Tk with optional bitmap file in -# background. -# -# Usage: tkhanoi [n [bitmapfile]] -# -# n is the number of pieces to animate; default is 4, maximum 15. -# -# The bitmap file can be any X11 bitmap file (look in -# /usr/include/X11/bitmaps for samples); it is displayed as the -# background of the animation. Default is no bitmap. - -# This uses Steen Lumholt's Tk interface -from Tkinter import * - - -# Basic Towers-of-Hanoi algorithm: move n pieces from a to b, using c -# as temporary. For each move, call report() -def hanoi(n, a, b, c, report): - if n <= 0: return - hanoi(n-1, a, c, b, report) - report(n, a, b) - hanoi(n-1, c, b, a, report) - - -# The graphical interface -class Tkhanoi: - - # Create our objects - def __init__(self, n, bitmap = None): - self.n = n - self.tk = tk = Tk() - self.canvas = c = Canvas(tk) - c.pack() - width, height = tk.getint(c['width']), tk.getint(c['height']) - - # Add background bitmap - if bitmap: - self.bitmap = c.create_bitmap(width/2, height/2, - bitmap=bitmap, - foreground='blue') - - # Generate pegs - pegwidth = 10 - pegheight = height/2 - pegdist = width/3 - x1, y1 = (pegdist-pegwidth)/2, height*1/3 - x2, y2 = x1+pegwidth, y1+pegheight - self.pegs = [] - p = c.create_rectangle(x1, y1, x2, y2, fill='black') - self.pegs.append(p) - x1, x2 = x1+pegdist, x2+pegdist - p = c.create_rectangle(x1, y1, x2, y2, fill='black') - self.pegs.append(p) - x1, x2 = x1+pegdist, x2+pegdist - p = c.create_rectangle(x1, y1, x2, y2, fill='black') - self.pegs.append(p) - self.tk.update() - - # Generate pieces - pieceheight = pegheight/16 - maxpiecewidth = pegdist*2/3 - minpiecewidth = 2*pegwidth - self.pegstate = [[], [], []] - self.pieces = {} - x1, y1 = (pegdist-maxpiecewidth)/2, y2-pieceheight-2 - x2, y2 = x1+maxpiecewidth, y1+pieceheight - dx = (maxpiecewidth-minpiecewidth) / (2*max(1, n-1)) - for i in range(n, 0, -1): - p = c.create_rectangle(x1, y1, x2, y2, fill='red') - self.pieces[i] = p - self.pegstate[0].append(i) - x1, x2 = x1 + dx, x2-dx - y1, y2 = y1 - pieceheight-2, y2-pieceheight-2 - self.tk.update() - self.tk.after(25) - - # Run -- never returns - def run(self): - while 1: - hanoi(self.n, 0, 1, 2, self.report) - hanoi(self.n, 1, 2, 0, self.report) - hanoi(self.n, 2, 0, 1, self.report) - hanoi(self.n, 0, 2, 1, self.report) - hanoi(self.n, 2, 1, 0, self.report) - hanoi(self.n, 1, 0, 2, self.report) - - # Reporting callback for the actual hanoi function - def report(self, i, a, b): - if self.pegstate[a][-1] != i: raise RuntimeError # Assertion - del self.pegstate[a][-1] - p = self.pieces[i] - c = self.canvas - - # Lift the piece above peg a - ax1, ay1, ax2, ay2 = c.bbox(self.pegs[a]) - while 1: - x1, y1, x2, y2 = c.bbox(p) - if y2 < ay1: break - c.move(p, 0, -1) - self.tk.update() - - # Move it towards peg b - bx1, by1, bx2, by2 = c.bbox(self.pegs[b]) - newcenter = (bx1+bx2)/2 - while 1: - x1, y1, x2, y2 = c.bbox(p) - center = (x1+x2)/2 - if center == newcenter: break - if center > newcenter: c.move(p, -1, 0) - else: c.move(p, 1, 0) - self.tk.update() - - # Move it down on top of the previous piece - pieceheight = y2-y1 - newbottom = by2 - pieceheight*len(self.pegstate[b]) - 2 - while 1: - x1, y1, x2, y2 = c.bbox(p) - if y2 >= newbottom: break - c.move(p, 0, 1) - self.tk.update() - - # Update peg state - self.pegstate[b].append(i) - - -# Main program -def main(): - import sys, string - - # First argument is number of pegs, default 4 - if sys.argv[1:]: - n = string.atoi(sys.argv[1]) - else: - n = 4 - - # Second argument is bitmap file, default none - if sys.argv[2:]: - bitmap = sys.argv[2] - # Reverse meaning of leading '@' compared to Tk - if bitmap[0] == '@': bitmap = bitmap[1:] - else: bitmap = '@' + bitmap - else: - bitmap = None - - # Create the graphical objects... - h = Tkhanoi(n, bitmap) - - # ...and run! - h.run() - - -# Call main when run as script -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/hello.py b/sys/src/cmd/python/Demo/tkinter/guido/hello.py deleted file mode 100755 index 358a7eceb..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/hello.py +++ /dev/null @@ -1,17 +0,0 @@ -# Display hello, world in a button; clicking it quits the program - -import sys -from Tkinter import * - -def main(): - root = Tk() - button = Button(root) - button['text'] = 'Hello, world' - button['command'] = quit_callback # See below - button.pack() - root.mainloop() - -def quit_callback(): - sys.exit(0) - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/imagedraw.py b/sys/src/cmd/python/Demo/tkinter/guido/imagedraw.py deleted file mode 100755 index d3dba4565..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/imagedraw.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Draw on top of an image""" - -from Tkinter import * -import sys - -def main(): - filename = sys.argv[1] - root = Tk() - img = PhotoImage(file=filename) - w, h = img.width(), img.height() - canv = Canvas(root, width=w, height=h) - canv.create_image(0, 0, anchor=NW, image=img) - canv.pack() - canv.bind('<Button-1>', blob) - root.mainloop() - -def blob(event): - x, y = event.x, event.y - canv = event.widget - r = 5 - canv.create_oval(x-r, y-r, x+r, y+r, fill='red', outline="") - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/imageview.py b/sys/src/cmd/python/Demo/tkinter/guido/imageview.py deleted file mode 100755 index d6efed0b2..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/imageview.py +++ /dev/null @@ -1,12 +0,0 @@ -from Tkinter import * -import sys - -def main(): - filename = sys.argv[1] - root = Tk() - img = PhotoImage(file=filename) - label = Label(root, image=img) - label.pack() - root.mainloop() - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/kill.py b/sys/src/cmd/python/Demo/tkinter/guido/kill.py deleted file mode 100755 index e7df26121..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/kill.py +++ /dev/null @@ -1,98 +0,0 @@ -#! /usr/bin/env python -# Tkinter interface to Linux `kill' command. - -from Tkinter import * -from string import splitfields -from string import split -import commands -import os - -class BarButton(Menubutton): - def __init__(self, master=None, **cnf): - apply(Menubutton.__init__, (self, master), cnf) - self.pack(side=LEFT) - self.menu = Menu(self, name='menu') - self['menu'] = self.menu - -class Kill(Frame): - # List of (name, option, pid_column) - format_list = [('Default', '', 0), - ('Long', '-l', 2), - ('User', '-u', 1), - ('Jobs', '-j', 1), - ('Signal', '-s', 1), - ('Memory', '-m', 0), - ('VM', '-v', 0), - ('Hex', '-X', 0)] - def kill(self, selected): - c = self.format_list[self.format.get()][2] - pid = split(selected)[c] - os.system('kill -9 ' + pid) - self.do_update() - def do_update(self): - name, option, column = self.format_list[self.format.get()] - s = commands.getoutput('ps -w ' + option) - list = splitfields(s, '\n') - self.header.set(list[0]) - del list[0] - y = self.frame.vscroll.get()[0] - self.frame.list.delete(0, AtEnd()) - for line in list: - self.frame.list.insert(0, line) - self.frame.list.yview(int(y)) - def do_motion(self, e): - e.widget.select_clear(0, END) - e.widget.select_set(e.widget.nearest(e.y)) - def do_leave(self, e): - e.widget.select_clear(0, END) - def do_1(self, e): - self.kill(e.widget.get(e.widget.nearest(e.y))) - def __init__(self, master=None, **cnf): - Frame.__init__(self, master, cnf) - self.pack(expand=1, fill=BOTH) - self.bar = Frame(self, name='bar', relief=RAISED, - borderwidth=2) - self.bar.pack(fill=X) - self.bar.file = BarButton(self.bar, text='File') - self.bar.file.menu.add_command( - label='Quit', command=self.quit) - self.bar.view = BarButton(self.bar, text='View') - self.format = IntVar(self) - self.format.set(2) - for num in range(len(self.format_list)): - self.bar.view.menu.add_radiobutton( - label=self.format_list[num][0], - command=self.do_update, - variable=self.format, - value=num) - #self.bar.view.menu.add_separator() - #XXX ... - self.bar.tk_menuBar(self.bar.file, self.bar.view) - self.frame = Frame(self, relief=RAISED, borderwidth=2) - self.frame.pack(expand=1, fill=BOTH) - self.header = StringVar(self) - self.frame.label = Label(self.frame, relief=FLAT, anchor=NW, - borderwidth=0, - textvariable=self.header) - self.frame.label.pack(fill=X) - self.frame.vscroll = Scrollbar(self.frame, orient=VERTICAL) - self.frame.list = Listbox(self.frame, relief=SUNKEN, - selectbackground='#eed5b7', - selectborderwidth=0, - yscroll=self.frame.vscroll.set) - self.frame.vscroll['command'] = self.frame.list.yview - self.frame.vscroll.pack(side=RIGHT, fill=Y) - self.frame.list.pack(expand=1, fill=BOTH) - self.update = Button(self, text="Update", - command=self.do_update) - self.update.pack(expand=1, fill=X) - self.frame.list.bind('<Motion>', self.do_motion) - self.frame.list.bind('<Leave>', self.do_leave) - self.frame.list.bind('<1>', self.do_1) - self.do_update() - -if __name__ == '__main__': - kill = Kill(None, borderwidth=5) - kill.winfo_toplevel().title('Tkinter Process Killer') - kill.winfo_toplevel().minsize(1, 1) - kill.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/listtree.py b/sys/src/cmd/python/Demo/tkinter/guido/listtree.py deleted file mode 100755 index d28ce49ef..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/listtree.py +++ /dev/null @@ -1,37 +0,0 @@ -# List a remote app's widget tree (names and classes only) - -import sys -import string - -from Tkinter import * - -def listtree(master, app): - list = Listbox(master, name='list') - list.pack(expand=1, fill=BOTH) - listnodes(list, app, '.', 0) - return list - -def listnodes(list, app, widget, level): - klass = list.send(app, 'winfo', 'class', widget) -## i = string.rindex(widget, '.') -## list.insert(END, '%s%s (%s)' % ((level-1)*'. ', widget[i:], klass)) - list.insert(END, '%s (%s)' % (widget, klass)) - children = list.tk.splitlist( - list.send(app, 'winfo', 'children', widget)) - for c in children: - listnodes(list, app, c, level+1) - -def main(): - if not sys.argv[1:]: - sys.stderr.write('Usage: listtree appname\n') - sys.exit(2) - app = sys.argv[1] - tk = Tk() - tk.minsize(1, 1) - f = Frame(tk, name='f') - f.pack(expand=1, fill=BOTH) - list = listtree(f, app) - tk.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/mbox.py b/sys/src/cmd/python/Demo/tkinter/guido/mbox.py deleted file mode 100755 index 3c36d8899..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/mbox.py +++ /dev/null @@ -1,285 +0,0 @@ -#! /usr/bin/env python - -# Scan MH folder, display results in window - -import os -import sys -import re -import getopt -import string -import mhlib - -from Tkinter import * - -from dialog import dialog - -mailbox = os.environ['HOME'] + '/Mail' - -def main(): - global root, tk, top, mid, bot - global folderbox, foldermenu, scanbox, scanmenu, viewer - global folder, seq - global mh, mhf - - # Parse command line options - - folder = 'inbox' - seq = 'all' - try: - opts, args = getopt.getopt(sys.argv[1:], '') - except getopt.error, msg: - print msg - sys.exit(2) - for arg in args: - if arg[:1] == '+': - folder = arg[1:] - else: - seq = arg - - # Initialize MH - - mh = mhlib.MH() - mhf = mh.openfolder(folder) - - # Build widget hierarchy - - root = Tk() - tk = root.tk - - top = Frame(root) - top.pack({'expand': 1, 'fill': 'both'}) - - # Build right part: folder list - - right = Frame(top) - right.pack({'fill': 'y', 'side': 'right'}) - - folderbar = Scrollbar(right, {'relief': 'sunken', 'bd': 2}) - folderbar.pack({'fill': 'y', 'side': 'right'}) - - folderbox = Listbox(right, {'exportselection': 0}) - folderbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) - - foldermenu = Menu(root) - foldermenu.add('command', - {'label': 'Open Folder', - 'command': open_folder}) - foldermenu.add('separator') - foldermenu.add('command', - {'label': 'Quit', - 'command': 'exit'}) - foldermenu.bind('<ButtonRelease-3>', folder_unpost) - - folderbox['yscrollcommand'] = (folderbar, 'set') - folderbar['command'] = (folderbox, 'yview') - folderbox.bind('<Double-1>', open_folder, 1) - folderbox.bind('<3>', folder_post) - - # Build left part: scan list - - left = Frame(top) - left.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) - - scanbar = Scrollbar(left, {'relief': 'sunken', 'bd': 2}) - scanbar.pack({'fill': 'y', 'side': 'right'}) - - scanbox = Listbox(left, {'font': 'fixed'}) - scanbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) - - scanmenu = Menu(root) - scanmenu.add('command', - {'label': 'Open Message', - 'command': open_message}) - scanmenu.add('command', - {'label': 'Remove Message', - 'command': remove_message}) - scanmenu.add('command', - {'label': 'Refile Message', - 'command': refile_message}) - scanmenu.add('separator') - scanmenu.add('command', - {'label': 'Quit', - 'command': 'exit'}) - scanmenu.bind('<ButtonRelease-3>', scan_unpost) - - scanbox['yscrollcommand'] = (scanbar, 'set') - scanbar['command'] = (scanbox, 'yview') - scanbox.bind('<Double-1>', open_message) - scanbox.bind('<3>', scan_post) - - # Separator between middle and bottom part - - rule2 = Frame(root, {'bg': 'black'}) - rule2.pack({'fill': 'x'}) - - # Build bottom part: current message - - bot = Frame(root) - bot.pack({'expand': 1, 'fill': 'both'}) - # - viewer = None - - # Window manager commands - - root.minsize(800, 1) # Make window resizable - - # Fill folderbox with text - - setfolders() - - # Fill scanbox with text - - rescan() - - # Enter mainloop - - root.mainloop() - -def folder_post(e): - x, y = e.x_root, e.y_root - foldermenu.post(x - 10, y - 10) - foldermenu.grab_set() - -def folder_unpost(e): - tk.call('update', 'idletasks') - foldermenu.grab_release() - foldermenu.unpost() - foldermenu.invoke('active') - -def scan_post(e): - x, y = e.x_root, e.y_root - scanmenu.post(x - 10, y - 10) - scanmenu.grab_set() - -def scan_unpost(e): - tk.call('update', 'idletasks') - scanmenu.grab_release() - scanmenu.unpost() - scanmenu.invoke('active') - -scanparser = re.compile('^ *([0-9]+)') - -def open_folder(e=None): - global folder, mhf - sel = folderbox.curselection() - if len(sel) != 1: - if len(sel) > 1: - msg = "Please open one folder at a time" - else: - msg = "Please select a folder to open" - dialog(root, "Can't Open Folder", msg, "", 0, "OK") - return - i = sel[0] - folder = folderbox.get(i) - mhf = mh.openfolder(folder) - rescan() - -def open_message(e=None): - global viewer - sel = scanbox.curselection() - if len(sel) != 1: - if len(sel) > 1: - msg = "Please open one message at a time" - else: - msg = "Please select a message to open" - dialog(root, "Can't Open Message", msg, "", 0, "OK") - return - cursor = scanbox['cursor'] - scanbox['cursor'] = 'watch' - tk.call('update', 'idletasks') - i = sel[0] - line = scanbox.get(i) - if scanparser.match(line) >= 0: - num = string.atoi(scanparser.group(1)) - m = mhf.openmessage(num) - if viewer: viewer.destroy() - from MimeViewer import MimeViewer - viewer = MimeViewer(bot, '+%s/%d' % (folder, num), m) - viewer.pack() - viewer.show() - scanbox['cursor'] = cursor - -def interestingheader(header): - return header != 'received' - -def remove_message(e=None): - itop = scanbox.nearest(0) - sel = scanbox.curselection() - if not sel: - dialog(root, "No Message To Remove", - "Please select a message to remove", "", 0, "OK") - return - todo = [] - for i in sel: - line = scanbox.get(i) - if scanparser.match(line) >= 0: - todo.append(string.atoi(scanparser.group(1))) - mhf.removemessages(todo) - rescan() - fixfocus(min(todo), itop) - -lastrefile = '' -tofolder = None -def refile_message(e=None): - global lastrefile, tofolder - itop = scanbox.nearest(0) - sel = scanbox.curselection() - if not sel: - dialog(root, "No Message To Refile", - "Please select a message to refile", "", 0, "OK") - return - foldersel = folderbox.curselection() - if len(foldersel) != 1: - if not foldersel: - msg = "Please select a folder to refile to" - else: - msg = "Please select exactly one folder to refile to" - dialog(root, "No Folder To Refile", msg, "", 0, "OK") - return - refileto = folderbox.get(foldersel[0]) - todo = [] - for i in sel: - line = scanbox.get(i) - if scanparser.match(line) >= 0: - todo.append(string.atoi(scanparser.group(1))) - if lastrefile != refileto or not tofolder: - lastrefile = refileto - tofolder = None - tofolder = mh.openfolder(lastrefile) - mhf.refilemessages(todo, tofolder) - rescan() - fixfocus(min(todo), itop) - -def fixfocus(near, itop): - n = scanbox.size() - for i in range(n): - line = scanbox.get(repr(i)) - if scanparser.match(line) >= 0: - num = string.atoi(scanparser.group(1)) - if num >= near: - break - else: - i = 'end' - scanbox.select_from(i) - scanbox.yview(itop) - -def setfolders(): - folderbox.delete(0, 'end') - for fn in mh.listallfolders(): - folderbox.insert('end', fn) - -def rescan(): - global viewer - if viewer: - viewer.destroy() - viewer = None - scanbox.delete(0, 'end') - for line in scanfolder(folder, seq): - scanbox.insert('end', line) - -def scanfolder(folder = 'inbox', sequence = 'all'): - return map( - lambda line: line[:-1], - os.popen('scan +%s %s' % (folder, sequence), 'r').readlines()) - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py b/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py deleted file mode 100644 index 57bf13c44..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py +++ /dev/null @@ -1,47 +0,0 @@ -#! /usr/bin/env python - -"""Play with the new Tk 8.0 toplevel menu option.""" - -from Tkinter import * - -class App: - - def __init__(self, master): - self.master = master - - self.menubar = Menu(self.master) - - self.filemenu = Menu(self.menubar) - - self.filemenu.add_command(label="New") - self.filemenu.add_command(label="Open...") - self.filemenu.add_command(label="Close") - self.filemenu.add_separator() - self.filemenu.add_command(label="Quit", command=self.master.quit) - - self.editmenu = Menu(self.menubar) - - self.editmenu.add_command(label="Cut") - self.editmenu.add_command(label="Copy") - self.editmenu.add_command(label="Paste") - - self.helpmenu = Menu(self.menubar, name='help') - - self.helpmenu.add_command(label="About...") - - self.menubar.add_cascade(label="File", menu=self.filemenu) - self.menubar.add_cascade(label="Edit", menu=self.editmenu) - self.menubar.add_cascade(label="Help", menu=self.helpmenu) - - self.top = Toplevel(menu=self.menubar) - - # Rest of app goes here... - -def main(): - root = Tk() - root.withdraw() - app = App(root) - root.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/optionmenu.py b/sys/src/cmd/python/Demo/tkinter/guido/optionmenu.py deleted file mode 100644 index be9d3ac2a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/optionmenu.py +++ /dev/null @@ -1,27 +0,0 @@ -# option menu sample (Fredrik Lundh, September 1997) - -from Tkinter import * - -root = Tk() - -# -# standard usage - -var1 = StringVar() -var1.set("One") # default selection - -menu1 = OptionMenu(root, var1, "One", "Two", "Three") -menu1.pack() - -# -# initialize from a sequence - -CHOICES = "Aah", "Bee", "Cee", "Dee", "Eff" - -var2 = StringVar() -var2.set(CHOICES[0]) - -menu2 = apply(OptionMenu, (root, var2) + tuple(CHOICES)) -menu2.pack() - -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/paint.py b/sys/src/cmd/python/Demo/tkinter/guido/paint.py deleted file mode 100644 index d46e20b9a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/paint.py +++ /dev/null @@ -1,60 +0,0 @@ -""""Paint program by Dave Michell. - -Subject: tkinter "paint" example -From: Dave Mitchell <davem@magnet.com> -To: python-list@cwi.nl -Date: Fri, 23 Jan 1998 12:18:05 -0500 (EST) - - Not too long ago (last week maybe?) someone posted a request -for an example of a paint program using Tkinter. Try as I might -I can't seem to find it in the archive, so i'll just post mine -here and hope that the person who requested it sees this! - - All this does is put up a canvas and draw a smooth black line -whenever you have the mouse button down, but hopefully it will -be enough to start with.. It would be easy enough to add some -options like other shapes or colors... - - yours, - dave mitchell - davem@magnet.com -""" - -from Tkinter import * - -"""paint.py: not exactly a paint program.. just a smooth line drawing demo.""" - -b1 = "up" -xold, yold = None, None - -def main(): - root = Tk() - drawing_area = Canvas(root) - drawing_area.pack() - drawing_area.bind("<Motion>", motion) - drawing_area.bind("<ButtonPress-1>", b1down) - drawing_area.bind("<ButtonRelease-1>", b1up) - root.mainloop() - -def b1down(event): - global b1 - b1 = "down" # you only want to draw when the button is down - # because "Motion" events happen -all the time- - -def b1up(event): - global b1, xold, yold - b1 = "up" - xold = None # reset the line when you let go of the button - yold = None - -def motion(event): - if b1 == "down": - global xold, yold - if xold != None and yold != None: - event.widget.create_line(xold,yold,event.x,event.y,smooth=TRUE) - # here's where you draw it. smooth. neat. - xold = event.x - yold = event.y - -if __name__ == "__main__": - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/rmt.py b/sys/src/cmd/python/Demo/tkinter/guido/rmt.py deleted file mode 100755 index 440650c9c..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/rmt.py +++ /dev/null @@ -1,159 +0,0 @@ -#! /usr/bin/env python - -# A Python program implementing rmt, an application for remotely -# controlling other Tk applications. -# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.5-8, pp. 273-276. - -# Note that because of forward references in the original, we -# sometimes delay bindings until after the corresponding procedure is -# defined. We also introduce names for some unnamed code blocks in -# the original because of restrictions on lambda forms in Python. - -# XXX This should be written in a more Python-like style!!! - -from Tkinter import * -import sys - -# 1. Create basic application structure: menu bar on top of -# text widget, scrollbar on right. - -root = Tk() -tk = root.tk -mBar = Frame(root, relief=RAISED, borderwidth=2) -mBar.pack(fill=X) - -f = Frame(root) -f.pack(expand=1, fill=BOTH) -s = Scrollbar(f, relief=FLAT) -s.pack(side=RIGHT, fill=Y) -t = Text(f, relief=RAISED, borderwidth=2, yscrollcommand=s.set, setgrid=1) -t.pack(side=LEFT, fill=BOTH, expand=1) -t.tag_config('bold', font='-Adobe-Courier-Bold-R-Normal-*-120-*') -s['command'] = t.yview - -root.title('Tk Remote Controller') -root.iconname('Tk Remote') - -# 2. Create menu button and menus. - -file = Menubutton(mBar, text='File', underline=0) -file.pack(side=LEFT) -file_m = Menu(file) -file['menu'] = file_m -file_m_apps = Menu(file_m, tearoff=0) -file_m.add_cascade(label='Select Application', underline=0, - menu=file_m_apps) -file_m.add_command(label='Quit', underline=0, command=sys.exit) - -# 3. Create bindings for text widget to allow commands to be -# entered and information to be selected. New characters -# can only be added at the end of the text (can't ever move -# insertion point). - -def single1(e): - x = e.x - y = e.y - t.setvar('tk_priv(selectMode)', 'char') - t.mark_set('anchor', At(x, y)) - # Should focus W -t.bind('<1>', single1) - -def double1(e): - x = e.x - y = e.y - t.setvar('tk_priv(selectMode)', 'word') - t.tk_textSelectTo(At(x, y)) -t.bind('<Double-1>', double1) - -def triple1(e): - x = e.x - y = e.y - t.setvar('tk_priv(selectMode)', 'line') - t.tk_textSelectTo(At(x, y)) -t.bind('<Triple-1>', triple1) - -def returnkey(e): - t.insert(AtInsert(), '\n') - invoke() -t.bind('<Return>', returnkey) - -def controlv(e): - t.insert(AtInsert(), t.selection_get()) - t.yview_pickplace(AtInsert()) - if t.index(AtInsert())[-2:] == '.0': - invoke() -t.bind('<Control-v>', controlv) - -# 4. Procedure to backspace over one character, as long as -# the character isn't part of the prompt. - -def backspace(e): - if t.index('promptEnd') != t.index('insert - 1 char'): - t.delete('insert - 1 char', AtInsert()) - t.yview_pickplace(AtInsert()) -t.bind('<BackSpace>', backspace) -t.bind('<Control-h>', backspace) -t.bind('<Delete>', backspace) - - -# 5. Procedure that's invoked when return is typed: if -# there's not yet a complete command (e.g. braces are open) -# then do nothing. Otherwise, execute command (locally or -# remotely), output the result or error message, and issue -# a new prompt. - -def invoke(): - cmd = t.get('promptEnd + 1 char', AtInsert()) - if t.getboolean(tk.call('info', 'complete', cmd)): # XXX - if app == root.winfo_name(): - msg = tk.call('eval', cmd) # XXX - else: - msg = t.send(app, cmd) - if msg: - t.insert(AtInsert(), msg + '\n') - prompt() - t.yview_pickplace(AtInsert()) - -def prompt(): - t.insert(AtInsert(), app + ': ') - t.mark_set('promptEnd', 'insert - 1 char') - t.tag_add('bold', 'insert linestart', 'promptEnd') - -# 6. Procedure to select a new application. Also changes -# the prompt on the current command line to reflect the new -# name. - -def newApp(appName): - global app - app = appName - t.delete('promptEnd linestart', 'promptEnd') - t.insert('promptEnd', appName + ':') - t.tag_add('bold', 'promptEnd linestart', 'promptEnd') - -def fillAppsMenu(): - file_m_apps.add('command') - file_m_apps.delete(0, 'last') - names = root.winfo_interps() - names = map(None, names) # convert tuple to list - names.sort() - for name in names: - try: - root.send(name, 'winfo name .') - except TclError: - # Inoperative window -- ignore it - pass - else: - file_m_apps.add_command( - label=name, - command=lambda name=name: newApp(name)) - -file_m_apps['postcommand'] = fillAppsMenu -mBar.tk_menuBar(file) - -# 7. Miscellaneous initialization. - -app = root.winfo_name() -prompt() -t.focus() - -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/solitaire.py b/sys/src/cmd/python/Demo/tkinter/guido/solitaire.py deleted file mode 100755 index 50a8b2643..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/solitaire.py +++ /dev/null @@ -1,637 +0,0 @@ -#! /usr/bin/env python - -"""Solitaire game, much like the one that comes with MS Windows. - -Limitations: - -- No cute graphical images for the playing cards faces or backs. -- No scoring or timer. -- No undo. -- No option to turn 3 cards at a time. -- No keyboard shortcuts. -- Less fancy animation when you win. -- The determination of which stack you drag to is more relaxed. - -Apology: - -I'm not much of a card player, so my terminology in these comments may -at times be a little unusual. If you have suggestions, please let me -know! - -""" - -# Imports - -import math -import random - -from Tkinter import * -from Canvas import Rectangle, CanvasText, Group, Window - - -# Fix a bug in Canvas.Group as distributed in Python 1.4. The -# distributed bind() method is broken. Rather than asking you to fix -# the source, we fix it here by deriving a subclass: - -class Group(Group): - def bind(self, sequence=None, command=None): - return self.canvas.tag_bind(self.id, sequence, command) - - -# Constants determining the size and lay-out of cards and stacks. We -# work in a "grid" where each card/stack is surrounded by MARGIN -# pixels of space on each side, so adjacent stacks are separated by -# 2*MARGIN pixels. OFFSET is the offset used for displaying the -# face down cards in the row stacks. - -CARDWIDTH = 100 -CARDHEIGHT = 150 -MARGIN = 10 -XSPACING = CARDWIDTH + 2*MARGIN -YSPACING = CARDHEIGHT + 4*MARGIN -OFFSET = 5 - -# The background color, green to look like a playing table. The -# standard green is way too bright, and dark green is way to dark, so -# we use something in between. (There are a few more colors that -# could be customized, but they are less controversial.) - -BACKGROUND = '#070' - - -# Suits and colors. The values of the symbolic suit names are the -# strings used to display them (you change these and VALNAMES to -# internationalize the game). The COLOR dictionary maps suit names to -# colors (red and black) which must be Tk color names. The keys() of -# the COLOR dictionary conveniently provides us with a list of all -# suits (in arbitrary order). - -HEARTS = 'Heart' -DIAMONDS = 'Diamond' -CLUBS = 'Club' -SPADES = 'Spade' - -RED = 'red' -BLACK = 'black' - -COLOR = {} -for s in (HEARTS, DIAMONDS): - COLOR[s] = RED -for s in (CLUBS, SPADES): - COLOR[s] = BLACK - -ALLSUITS = COLOR.keys() -NSUITS = len(ALLSUITS) - - -# Card values are 1-13. We also define symbolic names for the picture -# cards. ALLVALUES is a list of all card values. - -ACE = 1 -JACK = 11 -QUEEN = 12 -KING = 13 -ALLVALUES = range(1, 14) # (one more than the highest value) -NVALUES = len(ALLVALUES) - - -# VALNAMES is a list that maps a card value to string. It contains a -# dummy element at index 0 so it can be indexed directly with the card -# value. - -VALNAMES = ["", "A"] + map(str, range(2, 11)) + ["J", "Q", "K"] - - -# Solitaire constants. The only one I can think of is the number of -# row stacks. - -NROWS = 7 - - -# The rest of the program consists of class definitions. These are -# further described in their documentation strings. - - -class Card: - - """A playing card. - - A card doesn't record to which stack it belongs; only the stack - records this (it turns out that we always know this from the - context, and this saves a ``double update'' with potential for - inconsistencies). - - Public methods: - - moveto(x, y) -- move the card to an absolute position - moveby(dx, dy) -- move the card by a relative offset - tkraise() -- raise the card to the top of its stack - showface(), showback() -- turn the card face up or down & raise it - - Public read-only instance variables: - - suit, value, color -- the card's suit, value and color - face_shown -- true when the card is shown face up, else false - - Semi-public read-only instance variables (XXX should be made - private): - - group -- the Canvas.Group representing the card - x, y -- the position of the card's top left corner - - Private instance variables: - - __back, __rect, __text -- the canvas items making up the card - - (To show the card face up, the text item is placed in front of - rect and the back is placed behind it. To show it face down, this - is reversed. The card is created face down.) - - """ - - def __init__(self, suit, value, canvas): - """Card constructor. - - Arguments are the card's suit and value, and the canvas widget. - - The card is created at position (0, 0), with its face down - (adding it to a stack will position it according to that - stack's rules). - - """ - self.suit = suit - self.value = value - self.color = COLOR[suit] - self.face_shown = 0 - - self.x = self.y = 0 - self.group = Group(canvas) - - text = "%s %s" % (VALNAMES[value], suit) - self.__text = CanvasText(canvas, CARDWIDTH/2, 0, - anchor=N, fill=self.color, text=text) - self.group.addtag_withtag(self.__text) - - self.__rect = Rectangle(canvas, 0, 0, CARDWIDTH, CARDHEIGHT, - outline='black', fill='white') - self.group.addtag_withtag(self.__rect) - - self.__back = Rectangle(canvas, MARGIN, MARGIN, - CARDWIDTH-MARGIN, CARDHEIGHT-MARGIN, - outline='black', fill='blue') - self.group.addtag_withtag(self.__back) - - def __repr__(self): - """Return a string for debug print statements.""" - return "Card(%r, %r)" % (self.suit, self.value) - - def moveto(self, x, y): - """Move the card to absolute position (x, y).""" - self.moveby(x - self.x, y - self.y) - - def moveby(self, dx, dy): - """Move the card by (dx, dy).""" - self.x = self.x + dx - self.y = self.y + dy - self.group.move(dx, dy) - - def tkraise(self): - """Raise the card above all other objects in its canvas.""" - self.group.tkraise() - - def showface(self): - """Turn the card's face up.""" - self.tkraise() - self.__rect.tkraise() - self.__text.tkraise() - self.face_shown = 1 - - def showback(self): - """Turn the card's face down.""" - self.tkraise() - self.__rect.tkraise() - self.__back.tkraise() - self.face_shown = 0 - - -class Stack: - - """A generic stack of cards. - - This is used as a base class for all other stacks (e.g. the deck, - the suit stacks, and the row stacks). - - Public methods: - - add(card) -- add a card to the stack - delete(card) -- delete a card from the stack - showtop() -- show the top card (if any) face up - deal() -- delete and return the top card, or None if empty - - Method that subclasses may override: - - position(card) -- move the card to its proper (x, y) position - - The default position() method places all cards at the stack's - own (x, y) position. - - userclickhandler(), userdoubleclickhandler() -- called to do - subclass specific things on single and double clicks - - The default user (single) click handler shows the top card - face up. The default user double click handler calls the user - single click handler. - - usermovehandler(cards) -- called to complete a subpile move - - The default user move handler moves all moved cards back to - their original position (by calling the position() method). - - Private methods: - - clickhandler(event), doubleclickhandler(event), - motionhandler(event), releasehandler(event) -- event handlers - - The default event handlers turn the top card of the stack with - its face up on a (single or double) click, and also support - moving a subpile around. - - startmoving(event) -- begin a move operation - finishmoving() -- finish a move operation - - """ - - def __init__(self, x, y, game=None): - """Stack constructor. - - Arguments are the stack's nominal x and y position (the top - left corner of the first card placed in the stack), and the - game object (which is used to get the canvas; subclasses use - the game object to find other stacks). - - """ - self.x = x - self.y = y - self.game = game - self.cards = [] - self.group = Group(self.game.canvas) - self.group.bind('<1>', self.clickhandler) - self.group.bind('<Double-1>', self.doubleclickhandler) - self.group.bind('<B1-Motion>', self.motionhandler) - self.group.bind('<ButtonRelease-1>', self.releasehandler) - self.makebottom() - - def makebottom(self): - pass - - def __repr__(self): - """Return a string for debug print statements.""" - return "%s(%d, %d)" % (self.__class__.__name__, self.x, self.y) - - # Public methods - - def add(self, card): - self.cards.append(card) - card.tkraise() - self.position(card) - self.group.addtag_withtag(card.group) - - def delete(self, card): - self.cards.remove(card) - card.group.dtag(self.group) - - def showtop(self): - if self.cards: - self.cards[-1].showface() - - def deal(self): - if not self.cards: - return None - card = self.cards[-1] - self.delete(card) - return card - - # Subclass overridable methods - - def position(self, card): - card.moveto(self.x, self.y) - - def userclickhandler(self): - self.showtop() - - def userdoubleclickhandler(self): - self.userclickhandler() - - def usermovehandler(self, cards): - for card in cards: - self.position(card) - - # Event handlers - - def clickhandler(self, event): - self.finishmoving() # In case we lost an event - self.userclickhandler() - self.startmoving(event) - - def motionhandler(self, event): - self.keepmoving(event) - - def releasehandler(self, event): - self.keepmoving(event) - self.finishmoving() - - def doubleclickhandler(self, event): - self.finishmoving() # In case we lost an event - self.userdoubleclickhandler() - self.startmoving(event) - - # Move internals - - moving = None - - def startmoving(self, event): - self.moving = None - tags = self.game.canvas.gettags('current') - for i in range(len(self.cards)): - card = self.cards[i] - if card.group.tag in tags: - break - else: - return - if not card.face_shown: - return - self.moving = self.cards[i:] - self.lastx = event.x - self.lasty = event.y - for card in self.moving: - card.tkraise() - - def keepmoving(self, event): - if not self.moving: - return - dx = event.x - self.lastx - dy = event.y - self.lasty - self.lastx = event.x - self.lasty = event.y - if dx or dy: - for card in self.moving: - card.moveby(dx, dy) - - def finishmoving(self): - cards = self.moving - self.moving = None - if cards: - self.usermovehandler(cards) - - -class Deck(Stack): - - """The deck is a stack with support for shuffling. - - New methods: - - fill() -- create the playing cards - shuffle() -- shuffle the playing cards - - A single click moves the top card to the game's open deck and - moves it face up; if we're out of cards, it moves the open deck - back to the deck. - - """ - - def makebottom(self): - bottom = Rectangle(self.game.canvas, - self.x, self.y, - self.x+CARDWIDTH, self.y+CARDHEIGHT, - outline='black', fill=BACKGROUND) - self.group.addtag_withtag(bottom) - - def fill(self): - for suit in ALLSUITS: - for value in ALLVALUES: - self.add(Card(suit, value, self.game.canvas)) - - def shuffle(self): - n = len(self.cards) - newcards = [] - for i in randperm(n): - newcards.append(self.cards[i]) - self.cards = newcards - - def userclickhandler(self): - opendeck = self.game.opendeck - card = self.deal() - if not card: - while 1: - card = opendeck.deal() - if not card: - break - self.add(card) - card.showback() - else: - self.game.opendeck.add(card) - card.showface() - - -def randperm(n): - """Function returning a random permutation of range(n).""" - r = range(n) - x = [] - while r: - i = random.choice(r) - x.append(i) - r.remove(i) - return x - - -class OpenStack(Stack): - - def acceptable(self, cards): - return 0 - - def usermovehandler(self, cards): - card = cards[0] - stack = self.game.closeststack(card) - if not stack or stack is self or not stack.acceptable(cards): - Stack.usermovehandler(self, cards) - else: - for card in cards: - self.delete(card) - stack.add(card) - self.game.wincheck() - - def userdoubleclickhandler(self): - if not self.cards: - return - card = self.cards[-1] - if not card.face_shown: - self.userclickhandler() - return - for s in self.game.suits: - if s.acceptable([card]): - self.delete(card) - s.add(card) - self.game.wincheck() - break - - -class SuitStack(OpenStack): - - def makebottom(self): - bottom = Rectangle(self.game.canvas, - self.x, self.y, - self.x+CARDWIDTH, self.y+CARDHEIGHT, - outline='black', fill='') - - def userclickhandler(self): - pass - - def userdoubleclickhandler(self): - pass - - def acceptable(self, cards): - if len(cards) != 1: - return 0 - card = cards[0] - if not self.cards: - return card.value == ACE - topcard = self.cards[-1] - return card.suit == topcard.suit and card.value == topcard.value + 1 - - -class RowStack(OpenStack): - - def acceptable(self, cards): - card = cards[0] - if not self.cards: - return card.value == KING - topcard = self.cards[-1] - if not topcard.face_shown: - return 0 - return card.color != topcard.color and card.value == topcard.value - 1 - - def position(self, card): - y = self.y - for c in self.cards: - if c == card: - break - if c.face_shown: - y = y + 2*MARGIN - else: - y = y + OFFSET - card.moveto(self.x, y) - - -class Solitaire: - - def __init__(self, master): - self.master = master - - self.canvas = Canvas(self.master, - background=BACKGROUND, - highlightthickness=0, - width=NROWS*XSPACING, - height=3*YSPACING + 20 + MARGIN) - self.canvas.pack(fill=BOTH, expand=TRUE) - - self.dealbutton = Button(self.canvas, - text="Deal", - highlightthickness=0, - background=BACKGROUND, - activebackground="green", - command=self.deal) - Window(self.canvas, MARGIN, 3*YSPACING + 20, - window=self.dealbutton, anchor=SW) - - x = MARGIN - y = MARGIN - - self.deck = Deck(x, y, self) - - x = x + XSPACING - self.opendeck = OpenStack(x, y, self) - - x = x + XSPACING - self.suits = [] - for i in range(NSUITS): - x = x + XSPACING - self.suits.append(SuitStack(x, y, self)) - - x = MARGIN - y = y + YSPACING - - self.rows = [] - for i in range(NROWS): - self.rows.append(RowStack(x, y, self)) - x = x + XSPACING - - self.openstacks = [self.opendeck] + self.suits + self.rows - - self.deck.fill() - self.deal() - - def wincheck(self): - for s in self.suits: - if len(s.cards) != NVALUES: - return - self.win() - self.deal() - - def win(self): - """Stupid animation when you win.""" - cards = [] - for s in self.openstacks: - cards = cards + s.cards - while cards: - card = random.choice(cards) - cards.remove(card) - self.animatedmoveto(card, self.deck) - - def animatedmoveto(self, card, dest): - for i in range(10, 0, -1): - dx, dy = (dest.x-card.x)/i, (dest.y-card.y)/i - card.moveby(dx, dy) - self.master.update_idletasks() - - def closeststack(self, card): - closest = None - cdist = 999999999 - # Since we only compare distances, - # we don't bother to take the square root. - for stack in self.openstacks: - dist = (stack.x - card.x)**2 + (stack.y - card.y)**2 - if dist < cdist: - closest = stack - cdist = dist - return closest - - def deal(self): - self.reset() - self.deck.shuffle() - for i in range(NROWS): - for r in self.rows[i:]: - card = self.deck.deal() - r.add(card) - for r in self.rows: - r.showtop() - - def reset(self): - for stack in self.openstacks: - while 1: - card = stack.deal() - if not card: - break - self.deck.add(card) - card.showback() - - -# Main function, run when invoked as a stand-alone Python program. - -def main(): - root = Tk() - game = Solitaire(root) - root.protocol('WM_DELETE_WINDOW', root.quit) - root.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/sortvisu.py b/sys/src/cmd/python/Demo/tkinter/guido/sortvisu.py deleted file mode 100644 index f18f2c116..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/sortvisu.py +++ /dev/null @@ -1,634 +0,0 @@ -#! /usr/bin/env python - -"""Sorting algorithms visualizer using Tkinter. - -This module is comprised of three ``components'': - -- an array visualizer with methods that implement basic sorting -operations (compare, swap) as well as methods for ``annotating'' the -sorting algorithm (e.g. to show the pivot element); - -- a number of sorting algorithms (currently quicksort, insertion sort, -selection sort and bubble sort, as well as a randomization function), -all using the array visualizer for its basic operations and with calls -to its annotation methods; - -- and a ``driver'' class which can be used as a Grail applet or as a -stand-alone application. - -""" - - -from Tkinter import * -from Canvas import Line, Rectangle -import random - - -XGRID = 10 -YGRID = 10 -WIDTH = 6 - - -class Array: - - def __init__(self, master, data=None): - self.master = master - self.frame = Frame(self.master) - self.frame.pack(fill=X) - self.label = Label(self.frame) - self.label.pack() - self.canvas = Canvas(self.frame) - self.canvas.pack() - self.report = Label(self.frame) - self.report.pack() - self.left = Line(self.canvas, 0, 0, 0, 0) - self.right = Line(self.canvas, 0, 0, 0, 0) - self.pivot = Line(self.canvas, 0, 0, 0, 0) - self.items = [] - self.size = self.maxvalue = 0 - if data: - self.setdata(data) - - def setdata(self, data): - olditems = self.items - self.items = [] - for item in olditems: - item.delete() - self.size = len(data) - self.maxvalue = max(data) - self.canvas.config(width=(self.size+1)*XGRID, - height=(self.maxvalue+1)*YGRID) - for i in range(self.size): - self.items.append(ArrayItem(self, i, data[i])) - self.reset("Sort demo, size %d" % self.size) - - speed = "normal" - - def setspeed(self, speed): - self.speed = speed - - def destroy(self): - self.frame.destroy() - - in_mainloop = 0 - stop_mainloop = 0 - - def cancel(self): - self.stop_mainloop = 1 - if self.in_mainloop: - self.master.quit() - - def step(self): - if self.in_mainloop: - self.master.quit() - - Cancelled = "Array.Cancelled" # Exception - - def wait(self, msecs): - if self.speed == "fastest": - msecs = 0 - elif self.speed == "fast": - msecs = msecs/10 - elif self.speed == "single-step": - msecs = 1000000000 - if not self.stop_mainloop: - self.master.update() - id = self.master.after(msecs, self.master.quit) - self.in_mainloop = 1 - self.master.mainloop() - self.master.after_cancel(id) - self.in_mainloop = 0 - if self.stop_mainloop: - self.stop_mainloop = 0 - self.message("Cancelled") - raise Array.Cancelled - - def getsize(self): - return self.size - - def show_partition(self, first, last): - for i in range(self.size): - item = self.items[i] - if first <= i < last: - item.item.config(fill='red') - else: - item.item.config(fill='orange') - self.hide_left_right_pivot() - - def hide_partition(self): - for i in range(self.size): - item = self.items[i] - item.item.config(fill='red') - self.hide_left_right_pivot() - - def show_left(self, left): - if not 0 <= left < self.size: - self.hide_left() - return - x1, y1, x2, y2 = self.items[left].position() -## top, bot = HIRO - self.left.coords([(x1-2, 0), (x1-2, 9999)]) - self.master.update() - - def show_right(self, right): - if not 0 <= right < self.size: - self.hide_right() - return - x1, y1, x2, y2 = self.items[right].position() - self.right.coords(((x2+2, 0), (x2+2, 9999))) - self.master.update() - - def hide_left_right_pivot(self): - self.hide_left() - self.hide_right() - self.hide_pivot() - - def hide_left(self): - self.left.coords(((0, 0), (0, 0))) - - def hide_right(self): - self.right.coords(((0, 0), (0, 0))) - - def show_pivot(self, pivot): - x1, y1, x2, y2 = self.items[pivot].position() - self.pivot.coords(((0, y1-2), (9999, y1-2))) - - def hide_pivot(self): - self.pivot.coords(((0, 0), (0, 0))) - - def swap(self, i, j): - if i == j: return - self.countswap() - item = self.items[i] - other = self.items[j] - self.items[i], self.items[j] = other, item - item.swapwith(other) - - def compare(self, i, j): - self.countcompare() - item = self.items[i] - other = self.items[j] - return item.compareto(other) - - def reset(self, msg): - self.ncompares = 0 - self.nswaps = 0 - self.message(msg) - self.updatereport() - self.hide_partition() - - def message(self, msg): - self.label.config(text=msg) - - def countswap(self): - self.nswaps = self.nswaps + 1 - self.updatereport() - - def countcompare(self): - self.ncompares = self.ncompares + 1 - self.updatereport() - - def updatereport(self): - text = "%d cmps, %d swaps" % (self.ncompares, self.nswaps) - self.report.config(text=text) - - -class ArrayItem: - - def __init__(self, array, index, value): - self.array = array - self.index = index - self.value = value - x1, y1, x2, y2 = self.position() - self.item = Rectangle(array.canvas, x1, y1, x2, y2, - fill='red', outline='black', width=1) - self.item.bind('<Button-1>', self.mouse_down) - self.item.bind('<Button1-Motion>', self.mouse_move) - self.item.bind('<ButtonRelease-1>', self.mouse_up) - - def delete(self): - item = self.item - self.array = None - self.item = None - item.delete() - - def mouse_down(self, event): - self.lastx = event.x - self.lasty = event.y - self.origx = event.x - self.origy = event.y - self.item.tkraise() - - def mouse_move(self, event): - self.item.move(event.x - self.lastx, event.y - self.lasty) - self.lastx = event.x - self.lasty = event.y - - def mouse_up(self, event): - i = self.nearestindex(event.x) - if i >= self.array.getsize(): - i = self.array.getsize() - 1 - if i < 0: - i = 0 - other = self.array.items[i] - here = self.index - self.array.items[here], self.array.items[i] = other, self - self.index = i - x1, y1, x2, y2 = self.position() - self.item.coords(((x1, y1), (x2, y2))) - other.setindex(here) - - def setindex(self, index): - nsteps = steps(self.index, index) - if not nsteps: return - if self.array.speed == "fastest": - nsteps = 0 - oldpts = self.position() - self.index = index - newpts = self.position() - trajectory = interpolate(oldpts, newpts, nsteps) - self.item.tkraise() - for pts in trajectory: - self.item.coords((pts[:2], pts[2:])) - self.array.wait(50) - - def swapwith(self, other): - nsteps = steps(self.index, other.index) - if not nsteps: return - if self.array.speed == "fastest": - nsteps = 0 - myoldpts = self.position() - otheroldpts = other.position() - self.index, other.index = other.index, self.index - mynewpts = self.position() - othernewpts = other.position() - myfill = self.item['fill'] - otherfill = other.item['fill'] - self.item.config(fill='green') - other.item.config(fill='yellow') - self.array.master.update() - if self.array.speed == "single-step": - self.item.coords((mynewpts[:2], mynewpts[2:])) - other.item.coords((othernewpts[:2], othernewpts[2:])) - self.array.master.update() - self.item.config(fill=myfill) - other.item.config(fill=otherfill) - self.array.wait(0) - return - mytrajectory = interpolate(myoldpts, mynewpts, nsteps) - othertrajectory = interpolate(otheroldpts, othernewpts, nsteps) - if self.value > other.value: - self.item.tkraise() - other.item.tkraise() - else: - other.item.tkraise() - self.item.tkraise() - try: - for i in range(len(mytrajectory)): - mypts = mytrajectory[i] - otherpts = othertrajectory[i] - self.item.coords((mypts[:2], mypts[2:])) - other.item.coords((otherpts[:2], otherpts[2:])) - self.array.wait(50) - finally: - mypts = mytrajectory[-1] - otherpts = othertrajectory[-1] - self.item.coords((mypts[:2], mypts[2:])) - other.item.coords((otherpts[:2], otherpts[2:])) - self.item.config(fill=myfill) - other.item.config(fill=otherfill) - - def compareto(self, other): - myfill = self.item['fill'] - otherfill = other.item['fill'] - outcome = cmp(self.value, other.value) - if outcome < 0: - myflash = 'white' - otherflash = 'black' - elif outcome > 0: - myflash = 'black' - otherflash = 'white' - else: - myflash = otherflash = 'grey' - try: - self.item.config(fill=myflash) - other.item.config(fill=otherflash) - self.array.wait(500) - finally: - self.item.config(fill=myfill) - other.item.config(fill=otherfill) - return outcome - - def position(self): - x1 = (self.index+1)*XGRID - WIDTH/2 - x2 = x1+WIDTH - y2 = (self.array.maxvalue+1)*YGRID - y1 = y2 - (self.value)*YGRID - return x1, y1, x2, y2 - - def nearestindex(self, x): - return int(round(float(x)/XGRID)) - 1 - - -# Subroutines that don't need an object - -def steps(here, there): - nsteps = abs(here - there) - if nsteps <= 3: - nsteps = nsteps * 3 - elif nsteps <= 5: - nsteps = nsteps * 2 - elif nsteps > 10: - nsteps = 10 - return nsteps - -def interpolate(oldpts, newpts, n): - if len(oldpts) != len(newpts): - raise ValueError, "can't interpolate arrays of different length" - pts = [0]*len(oldpts) - res = [tuple(oldpts)] - for i in range(1, n): - for k in range(len(pts)): - pts[k] = oldpts[k] + (newpts[k] - oldpts[k])*i/n - res.append(tuple(pts)) - res.append(tuple(newpts)) - return res - - -# Various (un)sorting algorithms - -def uniform(array): - size = array.getsize() - array.setdata([(size+1)/2] * size) - array.reset("Uniform data, size %d" % size) - -def distinct(array): - size = array.getsize() - array.setdata(range(1, size+1)) - array.reset("Distinct data, size %d" % size) - -def randomize(array): - array.reset("Randomizing") - n = array.getsize() - for i in range(n): - j = random.randint(0, n-1) - array.swap(i, j) - array.message("Randomized") - -def insertionsort(array): - size = array.getsize() - array.reset("Insertion sort") - for i in range(1, size): - j = i-1 - while j >= 0: - if array.compare(j, j+1) <= 0: - break - array.swap(j, j+1) - j = j-1 - array.message("Sorted") - -def selectionsort(array): - size = array.getsize() - array.reset("Selection sort") - try: - for i in range(size): - array.show_partition(i, size) - for j in range(i+1, size): - if array.compare(i, j) > 0: - array.swap(i, j) - array.message("Sorted") - finally: - array.hide_partition() - -def bubblesort(array): - size = array.getsize() - array.reset("Bubble sort") - for i in range(size): - for j in range(1, size): - if array.compare(j-1, j) > 0: - array.swap(j-1, j) - array.message("Sorted") - -def quicksort(array): - size = array.getsize() - array.reset("Quicksort") - try: - stack = [(0, size)] - while stack: - first, last = stack[-1] - del stack[-1] - array.show_partition(first, last) - if last-first < 5: - array.message("Insertion sort") - for i in range(first+1, last): - j = i-1 - while j >= first: - if array.compare(j, j+1) <= 0: - break - array.swap(j, j+1) - j = j-1 - continue - array.message("Choosing pivot") - j, i, k = first, (first+last)/2, last-1 - if array.compare(k, i) < 0: - array.swap(k, i) - if array.compare(k, j) < 0: - array.swap(k, j) - if array.compare(j, i) < 0: - array.swap(j, i) - pivot = j - array.show_pivot(pivot) - array.message("Pivot at left of partition") - array.wait(1000) - left = first - right = last - while 1: - array.message("Sweep right pointer") - right = right-1 - array.show_right(right) - while right > first and array.compare(right, pivot) >= 0: - right = right-1 - array.show_right(right) - array.message("Sweep left pointer") - left = left+1 - array.show_left(left) - while left < last and array.compare(left, pivot) <= 0: - left = left+1 - array.show_left(left) - if left > right: - array.message("End of partition") - break - array.message("Swap items") - array.swap(left, right) - array.message("Swap pivot back") - array.swap(pivot, right) - n1 = right-first - n2 = last-left - if n1 > 1: stack.append((first, right)) - if n2 > 1: stack.append((left, last)) - array.message("Sorted") - finally: - array.hide_partition() - -def demosort(array): - while 1: - for alg in [quicksort, insertionsort, selectionsort, bubblesort]: - randomize(array) - alg(array) - - -# Sort demo class -- usable as a Grail applet - -class SortDemo: - - def __init__(self, master, size=15): - self.master = master - self.size = size - self.busy = 0 - self.array = Array(self.master) - - self.botframe = Frame(master) - self.botframe.pack(side=BOTTOM) - self.botleftframe = Frame(self.botframe) - self.botleftframe.pack(side=LEFT, fill=Y) - self.botrightframe = Frame(self.botframe) - self.botrightframe.pack(side=RIGHT, fill=Y) - - self.b_qsort = Button(self.botleftframe, - text="Quicksort", command=self.c_qsort) - self.b_qsort.pack(fill=X) - self.b_isort = Button(self.botleftframe, - text="Insertion sort", command=self.c_isort) - self.b_isort.pack(fill=X) - self.b_ssort = Button(self.botleftframe, - text="Selection sort", command=self.c_ssort) - self.b_ssort.pack(fill=X) - self.b_bsort = Button(self.botleftframe, - text="Bubble sort", command=self.c_bsort) - self.b_bsort.pack(fill=X) - - # Terrible hack to overcome limitation of OptionMenu... - class MyIntVar(IntVar): - def __init__(self, master, demo): - self.demo = demo - IntVar.__init__(self, master) - def set(self, value): - IntVar.set(self, value) - if str(value) != '0': - self.demo.resize(value) - - self.v_size = MyIntVar(self.master, self) - self.v_size.set(size) - sizes = [1, 2, 3, 4] + range(5, 55, 5) - if self.size not in sizes: - sizes.append(self.size) - sizes.sort() - self.m_size = apply(OptionMenu, - (self.botleftframe, self.v_size) + tuple(sizes)) - self.m_size.pack(fill=X) - - self.v_speed = StringVar(self.master) - self.v_speed.set("normal") - self.m_speed = OptionMenu(self.botleftframe, self.v_speed, - "single-step", "normal", "fast", "fastest") - self.m_speed.pack(fill=X) - - self.b_step = Button(self.botleftframe, - text="Step", command=self.c_step) - self.b_step.pack(fill=X) - - self.b_randomize = Button(self.botrightframe, - text="Randomize", command=self.c_randomize) - self.b_randomize.pack(fill=X) - self.b_uniform = Button(self.botrightframe, - text="Uniform", command=self.c_uniform) - self.b_uniform.pack(fill=X) - self.b_distinct = Button(self.botrightframe, - text="Distinct", command=self.c_distinct) - self.b_distinct.pack(fill=X) - self.b_demo = Button(self.botrightframe, - text="Demo", command=self.c_demo) - self.b_demo.pack(fill=X) - self.b_cancel = Button(self.botrightframe, - text="Cancel", command=self.c_cancel) - self.b_cancel.pack(fill=X) - self.b_cancel.config(state=DISABLED) - self.b_quit = Button(self.botrightframe, - text="Quit", command=self.c_quit) - self.b_quit.pack(fill=X) - - def resize(self, newsize): - if self.busy: - self.master.bell() - return - self.size = newsize - self.array.setdata(range(1, self.size+1)) - - def c_qsort(self): - self.run(quicksort) - - def c_isort(self): - self.run(insertionsort) - - def c_ssort(self): - self.run(selectionsort) - - def c_bsort(self): - self.run(bubblesort) - - def c_demo(self): - self.run(demosort) - - def c_randomize(self): - self.run(randomize) - - def c_uniform(self): - self.run(uniform) - - def c_distinct(self): - self.run(distinct) - - def run(self, func): - if self.busy: - self.master.bell() - return - self.busy = 1 - self.array.setspeed(self.v_speed.get()) - self.b_cancel.config(state=NORMAL) - try: - func(self.array) - except Array.Cancelled: - pass - self.b_cancel.config(state=DISABLED) - self.busy = 0 - - def c_cancel(self): - if not self.busy: - self.master.bell() - return - self.array.cancel() - - def c_step(self): - if not self.busy: - self.master.bell() - return - self.v_speed.set("single-step") - self.array.setspeed("single-step") - self.array.step() - - def c_quit(self): - if self.busy: - self.array.cancel() - self.master.after_idle(self.master.quit) - - -# Main program -- for stand-alone operation outside Grail - -def main(): - root = Tk() - demo = SortDemo(root) - root.protocol('WM_DELETE_WINDOW', demo.c_quit) - root.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/ss1.py b/sys/src/cmd/python/Demo/tkinter/guido/ss1.py deleted file mode 100644 index 89354753e..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/ss1.py +++ /dev/null @@ -1,845 +0,0 @@ -"""SS1 -- a spreadsheet.""" - -import os -import re -import sys -import cgi -import rexec -from xml.parsers import expat - -LEFT, CENTER, RIGHT = "LEFT", "CENTER", "RIGHT" - -def ljust(x, n): - return x.ljust(n) -def center(x, n): - return x.center(n) -def rjust(x, n): - return x.rjust(n) -align2action = {LEFT: ljust, CENTER: center, RIGHT: rjust} - -align2xml = {LEFT: "left", CENTER: "center", RIGHT: "right"} -xml2align = {"left": LEFT, "center": CENTER, "right": RIGHT} - -align2anchor = {LEFT: "w", CENTER: "center", RIGHT: "e"} - -def sum(seq): - total = 0 - for x in seq: - if x is not None: - total += x - return total - -class Sheet: - - def __init__(self): - self.cells = {} # {(x, y): cell, ...} - self.rexec = rexec.RExec() - m = self.rexec.add_module('__main__') - m.cell = self.cellvalue - m.cells = self.multicellvalue - m.sum = sum - - def cellvalue(self, x, y): - cell = self.getcell(x, y) - if hasattr(cell, 'recalc'): - return cell.recalc(self.rexec) - else: - return cell - - def multicellvalue(self, x1, y1, x2, y2): - if x1 > x2: - x1, x2 = x2, x1 - if y1 > y2: - y1, y2 = y2, y1 - seq = [] - for y in range(y1, y2+1): - for x in range(x1, x2+1): - seq.append(self.cellvalue(x, y)) - return seq - - def getcell(self, x, y): - return self.cells.get((x, y)) - - def setcell(self, x, y, cell): - assert x > 0 and y > 0 - assert isinstance(cell, BaseCell) - self.cells[x, y] = cell - - def clearcell(self, x, y): - try: - del self.cells[x, y] - except KeyError: - pass - - def clearcells(self, x1, y1, x2, y2): - for xy in self.selectcells(x1, y1, x2, y2): - del self.cells[xy] - - def clearrows(self, y1, y2): - self.clearcells(0, y1, sys.maxint, y2) - - def clearcolumns(self, x1, x2): - self.clearcells(x1, 0, x2, sys.maxint) - - def selectcells(self, x1, y1, x2, y2): - if x1 > x2: - x1, x2 = x2, x1 - if y1 > y2: - y1, y2 = y2, y1 - return [(x, y) for x, y in self.cells - if x1 <= x <= x2 and y1 <= y <= y2] - - def movecells(self, x1, y1, x2, y2, dx, dy): - if dx == 0 and dy == 0: - return - if x1 > x2: - x1, x2 = x2, x1 - if y1 > y2: - y1, y2 = y2, y1 - assert x1+dx > 0 and y1+dy > 0 - new = {} - for x, y in self.cells: - cell = self.cells[x, y] - if hasattr(cell, 'renumber'): - cell = cell.renumber(x1, y1, x2, y2, dx, dy) - if x1 <= x <= x2 and y1 <= y <= y2: - x += dx - y += dy - new[x, y] = cell - self.cells = new - - def insertrows(self, y, n): - assert n > 0 - self.movecells(0, y, sys.maxint, sys.maxint, 0, n) - - def deleterows(self, y1, y2): - if y1 > y2: - y1, y2 = y2, y1 - self.clearrows(y1, y2) - self.movecells(0, y2+1, sys.maxint, sys.maxint, 0, y1-y2-1) - - def insertcolumns(self, x, n): - assert n > 0 - self.movecells(x, 0, sys.maxint, sys.maxint, n, 0) - - def deletecolumns(self, x1, x2): - if x1 > x2: - x1, x2 = x2, x1 - self.clearcells(x1, x2) - self.movecells(x2+1, 0, sys.maxint, sys.maxint, x1-x2-1, 0) - - def getsize(self): - maxx = maxy = 0 - for x, y in self.cells: - maxx = max(maxx, x) - maxy = max(maxy, y) - return maxx, maxy - - def reset(self): - for cell in self.cells.itervalues(): - if hasattr(cell, 'reset'): - cell.reset() - - def recalc(self): - self.reset() - for cell in self.cells.itervalues(): - if hasattr(cell, 'recalc'): - cell.recalc(self.rexec) - - def display(self): - maxx, maxy = self.getsize() - width, height = maxx+1, maxy+1 - colwidth = [1] * width - full = {} - # Add column heading labels in row 0 - for x in range(1, width): - full[x, 0] = text, alignment = colnum2name(x), RIGHT - colwidth[x] = max(colwidth[x], len(text)) - # Add row labels in column 0 - for y in range(1, height): - full[0, y] = text, alignment = str(y), RIGHT - colwidth[0] = max(colwidth[0], len(text)) - # Add sheet cells in columns with x>0 and y>0 - for (x, y), cell in self.cells.iteritems(): - if x <= 0 or y <= 0: - continue - if hasattr(cell, 'recalc'): - cell.recalc(self.rexec) - if hasattr(cell, 'format'): - text, alignment = cell.format() - assert isinstance(text, str) - assert alignment in (LEFT, CENTER, RIGHT) - else: - text = str(cell) - if isinstance(cell, str): - alignment = LEFT - else: - alignment = RIGHT - full[x, y] = (text, alignment) - colwidth[x] = max(colwidth[x], len(text)) - # Calculate the horizontal separator line (dashes and dots) - sep = "" - for x in range(width): - if sep: - sep += "+" - sep += "-"*colwidth[x] - # Now print The full grid - for y in range(height): - line = "" - for x in range(width): - text, alignment = full.get((x, y)) or ("", LEFT) - text = align2action[alignment](text, colwidth[x]) - if line: - line += '|' - line += text - print line - if y == 0: - print sep - - def xml(self): - out = ['<spreadsheet>'] - for (x, y), cell in self.cells.iteritems(): - if hasattr(cell, 'xml'): - cellxml = cell.xml() - else: - cellxml = '<value>%s</value>' % cgi.escape(cell) - out.append('<cell row="%s" col="%s">\n %s\n</cell>' % - (y, x, cellxml)) - out.append('</spreadsheet>') - return '\n'.join(out) - - def save(self, filename): - text = self.xml() - f = open(filename, "w") - f.write(text) - if text and not text.endswith('\n'): - f.write('\n') - f.close() - - def load(self, filename): - f = open(filename, 'r') - SheetParser(self).parsefile(f) - f.close() - -class SheetParser: - - def __init__(self, sheet): - self.sheet = sheet - - def parsefile(self, f): - parser = expat.ParserCreate() - parser.StartElementHandler = self.startelement - parser.EndElementHandler = self.endelement - parser.CharacterDataHandler = self.data - parser.ParseFile(f) - - def startelement(self, tag, attrs): - method = getattr(self, 'start_'+tag, None) - if method: - for key, value in attrs.iteritems(): - attrs[key] = str(value) # XXX Convert Unicode to 8-bit - method(attrs) - self.texts = [] - - def data(self, text): - text = str(text) # XXX Convert Unicode to 8-bit - self.texts.append(text) - - def endelement(self, tag): - method = getattr(self, 'end_'+tag, None) - if method: - method("".join(self.texts)) - - def start_cell(self, attrs): - self.y = int(attrs.get("row")) - self.x = int(attrs.get("col")) - - def start_value(self, attrs): - self.fmt = attrs.get('format') - self.alignment = xml2align.get(attrs.get('align')) - - start_formula = start_value - - def end_int(self, text): - try: - self.value = int(text) - except: - self.value = None - - def end_long(self, text): - try: - self.value = long(text) - except: - self.value = None - - def end_double(self, text): - try: - self.value = float(text) - except: - self.value = None - - def end_complex(self, text): - try: - self.value = complex(text) - except: - self.value = None - - def end_string(self, text): - try: - self.value = text - except: - self.value = None - - def end_value(self, text): - if isinstance(self.value, BaseCell): - self.cell = self.value - elif isinstance(self.value, str): - self.cell = StringCell(self.value, - self.fmt or "%s", - self.alignment or LEFT) - else: - self.cell = NumericCell(self.value, - self.fmt or "%s", - self.alignment or RIGHT) - - def end_formula(self, text): - self.cell = FormulaCell(text, - self.fmt or "%s", - self.alignment or RIGHT) - - def end_cell(self, text): - self.sheet.setcell(self.x, self.y, self.cell) - -class BaseCell: - __init__ = None # Must provide - """Abstract base class for sheet cells. - - Subclasses may but needn't provide the following APIs: - - cell.reset() -- prepare for recalculation - cell.recalc(rexec) -> value -- recalculate formula - cell.format() -> (value, alignment) -- return formatted value - cell.xml() -> string -- return XML - """ - -class NumericCell(BaseCell): - - def __init__(self, value, fmt="%s", alignment=RIGHT): - assert isinstance(value, (int, long, float, complex)) - assert alignment in (LEFT, CENTER, RIGHT) - self.value = value - self.fmt = fmt - self.alignment = alignment - - def recalc(self, rexec): - return self.value - - def format(self): - try: - text = self.fmt % self.value - except: - text = str(self.value) - return text, self.alignment - - def xml(self): - method = getattr(self, '_xml_' + type(self.value).__name__) - return '<value align="%s" format="%s">%s</value>' % ( - align2xml[self.alignment], - self.fmt, - method()) - - def _xml_int(self): - if -2**31 <= self.value < 2**31: - return '<int>%s</int>' % self.value - else: - return self._xml_long() - - def _xml_long(self): - return '<long>%s</long>' % self.value - - def _xml_float(self): - return '<double>%s</double>' % repr(self.value) - - def _xml_complex(self): - return '<complex>%s</double>' % repr(self.value) - -class StringCell(BaseCell): - - def __init__(self, text, fmt="%s", alignment=LEFT): - assert isinstance(text, (str, unicode)) - assert alignment in (LEFT, CENTER, RIGHT) - self.text = text - self.fmt = fmt - self.alignment = alignment - - def recalc(self, rexec): - return self.text - - def format(self): - return self.text, self.alignment - - def xml(self): - s = '<value align="%s" format="%s"><string>%s</string></value>' - return s % ( - align2xml[self.alignment], - self.fmt, - cgi.escape(self.text)) - -class FormulaCell(BaseCell): - - def __init__(self, formula, fmt="%s", alignment=RIGHT): - assert alignment in (LEFT, CENTER, RIGHT) - self.formula = formula - self.translated = translate(self.formula) - self.fmt = fmt - self.alignment = alignment - self.reset() - - def reset(self): - self.value = None - - def recalc(self, rexec): - if self.value is None: - try: - # A hack to evaluate expressions using true division - rexec.r_exec("from __future__ import division\n" + - "__value__ = eval(%s)" % repr(self.translated)) - self.value = rexec.r_eval("__value__") - except: - exc = sys.exc_info()[0] - if hasattr(exc, "__name__"): - self.value = exc.__name__ - else: - self.value = str(exc) - return self.value - - def format(self): - try: - text = self.fmt % self.value - except: - text = str(self.value) - return text, self.alignment - - def xml(self): - return '<formula align="%s" format="%s">%s</formula>' % ( - align2xml[self.alignment], - self.fmt, - self.formula) - - def renumber(self, x1, y1, x2, y2, dx, dy): - out = [] - for part in re.split('(\w+)', self.formula): - m = re.match('^([A-Z]+)([1-9][0-9]*)$', part) - if m is not None: - sx, sy = m.groups() - x = colname2num(sx) - y = int(sy) - if x1 <= x <= x2 and y1 <= y <= y2: - part = cellname(x+dx, y+dy) - out.append(part) - return FormulaCell("".join(out), self.fmt, self.alignment) - -def translate(formula): - """Translate a formula containing fancy cell names to valid Python code. - - Examples: - B4 -> cell(2, 4) - B4:Z100 -> cells(2, 4, 26, 100) - """ - out = [] - for part in re.split(r"(\w+(?::\w+)?)", formula): - m = re.match(r"^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$", part) - if m is None: - out.append(part) - else: - x1, y1, x2, y2 = m.groups() - x1 = colname2num(x1) - if x2 is None: - s = "cell(%s, %s)" % (x1, y1) - else: - x2 = colname2num(x2) - s = "cells(%s, %s, %s, %s)" % (x1, y1, x2, y2) - out.append(s) - return "".join(out) - -def cellname(x, y): - "Translate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1')." - assert x > 0 # Column 0 has an empty name, so can't use that - return colnum2name(x) + str(y) - -def colname2num(s): - "Translate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27)." - s = s.upper() - n = 0 - for c in s: - assert 'A' <= c <= 'Z' - n = n*26 + ord(c) - ord('A') + 1 - return n - -def colnum2name(n): - "Translate a column number to name (e.g. 1->'A', etc.)." - assert n > 0 - s = "" - while n: - n, m = divmod(n-1, 26) - s = chr(m+ord('A')) + s - return s - -import Tkinter as Tk - -class SheetGUI: - - """Beginnings of a GUI for a spreadsheet. - - TO DO: - - clear multiple cells - - Insert, clear, remove rows or columns - - Show new contents while typing - - Scroll bars - - Grow grid when window is grown - - Proper menus - - Undo, redo - - Cut, copy and paste - - Formatting and alignment - """ - - def __init__(self, filename="sheet1.xml", rows=10, columns=5): - """Constructor. - - Load the sheet from the filename argument. - Set up the Tk widget tree. - """ - # Create and load the sheet - self.filename = filename - self.sheet = Sheet() - if os.path.isfile(filename): - self.sheet.load(filename) - # Calculate the needed grid size - maxx, maxy = self.sheet.getsize() - rows = max(rows, maxy) - columns = max(columns, maxx) - # Create the widgets - self.root = Tk.Tk() - self.root.wm_title("Spreadsheet: %s" % self.filename) - self.beacon = Tk.Label(self.root, text="A1", - font=('helvetica', 16, 'bold')) - self.entry = Tk.Entry(self.root) - self.savebutton = Tk.Button(self.root, text="Save", - command=self.save) - self.cellgrid = Tk.Frame(self.root) - # Configure the widget lay-out - self.cellgrid.pack(side="bottom", expand=1, fill="both") - self.beacon.pack(side="left") - self.savebutton.pack(side="right") - self.entry.pack(side="left", expand=1, fill="x") - # Bind some events - self.entry.bind("<Return>", self.return_event) - self.entry.bind("<Shift-Return>", self.shift_return_event) - self.entry.bind("<Tab>", self.tab_event) - self.entry.bind("<Shift-Tab>", self.shift_tab_event) - self.entry.bind("<Delete>", self.delete_event) - self.entry.bind("<Escape>", self.escape_event) - # Now create the cell grid - self.makegrid(rows, columns) - # Select the top-left cell - self.currentxy = None - self.cornerxy = None - self.setcurrent(1, 1) - # Copy the sheet cells to the GUI cells - self.sync() - - def delete_event(self, event): - if self.cornerxy != self.currentxy and self.cornerxy is not None: - self.sheet.clearcells(*(self.currentxy + self.cornerxy)) - else: - self.sheet.clearcell(*self.currentxy) - self.sync() - self.entry.delete(0, 'end') - return "break" - - def escape_event(self, event): - x, y = self.currentxy - self.load_entry(x, y) - - def load_entry(self, x, y): - cell = self.sheet.getcell(x, y) - if cell is None: - text = "" - elif isinstance(cell, FormulaCell): - text = '=' + cell.formula - else: - text, alignment = cell.format() - self.entry.delete(0, 'end') - self.entry.insert(0, text) - self.entry.selection_range(0, 'end') - - def makegrid(self, rows, columns): - """Helper to create the grid of GUI cells. - - The edge (x==0 or y==0) is filled with labels; the rest is real cells. - """ - self.rows = rows - self.columns = columns - self.gridcells = {} - # Create the top left corner cell (which selects all) - cell = Tk.Label(self.cellgrid, relief='raised') - cell.grid_configure(column=0, row=0, sticky='NSWE') - cell.bind("<ButtonPress-1>", self.selectall) - # Create the top row of labels, and confiure the grid columns - for x in range(1, columns+1): - self.cellgrid.grid_columnconfigure(x, minsize=64) - cell = Tk.Label(self.cellgrid, text=colnum2name(x), relief='raised') - cell.grid_configure(column=x, row=0, sticky='WE') - self.gridcells[x, 0] = cell - cell.__x = x - cell.__y = 0 - cell.bind("<ButtonPress-1>", self.selectcolumn) - cell.bind("<B1-Motion>", self.extendcolumn) - cell.bind("<ButtonRelease-1>", self.extendcolumn) - cell.bind("<Shift-Button-1>", self.extendcolumn) - # Create the leftmost column of labels - for y in range(1, rows+1): - cell = Tk.Label(self.cellgrid, text=str(y), relief='raised') - cell.grid_configure(column=0, row=y, sticky='WE') - self.gridcells[0, y] = cell - cell.__x = 0 - cell.__y = y - cell.bind("<ButtonPress-1>", self.selectrow) - cell.bind("<B1-Motion>", self.extendrow) - cell.bind("<ButtonRelease-1>", self.extendrow) - cell.bind("<Shift-Button-1>", self.extendrow) - # Create the real cells - for x in range(1, columns+1): - for y in range(1, rows+1): - cell = Tk.Label(self.cellgrid, relief='sunken', - bg='white', fg='black') - cell.grid_configure(column=x, row=y, sticky='NSWE') - self.gridcells[x, y] = cell - cell.__x = x - cell.__y = y - # Bind mouse events - cell.bind("<ButtonPress-1>", self.press) - cell.bind("<B1-Motion>", self.motion) - cell.bind("<ButtonRelease-1>", self.release) - cell.bind("<Shift-Button-1>", self.release) - - def selectall(self, event): - self.setcurrent(1, 1) - self.setcorner(sys.maxint, sys.maxint) - - def selectcolumn(self, event): - x, y = self.whichxy(event) - self.setcurrent(x, 1) - self.setcorner(x, sys.maxint) - - def extendcolumn(self, event): - x, y = self.whichxy(event) - if x > 0: - self.setcurrent(self.currentxy[0], 1) - self.setcorner(x, sys.maxint) - - def selectrow(self, event): - x, y = self.whichxy(event) - self.setcurrent(1, y) - self.setcorner(sys.maxint, y) - - def extendrow(self, event): - x, y = self.whichxy(event) - if y > 0: - self.setcurrent(1, self.currentxy[1]) - self.setcorner(sys.maxint, y) - - def press(self, event): - x, y = self.whichxy(event) - if x > 0 and y > 0: - self.setcurrent(x, y) - - def motion(self, event): - x, y = self.whichxy(event) - if x > 0 and y > 0: - self.setcorner(x, y) - - release = motion - - def whichxy(self, event): - w = self.cellgrid.winfo_containing(event.x_root, event.y_root) - if w is not None and isinstance(w, Tk.Label): - try: - return w.__x, w.__y - except AttributeError: - pass - return 0, 0 - - def save(self): - self.sheet.save(self.filename) - - def setcurrent(self, x, y): - "Make (x, y) the current cell." - if self.currentxy is not None: - self.change_cell() - self.clearfocus() - self.beacon['text'] = cellname(x, y) - self.load_entry(x, y) - self.entry.focus_set() - self.currentxy = x, y - self.cornerxy = None - gridcell = self.gridcells.get(self.currentxy) - if gridcell is not None: - gridcell['bg'] = 'yellow' - - def setcorner(self, x, y): - if self.currentxy is None or self.currentxy == (x, y): - self.setcurrent(x, y) - return - self.clearfocus() - self.cornerxy = x, y - x1, y1 = self.currentxy - x2, y2 = self.cornerxy or self.currentxy - if x1 > x2: - x1, x2 = x2, x1 - if y1 > y2: - y1, y2 = y2, y1 - for (x, y), cell in self.gridcells.iteritems(): - if x1 <= x <= x2 and y1 <= y <= y2: - cell['bg'] = 'lightBlue' - gridcell = self.gridcells.get(self.currentxy) - if gridcell is not None: - gridcell['bg'] = 'yellow' - self.setbeacon(x1, y1, x2, y2) - - def setbeacon(self, x1, y1, x2, y2): - if x1 == y1 == 1 and x2 == y2 == sys.maxint: - name = ":" - elif (x1, x2) == (1, sys.maxint): - if y1 == y2: - name = "%d" % y1 - else: - name = "%d:%d" % (y1, y2) - elif (y1, y2) == (1, sys.maxint): - if x1 == x2: - name = "%s" % colnum2name(x1) - else: - name = "%s:%s" % (colnum2name(x1), colnum2name(x2)) - else: - name1 = cellname(*self.currentxy) - name2 = cellname(*self.cornerxy) - name = "%s:%s" % (name1, name2) - self.beacon['text'] = name - - - def clearfocus(self): - if self.currentxy is not None: - x1, y1 = self.currentxy - x2, y2 = self.cornerxy or self.currentxy - if x1 > x2: - x1, x2 = x2, x1 - if y1 > y2: - y1, y2 = y2, y1 - for (x, y), cell in self.gridcells.iteritems(): - if x1 <= x <= x2 and y1 <= y <= y2: - cell['bg'] = 'white' - - def return_event(self, event): - "Callback for the Return key." - self.change_cell() - x, y = self.currentxy - self.setcurrent(x, y+1) - return "break" - - def shift_return_event(self, event): - "Callback for the Return key with Shift modifier." - self.change_cell() - x, y = self.currentxy - self.setcurrent(x, max(1, y-1)) - return "break" - - def tab_event(self, event): - "Callback for the Tab key." - self.change_cell() - x, y = self.currentxy - self.setcurrent(x+1, y) - return "break" - - def shift_tab_event(self, event): - "Callback for the Tab key with Shift modifier." - self.change_cell() - x, y = self.currentxy - self.setcurrent(max(1, x-1), y) - return "break" - - def change_cell(self): - "Set the current cell from the entry widget." - x, y = self.currentxy - text = self.entry.get() - cell = None - if text.startswith('='): - cell = FormulaCell(text[1:]) - else: - for cls in int, long, float, complex: - try: - value = cls(text) - except: - continue - else: - cell = NumericCell(value) - break - if cell is None and text: - cell = StringCell(text) - if cell is None: - self.sheet.clearcell(x, y) - else: - self.sheet.setcell(x, y, cell) - self.sync() - - def sync(self): - "Fill the GUI cells from the sheet cells." - self.sheet.recalc() - for (x, y), gridcell in self.gridcells.iteritems(): - if x == 0 or y == 0: - continue - cell = self.sheet.getcell(x, y) - if cell is None: - gridcell['text'] = "" - else: - if hasattr(cell, 'format'): - text, alignment = cell.format() - else: - text, alignment = str(cell), LEFT - gridcell['text'] = text - gridcell['anchor'] = align2anchor[alignment] - - -def test_basic(): - "Basic non-gui self-test." - import os - a = Sheet() - for x in range(1, 11): - for y in range(1, 11): - if x == 1: - cell = NumericCell(y) - elif y == 1: - cell = NumericCell(x) - else: - c1 = cellname(x, 1) - c2 = cellname(1, y) - formula = "%s*%s" % (c1, c2) - cell = FormulaCell(formula) - a.setcell(x, y, cell) -## if os.path.isfile("sheet1.xml"): -## print "Loading from sheet1.xml" -## a.load("sheet1.xml") - a.display() - a.save("sheet1.xml") - -def test_gui(): - "GUI test." - if sys.argv[1:]: - filename = sys.argv[1] - else: - filename = "sheet1.xml" - g = SheetGUI(filename) - g.root.mainloop() - -if __name__ == '__main__': - #test_basic() - test_gui() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/svkill.py b/sys/src/cmd/python/Demo/tkinter/guido/svkill.py deleted file mode 100755 index 69f7f3b16..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/svkill.py +++ /dev/null @@ -1,128 +0,0 @@ -#! /usr/bin/env python - -# Tkinter interface to SYSV `ps' and `kill' commands. - -from Tkinter import * - -if TkVersion < 4.0: - raise ImportError, "This version of svkill requires Tk 4.0 or later" - -from string import splitfields -from string import split -import commands -import os - -user = os.environ['LOGNAME'] - -class BarButton(Menubutton): - def __init__(self, master=None, **cnf): - apply(Menubutton.__init__, (self, master), cnf) - self.pack(side=LEFT) - self.menu = Menu(self, name='menu') - self['menu'] = self.menu - -class Kill(Frame): - # List of (name, option, pid_column) - view_list = [ - ('Default', ''), - ('Every (-e)', '-e'), - ('Non process group leaders (-d)', '-d'), - ('Non leaders with tty (-a)', '-a'), - ('For this user (-u %s)' % user, '-u %s' % user), - ] - format_list = [ - ('Default', '', 0), - ('Long (-l)', '-l', 3), - ('Full (-f)', '-f', 1), - ('Full Long (-f -l)', '-l -f', 3), - ('Session and group ID (-j)', '-j', 0), - ('Scheduler properties (-c)', '-c', 0), - ] - def kill(self, selected): - c = self.format_list[self.format.get()][2] - pid = split(selected)[c] - os.system('kill -9 ' + pid) - self.do_update() - def do_update(self): - format = self.format_list[self.format.get()][1] - view = self.view_list[self.view.get()][1] - s = commands.getoutput('ps %s %s' % (view, format)) - list = splitfields(s, '\n') - self.header.set(list[0] + ' ') - del list[0] - self.frame.list.delete(0, AtEnd()) - for line in list: - self.frame.list.insert(0, line) - def do_motion(self, e): - e.widget.select_clear('0', 'end') - e.widget.select_set(e.widget.nearest(e.y)) - def do_leave(self, e): - e.widget.select_clear('0', 'end') - def do_1(self, e): - self.kill(e.widget.get(e.widget.nearest(e.y))) - def __init__(self, master=None, **cnf): - apply(Frame.__init__, (self, master), cnf) - self.pack(expand=1, fill=BOTH) - self.bar = Frame(self, name='bar', relief=RAISED, - borderwidth=2) - self.bar.pack(fill=X) - self.bar.file = BarButton(self.bar, text='File') - self.bar.file.menu.add_command( - label='Quit', command=self.quit) - self.bar.view = BarButton(self.bar, text='View') - self.bar.format = BarButton(self.bar, text='Format') - self.view = IntVar(self) - self.view.set(0) - self.format = IntVar(self) - self.format.set(0) - for num in range(len(self.view_list)): - label, option = self.view_list[num] - self.bar.view.menu.add_radiobutton( - label=label, - command=self.do_update, - variable=self.view, - value=num) - for num in range(len(self.format_list)): - label, option, col = self.format_list[num] - self.bar.format.menu.add_radiobutton( - label=label, - command=self.do_update, - variable=self.format, - value=num) - self.bar.tk_menuBar(self.bar.file, - self.bar.view, - self.bar.format) - self.frame = Frame(self, relief=RAISED, borderwidth=2) - self.frame.pack(expand=1, fill=BOTH) - self.header = StringVar(self) - self.frame.label = Label( - self.frame, relief=FLAT, anchor=NW, borderwidth=0, - font='*-Courier-Bold-R-Normal-*-120-*', - textvariable=self.header) - self.frame.label.pack(fill=Y, anchor=W) - self.frame.vscroll = Scrollbar(self.frame, orient=VERTICAL) - self.frame.list = Listbox( - self.frame, - relief=SUNKEN, - font='*-Courier-Medium-R-Normal-*-120-*', - width=40, height=10, - selectbackground='#eed5b7', - selectborderwidth=0, - selectmode=BROWSE, - yscroll=self.frame.vscroll.set) - self.frame.vscroll['command'] = self.frame.list.yview - self.frame.vscroll.pack(side=RIGHT, fill=Y) - self.frame.list.pack(expand=1, fill=BOTH) - self.update = Button(self, text='Update', - command=self.do_update) - self.update.pack(fill=X) - self.frame.list.bind('<Motion>', self.do_motion) - self.frame.list.bind('<Leave>', self.do_leave) - self.frame.list.bind('<1>', self.do_1) - self.do_update() - -if __name__ == '__main__': - kill = Kill(None, borderwidth=5) - kill.winfo_toplevel().title('Tkinter Process Killer (SYSV)') - kill.winfo_toplevel().minsize(1, 1) - kill.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/switch.py b/sys/src/cmd/python/Demo/tkinter/guido/switch.py deleted file mode 100644 index 3b58f7ce4..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/switch.py +++ /dev/null @@ -1,55 +0,0 @@ -# Show how to do switchable panels. - -from Tkinter import * - -class App: - - def __init__(self, top=None, master=None): - if top is None: - if master is None: - top = Tk() - else: - top = Toplevel(master) - self.top = top - self.buttonframe = Frame(top) - self.buttonframe.pack() - self.panelframe = Frame(top, borderwidth=2, relief=GROOVE) - self.panelframe.pack(expand=1, fill=BOTH) - self.panels = {} - self.curpanel = None - - def addpanel(self, name, klass): - button = Button(self.buttonframe, text=name, - command=lambda self=self, name=name: self.show(name)) - button.pack(side=LEFT) - frame = Frame(self.panelframe) - instance = klass(frame) - self.panels[name] = (button, frame, instance) - if self.curpanel is None: - self.show(name) - - def show(self, name): - (button, frame, instance) = self.panels[name] - if self.curpanel: - self.curpanel.pack_forget() - self.curpanel = frame - frame.pack(expand=1, fill="both") - -class LabelPanel: - def __init__(self, frame): - self.label = Label(frame, text="Hello world") - self.label.pack() - -class ButtonPanel: - def __init__(self, frame): - self.button = Button(frame, text="Press me") - self.button.pack() - -def main(): - app = App() - app.addpanel("label", LabelPanel) - app.addpanel("button", ButtonPanel) - app.top.mainloop() - -if __name__ == '__main__': - main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/tkman.py b/sys/src/cmd/python/Demo/tkinter/guido/tkman.py deleted file mode 100755 index 6b0b64118..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/tkman.py +++ /dev/null @@ -1,267 +0,0 @@ -#! /usr/bin/env python - -# Tk man page browser -- currently only shows the Tcl/Tk man pages - -import sys -import os -import string -import re -from Tkinter import * -from ManPage import ManPage - -MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann'] -MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/local/man/man3'] - -foundmanndir = 0 -for dir in MANNDIRLIST: - if os.path.exists(dir): - MANNDIR = dir - foundmanndir = 1 - -foundman3dir = 0 -for dir in MAN3DIRLIST: - if os.path.exists(dir): - MAN3DIR = dir - foundman3dir = 1 - -if not foundmanndir or not foundman3dir: - sys.stderr.write('\n') - if not foundmanndir: - msg = """\ -Failed to find mann directory. -Please add the correct entry to the MANNDIRLIST -at the top of %s script.""" % \ -sys.argv[0] - sys.stderr.write("%s\n\n" % msg) - if not foundman3dir: - msg = """\ -Failed to find man3 directory. -Please add the correct entry to the MAN3DIRLIST -at the top of %s script.""" % \ -sys.argv[0] - sys.stderr.write("%s\n\n" % msg) - sys.exit(1) - -del foundmanndir -del foundman3dir - -def listmanpages(mandir): - files = os.listdir(mandir) - names = [] - for file in files: - if file[-2:-1] == '.' and (file[-1] in 'ln123456789'): - names.append(file[:-2]) - names.sort() - return names - -class SelectionBox: - - def __init__(self, master=None): - self.choices = [] - - self.frame = Frame(master, name="frame") - self.frame.pack(expand=1, fill=BOTH) - self.master = self.frame.master - self.subframe = Frame(self.frame, name="subframe") - self.subframe.pack(expand=0, fill=BOTH) - self.leftsubframe = Frame(self.subframe, name='leftsubframe') - self.leftsubframe.pack(side=LEFT, expand=1, fill=BOTH) - self.rightsubframe = Frame(self.subframe, name='rightsubframe') - self.rightsubframe.pack(side=RIGHT, expand=1, fill=BOTH) - self.chaptervar = StringVar(master) - self.chapter = Menubutton(self.rightsubframe, name='chapter', - text='Directory', relief=RAISED, - borderwidth=2) - self.chapter.pack(side=TOP) - self.chaptermenu = Menu(self.chapter, name='chaptermenu') - self.chaptermenu.add_radiobutton(label='C functions', - value=MAN3DIR, - variable=self.chaptervar, - command=self.newchapter) - self.chaptermenu.add_radiobutton(label='Tcl/Tk functions', - value=MANNDIR, - variable=self.chaptervar, - command=self.newchapter) - self.chapter['menu'] = self.chaptermenu - self.listbox = Listbox(self.rightsubframe, name='listbox', - relief=SUNKEN, borderwidth=2, - width=20, height=5) - self.listbox.pack(expand=1, fill=BOTH) - self.l1 = Button(self.leftsubframe, name='l1', - text='Display manual page named:', - command=self.entry_cb) - self.l1.pack(side=TOP) - self.entry = Entry(self.leftsubframe, name='entry', - relief=SUNKEN, borderwidth=2, - width=20) - self.entry.pack(expand=0, fill=X) - self.l2frame = Frame(self.leftsubframe, name='l2frame') - self.l2frame.pack(expand=0, fill=NONE) - self.l2 = Button(self.l2frame, name='l2', - text='Search regexp:', - command=self.search_cb) - self.l2.pack(side=LEFT) - self.casevar = BooleanVar() - self.casesense = Checkbutton(self.l2frame, name='casesense', - text='Case sensitive', - variable=self.casevar, - relief=FLAT) - self.casesense.pack(side=LEFT) - self.search = Entry(self.leftsubframe, name='search', - relief=SUNKEN, borderwidth=2, - width=20) - self.search.pack(expand=0, fill=X) - self.title = Label(self.leftsubframe, name='title', - text='(none)') - self.title.pack(side=BOTTOM) - self.text = ManPage(self.frame, name='text', - relief=SUNKEN, borderwidth=2, - wrap=NONE, width=72, - selectbackground='pink') - self.text.pack(expand=1, fill=BOTH) - - self.entry.bind('<Return>', self.entry_cb) - self.search.bind('<Return>', self.search_cb) - self.listbox.bind('<Double-1>', self.listbox_cb) - - self.entry.bind('<Tab>', self.entry_tab) - self.search.bind('<Tab>', self.search_tab) - self.text.bind('<Tab>', self.text_tab) - - self.entry.focus_set() - - self.chaptervar.set(MANNDIR) - self.newchapter() - - def newchapter(self): - mandir = self.chaptervar.get() - self.choices = [] - self.addlist(listmanpages(mandir)) - - def addchoice(self, choice): - if choice not in self.choices: - self.choices.append(choice) - self.choices.sort() - self.update() - - def addlist(self, list): - self.choices[len(self.choices):] = list - self.choices.sort() - self.update() - - def entry_cb(self, *e): - self.update() - - def listbox_cb(self, e): - selection = self.listbox.curselection() - if selection and len(selection) == 1: - name = self.listbox.get(selection[0]) - self.show_page(name) - - def search_cb(self, *e): - self.search_string(self.search.get()) - - def entry_tab(self, e): - self.search.focus_set() - - def search_tab(self, e): - self.entry.focus_set() - - def text_tab(self, e): - self.entry.focus_set() - - def updatelist(self): - key = self.entry.get() - ok = filter(lambda name, key=key, n=len(key): name[:n]==key, - self.choices) - if not ok: - self.frame.bell() - self.listbox.delete(0, AtEnd()) - exactmatch = 0 - for item in ok: - if item == key: exactmatch = 1 - self.listbox.insert(AtEnd(), item) - if exactmatch: - return key - n = self.listbox.size() - if n == 1: - return self.listbox.get(0) - # Else return None, meaning not a unique selection - - def update(self): - name = self.updatelist() - if name: - self.show_page(name) - self.entry.delete(0, AtEnd()) - self.updatelist() - - def show_page(self, name): - file = '%s/%s.?' % (self.chaptervar.get(), name) - fp = os.popen('nroff -man %s | ul -i' % file, 'r') - self.text.kill() - self.title['text'] = name - self.text.parsefile(fp) - - def search_string(self, search): - if not search: - self.frame.bell() - print 'Empty search string' - return - if not self.casevar.get(): - map = re.IGNORECASE - else: - map = None - try: - if map: - prog = re.compile(search, map) - else: - prog = re.compile(search) - except re.error, msg: - self.frame.bell() - print 'Regex error:', msg - return - here = self.text.index(AtInsert()) - lineno = string.atoi(here[:string.find(here, '.')]) - end = self.text.index(AtEnd()) - endlineno = string.atoi(end[:string.find(end, '.')]) - wraplineno = lineno - found = 0 - while 1: - lineno = lineno + 1 - if lineno > endlineno: - if wraplineno <= 0: - break - endlineno = wraplineno - lineno = 0 - wraplineno = 0 - line = self.text.get('%d.0 linestart' % lineno, - '%d.0 lineend' % lineno) - i = prog.search(line) - if i >= 0: - found = 1 - n = max(1, len(prog.group(0))) - try: - self.text.tag_remove('sel', - AtSelFirst(), - AtSelLast()) - except TclError: - pass - self.text.tag_add('sel', - '%d.%d' % (lineno, i), - '%d.%d' % (lineno, i+n)) - self.text.mark_set(AtInsert(), - '%d.%d' % (lineno, i)) - self.text.yview_pickplace(AtInsert()) - break - if not found: - self.frame.bell() - -def main(): - root = Tk() - sb = SelectionBox(root) - if sys.argv[1:]: - sb.show_page(sys.argv[1]) - root.minsize(1, 1) - root.mainloop() - -main() diff --git a/sys/src/cmd/python/Demo/tkinter/guido/wish.py b/sys/src/cmd/python/Demo/tkinter/guido/wish.py deleted file mode 100755 index 0a61ad88d..000000000 --- a/sys/src/cmd/python/Demo/tkinter/guido/wish.py +++ /dev/null @@ -1,27 +0,0 @@ -# This is about all it requires to write a wish shell in Python! - -import _tkinter -import os - -tk = _tkinter.create(os.environ['DISPLAY'], 'wish', 'Tk', 1) -tk.call('update') - -cmd = '' - -while 1: - if cmd: prompt = '' - else: prompt = '% ' - try: - line = raw_input(prompt) - except EOFError: - break - cmd = cmd + (line + '\n') - if tk.getboolean(tk.call('info', 'complete', cmd)): - tk.record(line) - try: - result = tk.call('eval', cmd) - except _tkinter.TclError, msg: - print 'TclError:', msg - else: - if result: print result - cmd = '' diff --git a/sys/src/cmd/python/Demo/tkinter/matt/00-HELLO-WORLD.py b/sys/src/cmd/python/Demo/tkinter/matt/00-HELLO-WORLD.py deleted file mode 100644 index 1c3151b11..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/00-HELLO-WORLD.py +++ /dev/null @@ -1,27 +0,0 @@ -from Tkinter import * - -# note that there is no explicit call to start Tk. -# Tkinter is smart enough to start the system if it's not already going. - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - - self.QUIT.pack(side=LEFT, fill=BOTH) - - # a hello button - self.hi_there = Button(self, text='Hello', - command=self.printit) - self.hi_there.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/README b/sys/src/cmd/python/Demo/tkinter/matt/README deleted file mode 100644 index eb9d30246..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/README +++ /dev/null @@ -1,30 +0,0 @@ -This directory contains some ad-hoc examples of Tkinter widget -creation. The files named - - *-simple.py - -are the ones to start with if you're looking for a bare-bones usage of -a widget. The other files are meant to show common usage patters that -are a tad more involved. - -If you have a suggestion for an example program, please send mail to - - conway@virginia.edu - -and I'll include it. - - -matt - -TODO -------- -The X selection -Dialog Boxes -More canvas examples -Message widgets -Text Editors -Scrollbars -Listboxes - - - diff --git a/sys/src/cmd/python/Demo/tkinter/matt/animation-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/animation-simple.py deleted file mode 100644 index b52e1dc3a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/animation-simple.py +++ /dev/null @@ -1,35 +0,0 @@ -from Tkinter import * - -# This program shows how to use the "after" function to make animation. - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - - self.draw = Canvas(self, width="5i", height="5i") - - # all of these work.. - self.draw.create_rectangle(0, 0, 10, 10, tags="thing", fill="blue") - self.draw.pack(side=LEFT) - - def moveThing(self, *args): - # move 1/10 of an inch every 1/10 sec (1" per second, smoothly) - self.draw.move("thing", "0.01i", "0.01i") - self.after(10, self.moveThing) - - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - self.after(10, self.moveThing) - - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/animation-w-velocity-ctrl.py b/sys/src/cmd/python/Demo/tkinter/matt/animation-w-velocity-ctrl.py deleted file mode 100644 index e676338fe..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/animation-w-velocity-ctrl.py +++ /dev/null @@ -1,44 +0,0 @@ -from Tkinter import * - -# this is the same as simple-demo-1.py, but uses -# subclassing. -# note that there is no explicit call to start Tk. -# Tkinter is smart enough to start the system if it's not already going. - - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.draw = Canvas(self, width="5i", height="5i") - - self.speed = Scale(self, orient=HORIZONTAL, from_=-100, to=100) - - self.speed.pack(side=BOTTOM, fill=X) - - # all of these work.. - self.draw.create_rectangle(0, 0, 10, 10, tags="thing", fill="blue") - self.draw.pack(side=LEFT) - - def moveThing(self, *args): - velocity = self.speed.get() - str = float(velocity) / 1000.0 - str = "%ri" % (str,) - self.draw.move("thing", str, str) - self.after(10, self.moveThing) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - self.after(10, self.moveThing) - - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/bind-w-mult-calls-p-type.py b/sys/src/cmd/python/Demo/tkinter/matt/bind-w-mult-calls-p-type.py deleted file mode 100644 index f3220da50..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/bind-w-mult-calls-p-type.py +++ /dev/null @@ -1,44 +0,0 @@ -from Tkinter import * -import string - -# This program shows how to use a simple type-in box - -class App(Frame): - def __init__(self, master=None): - Frame.__init__(self, master) - self.pack() - - self.entrythingy = Entry() - self.entrythingy.pack() - - # and here we get a callback when the user hits return. we could - # make the key that triggers the callback anything we wanted to. - # other typical options might be <Key-Tab> or <Key> (for anything) - self.entrythingy.bind('<Key-Return>', self.print_contents) - - # Note that here is where we bind a completely different callback to - # the same event. We pass "+" here to indicate that we wish to ADD - # this callback to the list associated with this event type. - # Not specifying "+" would simply override whatever callback was - # defined on this event. - self.entrythingy.bind('<Key-Return>', self.print_something_else, "+") - - def print_contents(self, event): - print "hi. contents of entry is now ---->", self.entrythingy.get() - - - def print_something_else(self, event): - print "hi. Now doing something completely different" - - -root = App() -root.master.title("Foo") -root.mainloop() - - - -# secret tip for experts: if you pass *any* non-false value as -# the third parameter to bind(), Tkinter.py will accumulate -# callbacks instead of overwriting. I use "+" here because that's -# the Tk notation for getting this sort of behavior. The perfect GUI -# interface would use a less obscure notation. diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-demo-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-demo-simple.py deleted file mode 100644 index a01679a66..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-demo-simple.py +++ /dev/null @@ -1,28 +0,0 @@ -from Tkinter import * - -# this program creates a canvas and puts a single polygon on the canvas - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.draw = Canvas(self, width="5i", height="5i") - - # see the other demos for other ways of specifying coords for a polygon - self.draw.create_rectangle(0, 0, "3i", "3i", fill="black") - - self.draw.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-gridding.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-gridding.py deleted file mode 100644 index 3c52b91af..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-gridding.py +++ /dev/null @@ -1,61 +0,0 @@ -from Tkinter import * - -# this is the same as simple-demo-1.py, but uses -# subclassing. -# note that there is no explicit call to start Tk. -# Tkinter is smart enough to start the system if it's not already going. - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', - background='red', - foreground='white', - height=3, - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.canvasObject = Canvas(self, width="5i", height="5i") - self.canvasObject.pack(side=LEFT) - - def mouseDown(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - self.startx = self.canvasObject.canvasx(event.x, self.griddingSize) - self.starty = self.canvasObject.canvasy(event.y, self.griddingSize) - - def mouseMotion(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - x = self.canvasObject.canvasx(event.x, self.griddingSize) - y = self.canvasObject.canvasy(event.y, self.griddingSize) - - if (self.startx != event.x) and (self.starty != event.y) : - self.canvasObject.delete(self.rubberbandBox) - self.rubberbandBox = self.canvasObject.create_rectangle( - self.startx, self.starty, x, y) - # this flushes the output, making sure that - # the rectangle makes it to the screen - # before the next event is handled - self.update_idletasks() - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - - # this is a "tagOrId" for the rectangle we draw on the canvas - self.rubberbandBox = None - - # this is the size of the gridding squares - self.griddingSize = 50 - - Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown) - Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion) - - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-or-creating.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-or-creating.py deleted file mode 100644 index 5327c0827..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-or-creating.py +++ /dev/null @@ -1,62 +0,0 @@ -from Tkinter import * - -# this file demonstrates a more sophisticated movement -- -# move dots or create new ones if you click outside the dots - -class Test(Frame): - ################################################################### - ###### Event callbacks for THE CANVAS (not the stuff drawn on it) - ################################################################### - def mouseDown(self, event): - # see if we're inside a dot. If we are, it - # gets tagged as CURRENT for free by tk. - if not event.widget.find_withtag(CURRENT): - # there is no dot here, so we can make one, - # and bind some interesting behavior to it. - # ------ - # create a dot, and mark it as CURRENT - fred = self.draw.create_oval( - event.x - 10, event.y -10, event.x +10, event.y + 10, - fill="green", tags=CURRENT) - - self.draw.tag_bind(fred, "<Any-Enter>", self.mouseEnter) - self.draw.tag_bind(fred, "<Any-Leave>", self.mouseLeave) - - self.lastx = event.x - self.lasty = event.y - - def mouseMove(self, event): - self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty) - self.lastx = event.x - self.lasty = event.y - - ################################################################### - ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas) - ################################################################### - def mouseEnter(self, event): - # the CURRENT tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="red") - - def mouseLeave(self, event): - # the CURRENT tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="blue") - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - self.draw = Canvas(self, width="5i", height="5i") - self.draw.pack(side=LEFT) - - Widget.bind(self.draw, "<1>", self.mouseDown) - Widget.bind(self.draw, "<B1-Motion>", self.mouseMove) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-w-mouse.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-w-mouse.py deleted file mode 100644 index 81785d86a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-moving-w-mouse.py +++ /dev/null @@ -1,55 +0,0 @@ -from Tkinter import * - -# this file demonstrates the movement of a single canvas item under mouse control - -class Test(Frame): - ################################################################### - ###### Event callbacks for THE CANVAS (not the stuff drawn on it) - ################################################################### - def mouseDown(self, event): - # remember where the mouse went down - self.lastx = event.x - self.lasty = event.y - - def mouseMove(self, event): - # whatever the mouse is over gets tagged as CURRENT for free by tk. - self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty) - self.lastx = event.x - self.lasty = event.y - - ################################################################### - ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas) - ################################################################### - def mouseEnter(self, event): - # the CURRENT tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="red") - - def mouseLeave(self, event): - # the CURRENT tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="blue") - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - self.draw = Canvas(self, width="5i", height="5i") - self.draw.pack(side=LEFT) - - fred = self.draw.create_oval(0, 0, 20, 20, - fill="green", tags="selected") - - self.draw.tag_bind(fred, "<Any-Enter>", self.mouseEnter) - self.draw.tag_bind(fred, "<Any-Leave>", self.mouseLeave) - - Widget.bind(self.draw, "<1>", self.mouseDown) - Widget.bind(self.draw, "<B1-Motion>", self.mouseMove) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-mult-item-sel.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-mult-item-sel.py deleted file mode 100644 index a4f267cc1..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-mult-item-sel.py +++ /dev/null @@ -1,78 +0,0 @@ -from Tkinter import * - -# allows moving dots with multiple selection. - -SELECTED_COLOR = "red" -UNSELECTED_COLOR = "blue" - -class Test(Frame): - ################################################################### - ###### Event callbacks for THE CANVAS (not the stuff drawn on it) - ################################################################### - def mouseDown(self, event): - # see if we're inside a dot. If we are, it - # gets tagged as CURRENT for free by tk. - - if not event.widget.find_withtag(CURRENT): - # we clicked outside of all dots on the canvas. unselect all. - - # re-color everything back to an unselected color - self.draw.itemconfig("selected", fill=UNSELECTED_COLOR) - # unselect everything - self.draw.dtag("selected") - else: - # mark as "selected" the thing the cursor is under - self.draw.addtag("selected", "withtag", CURRENT) - # color it as selected - self.draw.itemconfig("selected", fill=SELECTED_COLOR) - - self.lastx = event.x - self.lasty = event.y - - - def mouseMove(self, event): - self.draw.move("selected", event.x - self.lastx, event.y - self.lasty) - self.lastx = event.x - self.lasty = event.y - - def makeNewDot(self): - # create a dot, and mark it as current - fred = self.draw.create_oval(0, 0, 20, 20, - fill=SELECTED_COLOR, tags=CURRENT) - # and make it selected - self.draw.addtag("selected", "withtag", CURRENT) - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - - ################ - # make the canvas and bind some behavior to it - ################ - self.draw = Canvas(self, width="5i", height="5i") - Widget.bind(self.draw, "<1>", self.mouseDown) - Widget.bind(self.draw, "<B1-Motion>", self.mouseMove) - - # and other things..... - self.button = Button(self, text="make a new dot", foreground="blue", - command=self.makeNewDot) - - message = ("%s dots are selected and can be dragged.\n" - "%s are not selected.\n" - "Click in a dot to select it.\n" - "Click on empty space to deselect all dots." - ) % (SELECTED_COLOR, UNSELECTED_COLOR) - self.label = Message(self, width="5i", text=message) - - self.QUIT.pack(side=BOTTOM, fill=BOTH) - self.label.pack(side=BOTTOM, fill=X, expand=1) - self.button.pack(side=BOTTOM, fill=X) - self.draw.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-reading-tag-info.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-reading-tag-info.py deleted file mode 100644 index f57ea180a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-reading-tag-info.py +++ /dev/null @@ -1,49 +0,0 @@ -from Tkinter import * - - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.drawing = Canvas(self, width="5i", height="5i") - - # make a shape - pgon = self.drawing.create_polygon( - 10, 10, 110, 10, 110, 110, 10 , 110, - fill="red", tags=("weee", "foo", "groo")) - - # this is how you query an object for its attributes - # config options FOR CANVAS ITEMS always come back in tuples of length 5. - # 0 attribute name - # 1 BLANK - # 2 BLANK - # 3 default value - # 4 current value - # the blank spots are for consistency with the config command that - # is used for widgets. (remember, this is for ITEMS drawn - # on a canvas widget, not widgets) - option_value = self.drawing.itemconfig(pgon, "stipple") - print "pgon's current stipple value is -->", option_value[4], "<--" - option_value = self.drawing.itemconfig(pgon, "fill") - print "pgon's current fill value is -->", option_value[4], "<--" - print " when he is usually colored -->", option_value[3], "<--" - - ## here we print out all the tags associated with this object - option_value = self.drawing.itemconfig(pgon, "tags") - print "pgon's tags are", option_value[4] - - self.drawing.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-w-widget-draw-el.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-w-widget-draw-el.py deleted file mode 100644 index 5b26210c0..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-w-widget-draw-el.py +++ /dev/null @@ -1,36 +0,0 @@ -from Tkinter import * - -# this file demonstrates the creation of widgets as part of a canvas object - -class Test(Frame): - def printhi(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.draw = Canvas(self, width="5i", height="5i") - - self.button = Button(self, text="this is a button", - command=self.printhi) - - # note here the coords are given in pixels (form the - # upper right and corner of the window, as usual for X) - # but might just have well been given in inches or points or - # whatever...use the "anchor" option to control what point of the - # widget (in this case the button) gets mapped to the given x, y. - # you can specify corners, edges, center, etc... - self.draw.create_window(300, 300, window=self.button) - - self.draw.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/canvas-with-scrollbars.py b/sys/src/cmd/python/Demo/tkinter/matt/canvas-with-scrollbars.py deleted file mode 100644 index 81ef25a88..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/canvas-with-scrollbars.py +++ /dev/null @@ -1,60 +0,0 @@ -from Tkinter import * - -# This example program creates a scroling canvas, and demonstrates -# how to tie scrollbars and canvses together. The mechanism -# is analogus for listboxes and other widgets with -# "xscroll" and "yscroll" configuration options. - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.question = Label(self, text="Can Find The BLUE Square??????") - self.question.pack() - - self.QUIT = Button(self, text='QUIT', background='red', - height=3, command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - spacer = Frame(self, height="0.25i") - spacer.pack(side=BOTTOM) - - # notice that the scroll region (20" x 20") is larger than - # displayed size of the widget (5" x 5") - self.draw = Canvas(self, width="5i", height="5i", - background="white", - scrollregion=(0, 0, "20i", "20i")) - - self.draw.scrollX = Scrollbar(self, orient=HORIZONTAL) - self.draw.scrollY = Scrollbar(self, orient=VERTICAL) - - # now tie the three together. This is standard boilerplate text - self.draw['xscrollcommand'] = self.draw.scrollX.set - self.draw['yscrollcommand'] = self.draw.scrollY.set - self.draw.scrollX['command'] = self.draw.xview - self.draw.scrollY['command'] = self.draw.yview - - # draw something. Note that the first square - # is visible, but you need to scroll to see the second one. - self.draw.create_rectangle(0, 0, "3.5i", "3.5i", fill="black") - self.draw.create_rectangle("10i", "10i", "13.5i", "13.5i", fill="blue") - - # pack 'em up - self.draw.scrollX.pack(side=BOTTOM, fill=X) - self.draw.scrollY.pack(side=RIGHT, fill=Y) - self.draw.pack(side=LEFT) - - - def scrollCanvasX(self, *args): - print "scrolling", args - print self.draw.scrollX.get() - - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/dialog-box.py b/sys/src/cmd/python/Demo/tkinter/matt/dialog-box.py deleted file mode 100644 index dea8f3900..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/dialog-box.py +++ /dev/null @@ -1,64 +0,0 @@ -from Tkinter import * -from Dialog import Dialog - -# this shows how to create a new window with a button in it -# that can create new windows - -class Test(Frame): - def printit(self): - print "hi" - - def makeWindow(self): - """Create a top-level dialog with some buttons. - - This uses the Dialog class, which is a wrapper around the Tcl/Tk - tk_dialog script. The function returns 0 if the user clicks 'yes' - or 1 if the user clicks 'no'. - """ - # the parameters to this call are as follows: - d = Dialog( - self, ## name of a toplevel window - title="fred the dialog box",## title on the window - text="click on a choice", ## message to appear in window - bitmap="info", ## bitmap (if any) to appear; - ## if none, use "" - # legal values here are: - # string what it looks like - # ---------------------------------------------- - # error a circle with a slash through it - # grey25 grey square - # grey50 darker grey square - # hourglass use for "wait.." - # info a large, lower case "i" - # questhead a human head with a "?" in it - # question a large "?" - # warning a large "!" - # @fname X bitmap where fname is the path to the file - # - default=0, # the index of the default button choice. - # hitting return selects this - strings=("yes", "no")) - # values of the 'strings' key are the labels for the - # buttons that appear left to right in the dialog box - return d.num - - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - - # a hello button - self.hi_there = Button(self, text='Make a New Window', - command=self.makeWindow) - self.hi_there.pack(side=LEFT) - - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.windownum = 0 - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/entry-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/entry-simple.py deleted file mode 100644 index 5146e6fd9..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/entry-simple.py +++ /dev/null @@ -1,24 +0,0 @@ -from Tkinter import * -import string - -# This program shows how to use a simple type-in box - -class App(Frame): - def __init__(self, master=None): - Frame.__init__(self, master) - self.pack() - - self.entrythingy = Entry() - self.entrythingy.pack() - - # and here we get a callback when the user hits return. we could - # make the key that triggers the callback anything we wanted to. - # other typical options might be <Key-Tab> or <Key> (for anything) - self.entrythingy.bind('<Key-Return>', self.print_contents) - - def print_contents(self, event): - print "hi. contents of entry is now ---->", self.entrythingy.get() - -root = App() -root.master.title("Foo") -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/entry-with-shared-variable.py b/sys/src/cmd/python/Demo/tkinter/matt/entry-with-shared-variable.py deleted file mode 100644 index 2b76162bd..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/entry-with-shared-variable.py +++ /dev/null @@ -1,46 +0,0 @@ -from Tkinter import * -import string - -# This program shows how to make a typein box shadow a program variable. - -class App(Frame): - def __init__(self, master=None): - Frame.__init__(self, master) - self.pack() - - self.entrythingy = Entry(self) - self.entrythingy.pack() - - self.button = Button(self, text="Uppercase The Entry", - command=self.upper) - self.button.pack() - - # here we have the text in the entry widget tied to a variable. - # changes in the variable are echoed in the widget and vice versa. - # Very handy. - # there are other Variable types. See Tkinter.py for all - # the other variable types that can be shadowed - self.contents = StringVar() - self.contents.set("this is a variable") - self.entrythingy.config(textvariable=self.contents) - - # and here we get a callback when the user hits return. we could - # make the key that triggers the callback anything we wanted to. - # other typical options might be <Key-Tab> or <Key> (for anything) - self.entrythingy.bind('<Key-Return>', self.print_contents) - - def upper(self): - # notice here, we don't actually refer to the entry box. - # we just operate on the string variable and we - # because it's being looked at by the entry widget, changing - # the variable changes the entry widget display automatically. - # the strange get/set operators are clunky, true... - str = string.upper(self.contents.get()) - self.contents.set(str) - - def print_contents(self, event): - print "hi. contents of entry is now ---->", self.contents.get() - -root = App() -root.master.title("Foo") -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/killing-window-w-wm.py b/sys/src/cmd/python/Demo/tkinter/matt/killing-window-w-wm.py deleted file mode 100644 index 6a0e2fe62..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/killing-window-w-wm.py +++ /dev/null @@ -1,42 +0,0 @@ -from Tkinter import * - -# This file shows how to trap the killing of a window -# when the user uses window manager menus (typ. upper left hand corner -# menu in the decoration border). - - -### ******* this isn't really called -- read the comments -def my_delete_callback(): - print "whoops -- tried to delete me!" - -class Test(Frame): - def deathHandler(self, event): - print self, "is now getting nuked. performing some save here...." - - def createWidgets(self): - # a hello button - self.hi_there = Button(self, text='Hello') - self.hi_there.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - - ### - ### PREVENT WM kills from happening - ### - - # the docs would have you do this: - -# self.master.protocol("WM_DELETE_WINDOW", my_delete_callback) - - # unfortunately, some window managers will not send this request to a window. - # the "protocol" function seems incapable of trapping these "aggressive" window kills. - # this line of code catches everything, tho. The window is deleted, but you have a chance - # of cleaning up first. - self.bind_all("<Destroy>", self.deathHandler) - - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/menu-all-types-of-entries.py b/sys/src/cmd/python/Demo/tkinter/matt/menu-all-types-of-entries.py deleted file mode 100644 index f4afe4a8b..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/menu-all-types-of-entries.py +++ /dev/null @@ -1,244 +0,0 @@ -from Tkinter import * - -# some vocabulary to keep from getting confused. This terminology -# is something I cooked up for this file, but follows the man pages -# pretty closely -# -# -# -# This is a MENUBUTTON -# V -# +-------------+ -# | | -# -# +------------++------------++------------+ -# | || || | -# | File || Edit || Options | <-------- the MENUBAR -# | || || | -# +------------++------------++------------+ -# | New... | -# | Open... | -# | Print | -# | | <-------- This is a MENU. The lines of text in the menu are -# | | MENU ENTRIES -# | +---------------+ -# | Open Files > | file1 | -# | | file2 | -# | | another file | <------ this cascading part is also a MENU -# +----------------| | -# | | -# | | -# | | -# +---------------+ - - - -# some miscellaneous callbacks -def new_file(): - print "opening new file" - -def open_file(): - print "opening OLD file" - -def print_something(): - print "picked a menu item" - - - -anchovies = 0 - -def print_anchovies(): - global anchovies - anchovies = not anchovies - print "anchovies?", anchovies - -def makeCommandMenu(): - # make menu button - Command_button = Menubutton(mBar, text='Simple Button Commands', - underline=0) - Command_button.pack(side=LEFT, padx="2m") - - # make the pulldown part of the File menu. The parameter passed is the master. - # we attach it to the button as a python attribute called "menu" by convention. - # hopefully this isn't too confusing... - Command_button.menu = Menu(Command_button) - - # just to be cute, let's disable the undo option: - Command_button.menu.add_command(label="Undo") - # undo is the 0th entry... - Command_button.menu.entryconfig(0, state=DISABLED) - - Command_button.menu.add_command(label='New...', underline=0, - command=new_file) - Command_button.menu.add_command(label='Open...', underline=0, - command=open_file) - Command_button.menu.add_command(label='Different Font', underline=0, - font='-*-helvetica-*-r-*-*-*-180-*-*-*-*-*-*', - command=print_something) - - # we can make bitmaps be menu entries too. File format is X11 bitmap. - # if you use XV, save it under X11 bitmap format. duh-uh.,.. - Command_button.menu.add_command( - bitmap="info") - #bitmap='@/home/mjc4y/dilbert/project.status.is.doomed.last.panel.bm') - - # this is just a line - Command_button.menu.add('separator') - - # change the color - Command_button.menu.add_command(label='Quit', underline=0, - background='red', - activebackground='green', - command=Command_button.quit) - - # set up a pointer from the file menubutton back to the file menu - Command_button['menu'] = Command_button.menu - - return Command_button - - - -def makeCascadeMenu(): - # make menu button - Cascade_button = Menubutton(mBar, text='Cascading Menus', underline=0) - Cascade_button.pack(side=LEFT, padx="2m") - - # the primary pulldown - Cascade_button.menu = Menu(Cascade_button) - - # this is the menu that cascades from the primary pulldown.... - Cascade_button.menu.choices = Menu(Cascade_button.menu) - - # ...and this is a menu that cascades from that. - Cascade_button.menu.choices.wierdones = Menu(Cascade_button.menu.choices) - - # then you define the menus from the deepest level on up. - Cascade_button.menu.choices.wierdones.add_command(label='avacado') - Cascade_button.menu.choices.wierdones.add_command(label='belgian endive') - Cascade_button.menu.choices.wierdones.add_command(label='beefaroni') - - # definition of the menu one level up... - Cascade_button.menu.choices.add_command(label='Chocolate') - Cascade_button.menu.choices.add_command(label='Vanilla') - Cascade_button.menu.choices.add_command(label='TuttiFruiti') - Cascade_button.menu.choices.add_command(label='WopBopaLoopBapABopBamBoom') - Cascade_button.menu.choices.add_command(label='Rocky Road') - Cascade_button.menu.choices.add_command(label='BubbleGum') - Cascade_button.menu.choices.add_cascade( - label='Wierd Flavors', - menu=Cascade_button.menu.choices.wierdones) - - # and finally, the definition for the top level - Cascade_button.menu.add_cascade(label='more choices', - menu=Cascade_button.menu.choices) - - Cascade_button['menu'] = Cascade_button.menu - - return Cascade_button - -def makeCheckbuttonMenu(): - global fred - # make menu button - Checkbutton_button = Menubutton(mBar, text='Checkbutton Menus', - underline=0) - Checkbutton_button.pack(side=LEFT, padx='2m') - - # the primary pulldown - Checkbutton_button.menu = Menu(Checkbutton_button) - - # and all the check buttons. Note that the "variable" "onvalue" and "offvalue" options - # are not supported correctly at present. You have to do all your application - # work through the calback. - Checkbutton_button.menu.add_checkbutton(label='Pepperoni') - Checkbutton_button.menu.add_checkbutton(label='Sausage') - Checkbutton_button.menu.add_checkbutton(label='Extra Cheese') - - # so here's a callback - Checkbutton_button.menu.add_checkbutton(label='Anchovy', - command=print_anchovies) - - # and start with anchovies selected to be on. Do this by - # calling invoke on this menu option. To refer to the "anchovy" menu - # entry we need to know it's index. To do this, we use the index method - # which takes arguments of several forms: - # - # argument what it does - # ----------------------------------- - # a number -- this is useless. - # "last" -- last option in the menu - # "none" -- used with the activate command. see the man page on menus - # "active" -- the currently active menu option. A menu option is made active - # with the 'activate' method - # "@number" -- where 'number' is an integer and is treated like a y coordinate in pixels - # string pattern -- this is the option used below, and attempts to match "labels" using the - # rules of Tcl_StringMatch - Checkbutton_button.menu.invoke(Checkbutton_button.menu.index('Anchovy')) - - # set up a pointer from the file menubutton back to the file menu - Checkbutton_button['menu'] = Checkbutton_button.menu - - return Checkbutton_button - - -def makeRadiobuttonMenu(): - # make menu button - Radiobutton_button = Menubutton(mBar, text='Radiobutton Menus', - underline=0) - Radiobutton_button.pack(side=LEFT, padx='2m') - - # the primary pulldown - Radiobutton_button.menu = Menu(Radiobutton_button) - - # and all the Radio buttons. Note that the "variable" "onvalue" and "offvalue" options - # are not supported correctly at present. You have to do all your application - # work through the calback. - Radiobutton_button.menu.add_radiobutton(label='Republican') - Radiobutton_button.menu.add_radiobutton(label='Democrat') - Radiobutton_button.menu.add_radiobutton(label='Libertarian') - Radiobutton_button.menu.add_radiobutton(label='Commie') - Radiobutton_button.menu.add_radiobutton(label='Facist') - Radiobutton_button.menu.add_radiobutton(label='Labor Party') - Radiobutton_button.menu.add_radiobutton(label='Torie') - Radiobutton_button.menu.add_radiobutton(label='Independent') - Radiobutton_button.menu.add_radiobutton(label='Anarchist') - Radiobutton_button.menu.add_radiobutton(label='No Opinion') - - # set up a pointer from the file menubutton back to the file menu - Radiobutton_button['menu'] = Radiobutton_button.menu - - return Radiobutton_button - - -def makeDisabledMenu(): - Dummy_button = Menubutton(mBar, text='Dead Menu', underline=0) - Dummy_button.pack(side=LEFT, padx='2m') - - # this is the standard way of turning off a whole menu - Dummy_button["state"] = DISABLED - return Dummy_button - - -################################################# -#### Main starts here ... -root = Tk() - - -# make a menu bar -mBar = Frame(root, relief=RAISED, borderwidth=2) -mBar.pack(fill=X) - -Command_button = makeCommandMenu() -Cascade_button = makeCascadeMenu() -Checkbutton_button = makeCheckbuttonMenu() -Radiobutton_button = makeRadiobuttonMenu() -NoMenu = makeDisabledMenu() - -# finally, install the buttons in the menu bar. -# This allows for scanning from one menubutton to the next. -mBar.tk_menuBar(Command_button, Cascade_button, Checkbutton_button, Radiobutton_button, NoMenu) - - -root.title('menu demo') -root.iconname('menu demo') - -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/menu-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/menu-simple.py deleted file mode 100644 index 46b53642e..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/menu-simple.py +++ /dev/null @@ -1,112 +0,0 @@ -from Tkinter import * - -# some vocabulary to keep from getting confused. This terminology -# is something I cooked up for this file, but follows the man pages -# pretty closely -# -# -# -# This is a MENUBUTTON -# V -# +-------------+ -# | | -# -# +------------++------------++------------+ -# | || || | -# | File || Edit || Options | <-------- the MENUBAR -# | || || | -# +------------++------------++------------+ -# | New... | -# | Open... | -# | Print | -# | | <------ This is a MENU. The lines of text in the menu are -# | | MENU ENTRIES -# | +---------------+ -# | Open Files > | file1 | -# | | file2 | -# | | another file | <------ this cascading part is also a MENU -# +----------------| | -# | | -# | | -# | | -# +---------------+ - - - -def new_file(): - print "opening new file" - - -def open_file(): - print "opening OLD file" - - -def makeFileMenu(): - # make menu button : "File" - File_button = Menubutton(mBar, text='File', underline=0) - File_button.pack(side=LEFT, padx="1m") - File_button.menu = Menu(File_button) - - # add an item. The first param is a menu entry type, - # must be one of: "cascade", "checkbutton", "command", "radiobutton", "seperator" - # see menu-demo-2.py for examples of use - File_button.menu.add_command(label='New...', underline=0, - command=new_file) - - - File_button.menu.add_command(label='Open...', underline=0, - command=open_file) - - File_button.menu.add_command(label='Quit', underline=0, - command='exit') - - # set up a pointer from the file menubutton back to the file menu - File_button['menu'] = File_button.menu - - return File_button - - - -def makeEditMenu(): - Edit_button = Menubutton(mBar, text='Edit', underline=0) - Edit_button.pack(side=LEFT, padx="1m") - Edit_button.menu = Menu(Edit_button) - - # just to be cute, let's disable the undo option: - Edit_button.menu.add('command', label="Undo") - # Since the tear-off bar is the 0th entry, - # undo is the 1st entry... - Edit_button.menu.entryconfig(1, state=DISABLED) - - # and these are just for show. No "command" callbacks attached. - Edit_button.menu.add_command(label="Cut") - Edit_button.menu.add_command(label="Copy") - Edit_button.menu.add_command(label="Paste") - - # set up a pointer from the file menubutton back to the file menu - Edit_button['menu'] = Edit_button.menu - - return Edit_button - - -################################################# - -#### Main starts here ... -root = Tk() - - -# make a menu bar -mBar = Frame(root, relief=RAISED, borderwidth=2) -mBar.pack(fill=X) - -File_button = makeFileMenu() -Edit_button = makeEditMenu() - -# finally, install the buttons in the menu bar. -# This allows for scanning from one menubutton to the next. -mBar.tk_menuBar(File_button, Edit_button) - -root.title('menu demo') -root.iconname('packer') - -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-1.py b/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-1.py deleted file mode 100644 index 7b20f02b3..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-1.py +++ /dev/null @@ -1,28 +0,0 @@ -from Tkinter import * - - -class Test(Frame): - def createWidgets(self): - - self.Gpanel = Frame(self, width='1i', height='1i', - background='green') - self.Gpanel.pack(side=LEFT) - - # a QUIT button - self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT', - foreground='red', - command=self.quit) - self.Gpanel.QUIT.pack(side=LEFT) - - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.master.title('packer demo') -test.master.iconname('packer') - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-2.py b/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-2.py deleted file mode 100644 index 9ee197cf9..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/not-what-you-might-think-2.py +++ /dev/null @@ -1,30 +0,0 @@ -from Tkinter import * - - -class Test(Frame): - def createWidgets(self): - - self.Gpanel = Frame(self, width='1i', height='1i', - background='green') - - # this line turns off the recalculation of geometry by masters. - self.Gpanel.propagate(0) - - self.Gpanel.pack(side=LEFT) - - # a QUIT button - self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT', foreground='red', - command=self.quit) - self.Gpanel.QUIT.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.master.title('packer demo') -test.master.iconname('packer') - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/packer-and-placer-together.py b/sys/src/cmd/python/Demo/tkinter/matt/packer-and-placer-together.py deleted file mode 100644 index 184d56bc1..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/packer-and-placer-together.py +++ /dev/null @@ -1,41 +0,0 @@ -from Tkinter import * - -# This is a program that tests the placer geom manager in conjunction with -# the packer. The background (green) is packed, while the widget inside is placed - - -def do_motion(event): - app.button.place(x=event.x, y=event.y) - -def dothis(): - print 'calling me!' - -def createWidgets(top): - # make a frame. Note that the widget is 200 x 200 - # and the window containing is 400x400. We do this - # simply to show that this is possible. The rest of the - # area is inaccesssible. - f = Frame(top, width=200, height=200, background='green') - - # note that we use a different manager here. - # This way, the top level frame widget resizes when the - # application window does. - f.pack(fill=BOTH, expand=1) - - # now make a button - f.button = Button(f, foreground='red', text='amazing', command=dothis) - - # and place it so that the nw corner is - # 1/2 way along the top X edge of its' parent - f.button.place(relx=0.5, rely=0.0, anchor=NW) - - # allow the user to move the button SUIT-style. - f.bind('<Control-Shift-Motion>', do_motion) - - return f - -root = Tk() -app = createWidgets(root) -root.geometry("400x400") -root.maxsize(1000, 1000) -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/packer-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/packer-simple.py deleted file mode 100644 index f55f1bee7..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/packer-simple.py +++ /dev/null @@ -1,32 +0,0 @@ -from Tkinter import * - - -class Test(Frame): - def printit(self): - print self.hi_there["command"] - - def createWidgets(self): - # a hello button - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - - self.hi_there = Button(self, text='Hello', - command=self.printit) - self.hi_there.pack(side=LEFT) - - # note how Packer defaults to side=TOP - - self.guy2 = Button(self, text='button 2') - self.guy2.pack() - - self.guy3 = Button(self, text='button 3') - self.guy3.pack() - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/placer-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/placer-simple.py deleted file mode 100644 index 30d9e9e90..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/placer-simple.py +++ /dev/null @@ -1,39 +0,0 @@ -from Tkinter import * - -# This is a program that tests the placer geom manager - -def do_motion(event): - app.button.place(x=event.x, y=event.y) - -def dothis(): - print 'calling me!' - -def createWidgets(top): - # make a frame. Note that the widget is 200 x 200 - # and the window containing is 400x400. We do this - # simply to show that this is possible. The rest of the - # area is inaccesssible. - f = Frame(top, width=200, height=200, background='green') - - # place it so the upper left hand corner of - # the frame is in the upper left corner of - # the parent - f.place(relx=0.0, rely=0.0) - - # now make a button - f.button = Button(f, foreground='red', text='amazing', command=dothis) - - # and place it so that the nw corner is - # 1/2 way along the top X edge of its' parent - f.button.place(relx=0.5, rely=0.0, anchor=NW) - - # allow the user to move the button SUIT-style. - f.bind('<Control-Shift-Motion>', do_motion) - - return f - -root = Tk() -app = createWidgets(root) -root.geometry("400x400") -root.maxsize(1000, 1000) -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/pong-demo-1.py b/sys/src/cmd/python/Demo/tkinter/matt/pong-demo-1.py deleted file mode 100644 index 7fcf800b6..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/pong-demo-1.py +++ /dev/null @@ -1,54 +0,0 @@ -from Tkinter import * - -import string - - -class Pong(Frame): - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - - ## The playing field - self.draw = Canvas(self, width="5i", height="5i") - - ## The speed control for the ball - self.speed = Scale(self, orient=HORIZONTAL, label="ball speed", - from_=-100, to=100) - - self.speed.pack(side=BOTTOM, fill=X) - - # The ball - self.ball = self.draw.create_oval("0i", "0i", "0.10i", "0.10i", - fill="red") - self.x = 0.05 - self.y = 0.05 - self.velocity_x = 0.3 - self.velocity_y = 0.5 - - self.draw.pack(side=LEFT) - - def moveBall(self, *args): - if (self.x > 5.0) or (self.x < 0.0): - self.velocity_x = -1.0 * self.velocity_x - if (self.y > 5.0) or (self.y < 0.0): - self.velocity_y = -1.0 * self.velocity_y - - deltax = (self.velocity_x * self.speed.get() / 100.0) - deltay = (self.velocity_y * self.speed.get() / 100.0) - self.x = self.x + deltax - self.y = self.y + deltay - - self.draw.move(self.ball, "%ri" % deltax, "%ri" % deltay) - self.after(10, self.moveBall) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - self.after(10, self.moveBall) - - -game = Pong() - -game.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/printing-coords-of-items.py b/sys/src/cmd/python/Demo/tkinter/matt/printing-coords-of-items.py deleted file mode 100644 index a37733d03..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/printing-coords-of-items.py +++ /dev/null @@ -1,61 +0,0 @@ -from Tkinter import * - -# this file demonstrates the creation of widgets as part of a canvas object - -class Test(Frame): - ################################################################### - ###### Event callbacks for THE CANVAS (not the stuff drawn on it) - ################################################################### - def mouseDown(self, event): - # see if we're inside a dot. If we are, it - # gets tagged as CURRENT for free by tk. - - if not event.widget.find_withtag(CURRENT): - # there is no dot here, so we can make one, - # and bind some interesting behavior to it. - # ------ - # create a dot, and mark it as current - fred = self.draw.create_oval( - event.x - 10, event.y -10, event.x +10, event.y + 10, - fill="green") - self.draw.tag_bind(fred, "<Enter>", self.mouseEnter) - self.draw.tag_bind(fred, "<Leave>", self.mouseLeave) - self.lastx = event.x - self.lasty = event.y - - def mouseMove(self, event): - self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty) - self.lastx = event.x - self.lasty = event.y - - ################################################################### - ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas) - ################################################################### - def mouseEnter(self, event): - # the "current" tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="red") - print self.draw.coords(CURRENT) - - def mouseLeave(self, event): - # the "current" tag is applied to the object the cursor is over. - # this happens automatically. - self.draw.itemconfig(CURRENT, fill="blue") - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - self.draw = Canvas(self, width="5i", height="5i") - self.draw.pack(side=LEFT) - - Widget.bind(self.draw, "<1>", self.mouseDown) - Widget.bind(self.draw, "<B1-Motion>", self.mouseMove) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/radiobutton-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/radiobutton-simple.py deleted file mode 100644 index e9d6afee1..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/radiobutton-simple.py +++ /dev/null @@ -1,62 +0,0 @@ -from Tkinter import * - -# This is a demo program that shows how to -# create radio buttons and how to get other widgets to -# share the information in a radio button. -# -# There are other ways of doing this too, but -# the "variable" option of radiobuttons seems to be the easiest. -# -# note how each button has a value it sets the variable to as it gets hit. - - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - - self.flavor = StringVar() - self.flavor.set("chocolate") - - self.radioframe = Frame(self) - self.radioframe.pack() - - # 'text' is the label - # 'variable' is the name of the variable that all these radio buttons share - # 'value' is the value this variable takes on when the radio button is selected - # 'anchor' makes the text appear left justified (default is centered. ick) - self.radioframe.choc = Radiobutton( - self.radioframe, text="Chocolate Flavor", - variable=self.flavor, value="chocolate", - anchor=W) - self.radioframe.choc.pack(fill=X) - - self.radioframe.straw = Radiobutton( - self.radioframe, text="Strawberry Flavor", - variable=self.flavor, value="strawberry", - anchor=W) - self.radioframe.straw.pack(fill=X) - - self.radioframe.lemon = Radiobutton( - self.radioframe, text="Lemon Flavor", - variable=self.flavor, value="lemon", - anchor=W) - self.radioframe.lemon.pack(fill=X) - - # this is a text entry that lets you type in the name of a flavor too. - self.entry = Entry(self, textvariable=self.flavor) - self.entry.pack(fill=X) - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/rubber-band-box-demo-1.py b/sys/src/cmd/python/Demo/tkinter/matt/rubber-band-box-demo-1.py deleted file mode 100644 index b00518e00..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/rubber-band-box-demo-1.py +++ /dev/null @@ -1,58 +0,0 @@ -from Tkinter import * - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', - background='red', - foreground='white', - height=3, - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.canvasObject = Canvas(self, width="5i", height="5i") - self.canvasObject.pack(side=LEFT) - - def mouseDown(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - self.startx = self.canvasObject.canvasx(event.x) - self.starty = self.canvasObject.canvasy(event.y) - - def mouseMotion(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - x = self.canvasObject.canvasx(event.x) - y = self.canvasObject.canvasy(event.y) - - if (self.startx != event.x) and (self.starty != event.y) : - self.canvasObject.delete(self.rubberbandBox) - self.rubberbandBox = self.canvasObject.create_rectangle( - self.startx, self.starty, x, y) - # this flushes the output, making sure that - # the rectangle makes it to the screen - # before the next event is handled - self.update_idletasks() - - def mouseUp(self, event): - self.canvasObject.delete(self.rubberbandBox) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - - # this is a "tagOrId" for the rectangle we draw on the canvas - self.rubberbandBox = None - - # and the bindings that make it work.. - Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown) - Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion) - Widget.bind(self.canvasObject, "<Button1-ButtonRelease>", self.mouseUp) - - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/rubber-line-demo-1.py b/sys/src/cmd/python/Demo/tkinter/matt/rubber-line-demo-1.py deleted file mode 100644 index 59b8bd992..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/rubber-line-demo-1.py +++ /dev/null @@ -1,51 +0,0 @@ -from Tkinter import * - -class Test(Frame): - def printit(self): - print "hi" - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', - background='red', - foreground='white', - height=3, - command=self.quit) - self.QUIT.pack(side=BOTTOM, fill=BOTH) - - self.canvasObject = Canvas(self, width="5i", height="5i") - self.canvasObject.pack(side=LEFT) - - def mouseDown(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - self.startx = self.canvasObject.canvasx(event.x) - self.starty = self.canvasObject.canvasy(event.y) - - def mouseMotion(self, event): - # canvas x and y take the screen coords from the event and translate - # them into the coordinate system of the canvas object - x = self.canvasObject.canvasx(event.x) - y = self.canvasObject.canvasy(event.y) - - if (self.startx != event.x) and (self.starty != event.y) : - self.canvasObject.delete(self.rubberbandLine) - self.rubberbandLine = self.canvasObject.create_line( - self.startx, self.starty, x, y) - # this flushes the output, making sure that - # the rectangle makes it to the screen - # before the next event is handled - self.update_idletasks() - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - # this is a "tagOrId" for the rectangle we draw on the canvas - self.rubberbandLine = None - Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown) - Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion) - - -test = Test() - -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/slider-demo-1.py b/sys/src/cmd/python/Demo/tkinter/matt/slider-demo-1.py deleted file mode 100644 index db6114b1a..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/slider-demo-1.py +++ /dev/null @@ -1,36 +0,0 @@ -from Tkinter import * - -# shows how to make a slider, set and get its value under program control - - -class Test(Frame): - def print_value(self, val): - print "slider now at", val - - def reset(self): - self.slider.set(0) - - def createWidgets(self): - self.slider = Scale(self, from_=0, to=100, - orient=HORIZONTAL, - length="3i", - label="happy slider", - command=self.print_value) - - self.reset = Button(self, text='reset slider', - command=self.reset) - - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - - self.slider.pack(side=LEFT) - self.reset.pack(side=LEFT) - self.QUIT.pack(side=LEFT, fill=BOTH) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/subclass-existing-widgets.py b/sys/src/cmd/python/Demo/tkinter/matt/subclass-existing-widgets.py deleted file mode 100644 index 0e08f9206..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/subclass-existing-widgets.py +++ /dev/null @@ -1,28 +0,0 @@ -from Tkinter import * - -# This is a program that makes a simple two button application - - -class New_Button(Button): - def callback(self): - print self.counter - self.counter = self.counter + 1 - -def createWidgets(top): - f = Frame(top) - f.pack() - f.QUIT = Button(f, text='QUIT', foreground='red', command=top.quit) - - f.QUIT.pack(side=LEFT, fill=BOTH) - - # a hello button - f.hi_there = New_Button(f, text='Hello') - # we do this on a different line because we need to reference f.hi_there - f.hi_there.config(command=f.hi_there.callback) - f.hi_there.pack(side=LEFT) - f.hi_there.counter = 43 - - -root = Tk() -createWidgets(root) -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/two-radio-groups.py b/sys/src/cmd/python/Demo/tkinter/matt/two-radio-groups.py deleted file mode 100644 index 9fd8f4f07..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/two-radio-groups.py +++ /dev/null @@ -1,110 +0,0 @@ -from Tkinter import * - -# The way to think about this is that each radio button menu -# controls a different variable -- clicking on one of the -# mutually exclusive choices in a radiobutton assigns some value -# to an application variable you provide. When you define a -# radiobutton menu choice, you have the option of specifying the -# name of a varaible and value to assign to that variable when -# that choice is selected. This clever mechanism relieves you, -# the programmer, from having to write a dumb callback that -# probably wouldn't have done anything more than an assignment -# anyway. The Tkinter options for this follow their Tk -# counterparts: -# {"variable" : my_flavor_variable, "value" : "strawberry"} -# where my_flavor_variable is an instance of one of the -# subclasses of Variable, provided in Tkinter.py (there is -# StringVar(), IntVar(), DoubleVar() and BooleanVar() to choose -# from) - - - -def makePoliticalParties(var): - # make menu button - Radiobutton_button = Menubutton(mBar, text='Political Party', - underline=0) - Radiobutton_button.pack(side=LEFT, padx='2m') - - # the primary pulldown - Radiobutton_button.menu = Menu(Radiobutton_button) - - Radiobutton_button.menu.add_radiobutton(label='Republican', - variable=var, value=1) - - Radiobutton_button.menu.add('radiobutton', {'label': 'Democrat', - 'variable' : var, - 'value' : 2}) - - Radiobutton_button.menu.add('radiobutton', {'label': 'Libertarian', - 'variable' : var, - 'value' : 3}) - - var.set(2) - - # set up a pointer from the file menubutton back to the file menu - Radiobutton_button['menu'] = Radiobutton_button.menu - - return Radiobutton_button - - -def makeFlavors(var): - # make menu button - Radiobutton_button = Menubutton(mBar, text='Flavors', - underline=0) - Radiobutton_button.pack(side=LEFT, padx='2m') - - # the primary pulldown - Radiobutton_button.menu = Menu(Radiobutton_button) - - Radiobutton_button.menu.add_radiobutton(label='Strawberry', - variable=var, value='Strawberry') - - Radiobutton_button.menu.add_radiobutton(label='Chocolate', - variable=var, value='Chocolate') - - Radiobutton_button.menu.add_radiobutton(label='Rocky Road', - variable=var, value='Rocky Road') - - # choose a default - var.set("Chocolate") - - # set up a pointer from the file menubutton back to the file menu - Radiobutton_button['menu'] = Radiobutton_button.menu - - return Radiobutton_button - - -def printStuff(): - print "party is", party.get() - print "flavor is", flavor.get() - print - -################################################# -#### Main starts here ... -root = Tk() - - -# make a menu bar -mBar = Frame(root, relief=RAISED, borderwidth=2) -mBar.pack(fill=X) - -# make two application variables, -# one to control each radio button set -party = IntVar() -flavor = StringVar() - -Radiobutton_button = makePoliticalParties(party) -Radiobutton_button2 = makeFlavors(flavor) - -# finally, install the buttons in the menu bar. -# This allows for scanning from one menubutton to the next. -mBar.tk_menuBar(Radiobutton_button, Radiobutton_button2) - -b = Button(root, text="print party and flavor", foreground="red", - command=printStuff) -b.pack(side=TOP) - -root.title('menu demo') -root.iconname('menu demo') - -root.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-more.py b/sys/src/cmd/python/Demo/tkinter/matt/window-creation-more.py deleted file mode 100644 index eb0eb6fc1..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-more.py +++ /dev/null @@ -1,35 +0,0 @@ -from Tkinter import * - -# this shows how to create a new window with a button in it -# that can create new windows - -class Test(Frame): - def printit(self): - print "hi" - - def makeWindow(self): - fred = Toplevel() - fred.label = Button(fred, - text="This is window number %d." % self.windownum, - command=self.makeWindow) - fred.label.pack() - self.windownum = self.windownum + 1 - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - self.QUIT.pack(side=LEFT, fill=BOTH) - - # a hello button - self.hi_there = Button(self, text='Make a New Window', - command=self.makeWindow) - self.hi_there.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.windownum = 0 - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-simple.py b/sys/src/cmd/python/Demo/tkinter/matt/window-creation-simple.py deleted file mode 100644 index c990ed9bf..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-simple.py +++ /dev/null @@ -1,31 +0,0 @@ -from Tkinter import * - -# this shows how to spawn off new windows at a button press - -class Test(Frame): - def printit(self): - print "hi" - - def makeWindow(self): - fred = Toplevel() - fred.label = Label(fred, text="Here's a new window") - fred.label.pack() - - def createWidgets(self): - self.QUIT = Button(self, text='QUIT', foreground='red', - command=self.quit) - - self.QUIT.pack(side=LEFT, fill=BOTH) - - # a hello button - self.hi_there = Button(self, text='Make a New Window', - command=self.makeWindow) - self.hi_there.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() diff --git a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-w-location.py b/sys/src/cmd/python/Demo/tkinter/matt/window-creation-w-location.py deleted file mode 100644 index 3f2b5b069..000000000 --- a/sys/src/cmd/python/Demo/tkinter/matt/window-creation-w-location.py +++ /dev/null @@ -1,45 +0,0 @@ -from Tkinter import * - -import sys -##sys.path.append("/users/mjc4y/projects/python/tkinter/utils") -##from TkinterUtils import * - -# this shows how to create a new window with a button in it that -# can create new windows - -class QuitButton(Button): - def __init__(self, master, *args, **kwargs): - if not kwargs.has_key("text"): - kwargs["text"] = "QUIT" - if not kwargs.has_key("command"): - kwargs["command"] = master.quit - apply(Button.__init__, (self, master) + args, kwargs) - -class Test(Frame): - def makeWindow(self, *args): - fred = Toplevel() - - fred.label = Canvas (fred, width="2i", height="2i") - - fred.label.create_line("0", "0", "2i", "2i") - fred.label.create_line("0", "2i", "2i", "0") - fred.label.pack() - - ##centerWindow(fred, self.master) - - def createWidgets(self): - self.QUIT = QuitButton(self) - self.QUIT.pack(side=LEFT, fill=BOTH) - - self.makeWindow = Button(self, text='Make a New Window', - width=50, height=20, - command=self.makeWindow) - self.makeWindow.pack(side=LEFT) - - def __init__(self, master=None): - Frame.__init__(self, master) - Pack.config(self) - self.createWidgets() - -test = Test() -test.mainloop() |
